Rename note data to include sprout

This commit is contained in:
Eirik Ogilvie-Wigley
2018-07-12 15:21:42 -06:00
committed by Simon
parent a7a62b724b
commit 005f3ad1dd
4 changed files with 111 additions and 111 deletions

View File

@@ -197,14 +197,14 @@ public:
std::string ToString() const;
};
class CNoteData
class SproutNoteData
{
public:
libzcash::SproutPaymentAddress address;
/**
* Cached note nullifier. May not be set if the wallet was not unlocked when
* this was CNoteData was created. If not set, we always assume that the
* this was SproutNoteData was created. If not set, we always assume that the
* note has not been spent.
*
* It's okay to cache the nullifier in the wallet, because we are storing
@@ -225,7 +225,7 @@ public:
/**
* Block height corresponding to the most current witness.
*
* When we first create a CNoteData in CWallet::FindMyNotes, this is set to
* When we first create a SproutNoteData in CWallet::FindMyNotes, this is set to
* -1 as a placeholder. The next time CWallet::ChainTip is called, we can
* determine what height the witness cache for this note is valid for (even
* if no witnesses were cached), and so can set the correct value in
@@ -233,10 +233,10 @@ public:
*/
int witnessHeight;
CNoteData() : address(), nullifier(), witnessHeight {-1} { }
CNoteData(libzcash::SproutPaymentAddress a) :
SproutNoteData() : address(), nullifier(), witnessHeight {-1} { }
SproutNoteData(libzcash::SproutPaymentAddress a) :
address {a}, nullifier(), witnessHeight {-1} { }
CNoteData(libzcash::SproutPaymentAddress a, uint256 n) :
SproutNoteData(libzcash::SproutPaymentAddress a, uint256 n) :
address {a}, nullifier {n}, witnessHeight {-1} { }
ADD_SERIALIZE_METHODS;
@@ -249,21 +249,21 @@ public:
READWRITE(witnessHeight);
}
friend bool operator<(const CNoteData& a, const CNoteData& b) {
friend bool operator<(const SproutNoteData& a, const SproutNoteData& b) {
return (a.address < b.address ||
(a.address == b.address && a.nullifier < b.nullifier));
}
friend bool operator==(const CNoteData& a, const CNoteData& b) {
friend bool operator==(const SproutNoteData& a, const SproutNoteData& b) {
return (a.address == b.address && a.nullifier == b.nullifier);
}
friend bool operator!=(const CNoteData& a, const CNoteData& b) {
friend bool operator!=(const SproutNoteData& a, const SproutNoteData& b) {
return !(a == b);
}
};
typedef std::map<JSOutPoint, CNoteData> mapNoteData_t;
typedef std::map<JSOutPoint, SproutNoteData> mapSproutNoteData_t;
/** Decrypted note and its location in a transaction. */
struct CSproutNotePlaintextEntry
@@ -350,7 +350,7 @@ private:
public:
mapValue_t mapValue;
mapNoteData_t mapNoteData;
mapSproutNoteData_t mapSproutNoteData;
std::vector<std::pair<std::string, std::string> > vOrderForm;
unsigned int fTimeReceivedIsTxTime;
unsigned int nTimeReceived; //! time received by this node
@@ -403,7 +403,7 @@ public:
{
pwallet = pwalletIn;
mapValue.clear();
mapNoteData.clear();
mapSproutNoteData.clear();
vOrderForm.clear();
fTimeReceivedIsTxTime = false;
nTimeReceived = 0;
@@ -453,7 +453,7 @@ public:
std::vector<CMerkleTx> vUnused; //! Used to be vtxPrev
READWRITE(vUnused);
READWRITE(mapValue);
READWRITE(mapNoteData);
READWRITE(mapSproutNoteData);
READWRITE(vOrderForm);
READWRITE(fTimeReceivedIsTxTime);
READWRITE(nTimeReceived);
@@ -495,7 +495,7 @@ public:
MarkDirty();
}
void SetNoteData(mapNoteData_t &noteData);
void SetNoteData(mapSproutNoteData_t &noteData);
//! filter decides which addresses will count towards the debit
CAmount GetDebit(const isminefilter& filter) const;
@@ -842,7 +842,7 @@ public:
*
* - GetFilteredNotes can't filter out spent notes.
*
* - Per the comment in CNoteData, we assume that if we don't have a
* - Per the comment in SproutNoteData, we assume that if we don't have a
* cached nullifier, the note is not spent.
*
* Another more problematic implication is that the wallet can fail to
@@ -1053,7 +1053,7 @@ public:
const ZCNoteDecryption& dec,
const uint256& hSig,
uint8_t n) const;
mapNoteData_t FindMyNotes(const CTransaction& tx) const;
mapSproutNoteData_t FindMyNotes(const CTransaction& tx) const;
bool IsFromMe(const uint256& nullifier) const;
void GetNoteWitnesses(
std::vector<JSOutPoint> notes,