Serialize Sapling data in CWalletTx
If 2.0.0 nodes upgrade to 2.0.1 after Sapling has activated, the v4 Sapling transactions in their wallet will be treated as corrupt, and a rescan will be triggered which will overwrite the old-format transactions with the new Sapling-aware format.
This commit is contained in:
parent
2fcf06077f
commit
48a93fd2e0
|
@ -283,6 +283,20 @@ public:
|
|||
libzcash::SaplingIncomingViewingKey ivk;
|
||||
boost::optional<uint256> nullifier;
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
int nVersion = s.GetVersion();
|
||||
if (!(s.GetType() & SER_GETHASH)) {
|
||||
READWRITE(nVersion);
|
||||
}
|
||||
READWRITE(ivk);
|
||||
READWRITE(nullifier);
|
||||
READWRITE(witnesses);
|
||||
READWRITE(witnessHeight);
|
||||
}
|
||||
|
||||
friend bool operator==(const SaplingNoteData& a, const SaplingNoteData& b) {
|
||||
return (a.ivk == b.ivk && a.nullifier == b.nullifier && a.witnessHeight == b.witnessHeight);
|
||||
}
|
||||
|
@ -509,8 +523,10 @@ public:
|
|||
READWRITE(nTimeReceived);
|
||||
READWRITE(fFromMe);
|
||||
READWRITE(fSpent);
|
||||
// TODO:
|
||||
//READWRITE(mapSaplingNoteData);
|
||||
|
||||
if (fOverwintered && nVersion >= SAPLING_TX_VERSION) {
|
||||
READWRITE(mapSaplingNoteData);
|
||||
}
|
||||
|
||||
if (ser_action.ForRead())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue