Skip to content

Commit 29c02c7

Browse files
committed
[Cleanup] Remove ZerocoinParams from legacy CoinSpend classes
1 parent a038651 commit 29c02c7

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

src/libzerocoin/CoinSpend.h

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ namespace libzerocoin
3333
class AccumulatorProofOfKnowledge {
3434
public:
3535
AccumulatorProofOfKnowledge() {};
36-
AccumulatorProofOfKnowledge(const AccumulatorAndProofParams* p): params(p) {};
3736
ADD_SERIALIZE_METHODS;
3837
template <typename Stream, typename Operation>
3938
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
@@ -44,7 +43,6 @@ class AccumulatorProofOfKnowledge {
4443
READWRITE(s_delta); READWRITE(s_xi); READWRITE(s_phi); READWRITE(s_gamma); READWRITE(s_psi);
4544
}
4645
private:
47-
const AccumulatorAndProofParams* params;
4846
CBigNum C_e, C_u, C_r;
4947
CBigNum st_1, st_2, st_3;
5048
CBigNum t_1, t_2, t_3, t_4;
@@ -58,7 +56,6 @@ class AccumulatorProofOfKnowledge {
5856
class SerialNumberSignatureOfKnowledge {
5957
public:
6058
SerialNumberSignatureOfKnowledge(){};
61-
SerialNumberSignatureOfKnowledge(const ZerocoinParams* p): params(p) {}
6259
ADD_SERIALIZE_METHODS;
6360
template <typename Stream, typename Operation>
6461
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
@@ -68,7 +65,6 @@ class SerialNumberSignatureOfKnowledge {
6865
READWRITE(hash);
6966
}
7067
private:
71-
const ZerocoinParams* params;
7268
uint256 hash;
7369
std::vector<CBigNum> s_notprime;
7470
std::vector<CBigNum> sprime;
@@ -79,23 +75,13 @@ class SerialNumberSignatureOfKnowledge {
7975
class CommitmentProofOfKnowledge {
8076
public:
8177
CommitmentProofOfKnowledge() {};
82-
CommitmentProofOfKnowledge(const IntegerGroupParams* ap, const IntegerGroupParams* bp): ap(ap), bp(bp) {};
83-
template<typename Stream>
84-
CommitmentProofOfKnowledge(const IntegerGroupParams* aParams, const IntegerGroupParams* bParams, Stream& strm):
85-
ap(aParams),
86-
bp(bParams)
87-
{
88-
strm >> *this;
89-
}
90-
9178
ADD_SERIALIZE_METHODS;
9279
template <typename Stream, typename Operation>
9380
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
9481
{
9582
READWRITE(S1); READWRITE(S2); READWRITE(S3); READWRITE(challenge);
9683
}
9784
private:
98-
const IntegerGroupParams *ap, *bp;
9985
CBigNum S1, S2, S3, challenge;
10086
};
10187

@@ -109,31 +95,10 @@ class CoinSpend
10995
{
11096
public:
11197

112-
CoinSpend(){};
113-
114-
//! \param paramsV1 - if this is a V1 zerocoin, then use params that existed with initial modulus, ignored otherwise
115-
//! \param paramsV2 - params that begin when V2 zerocoins begin on the PIVX network
116-
//! \param strm - a serialized CoinSpend
117-
template <typename Stream>
118-
CoinSpend(const ZerocoinParams* paramsV1, const ZerocoinParams* paramsV2, Stream& strm) :
119-
accumulatorPoK(&paramsV2->accumulatorParams),
120-
serialNumberSoK(paramsV1),
121-
commitmentPoK(&paramsV1->serialNumberSoKCommitmentGroup, &paramsV2->accumulatorParams.accumulatorPoKCommitmentGroup)
122-
123-
{
124-
Stream strmCopy = strm;
125-
strm >> *this;
126-
127-
//Need to reset some parameters if v2
128-
if (getCoinVersion() >= PrivateCoin::PUBKEY_VERSION) {
129-
accumulatorPoK = AccumulatorProofOfKnowledge(&paramsV2->accumulatorParams);
130-
serialNumberSoK = SerialNumberSignatureOfKnowledge(paramsV2);
131-
commitmentPoK = CommitmentProofOfKnowledge(&paramsV2->serialNumberSoKCommitmentGroup, &paramsV2->accumulatorParams.accumulatorPoKCommitmentGroup);
132-
strmCopy >> *this;
133-
}
134-
}
135-
98+
CoinSpend() {};
99+
CoinSpend(CDataStream& strm) { strm >> *this; }
136100
virtual ~CoinSpend(){};
101+
137102
const CBigNum& getCoinSerialNumber() const { return this->coinSerialNumber; }
138103
CoinDenomination getDenomination() const { return this->denomination; }
139104
uint32_t getAccumulatorChecksum() const { return this->accChecksum; }

src/zpivchain.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,7 @@ libzerocoin::CoinSpend TxInToZerocoinSpend(const CTxIn& txin)
352352
std::vector<char, zero_after_free_allocator<char> > dataTxIn;
353353
dataTxIn.insert(dataTxIn.end(), txin.scriptSig.begin() + BIGNUM_SIZE, txin.scriptSig.end());
354354
CDataStream serializedCoinSpend(dataTxIn, SER_NETWORK, PROTOCOL_VERSION);
355-
356-
libzerocoin::ZerocoinParams* paramsAccumulator = Params().Zerocoin_Params(chainActive.Height() < Params().Zerocoin_Block_V2_Start());
357-
libzerocoin::CoinSpend spend(Params().Zerocoin_Params(true), paramsAccumulator, serializedCoinSpend);
358-
355+
libzerocoin::CoinSpend spend(serializedCoinSpend);
359356
return spend;
360357
}
361358

0 commit comments

Comments
 (0)