Rename GetSerial to GetNullifier.
This commit is contained in:
parent
ee964faf3d
commit
616f8d05af
|
@ -41,7 +41,7 @@ bool CCoins::Spend(uint32_t nPos)
|
|||
return true;
|
||||
}
|
||||
bool CCoinsView::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const { return false; }
|
||||
bool CCoinsView::GetSerial(const uint256 &serial) const { return false; }
|
||||
bool CCoinsView::GetNullifier(const uint256 &serial) const { return false; }
|
||||
bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) const { return false; }
|
||||
bool CCoinsView::HaveCoins(const uint256 &txid) const { return false; }
|
||||
uint256 CCoinsView::GetBestBlock() const { return uint256(); }
|
||||
|
@ -57,7 +57,7 @@ bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; }
|
|||
CCoinsViewBacked::CCoinsViewBacked(CCoinsView *viewIn) : base(viewIn) { }
|
||||
|
||||
bool CCoinsViewBacked::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const { return base->GetAnchorAt(rt, tree); }
|
||||
bool CCoinsViewBacked::GetSerial(const uint256 &serial) const { return base->GetSerial(serial); }
|
||||
bool CCoinsViewBacked::GetNullifier(const uint256 &serial) const { return base->GetNullifier(serial); }
|
||||
bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) const { return base->GetCoins(txid, coins); }
|
||||
bool CCoinsViewBacked::HaveCoins(const uint256 &txid) const { return base->HaveCoins(txid); }
|
||||
uint256 CCoinsViewBacked::GetBestBlock() const { return base->GetBestBlock(); }
|
||||
|
@ -128,13 +128,13 @@ bool CCoinsViewCache::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tr
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CCoinsViewCache::GetSerial(const uint256 &serial) const {
|
||||
bool CCoinsViewCache::GetNullifier(const uint256 &serial) const {
|
||||
CSerialsMap::iterator it = cacheSerials.find(serial);
|
||||
if (it != cacheSerials.end())
|
||||
return it->second.entered;
|
||||
|
||||
CSerialsCacheEntry entry;
|
||||
bool tmp = base->GetSerial(serial);
|
||||
bool tmp = base->GetNullifier(serial);
|
||||
entry.entered = tmp;
|
||||
|
||||
cacheSerials.insert(std::make_pair(serial, entry));
|
||||
|
@ -398,7 +398,7 @@ bool CCoinsViewCache::HaveJoinSplitRequirements(const CTransaction& tx) const
|
|||
{
|
||||
BOOST_FOREACH(const uint256& serial, pour.nullifiers)
|
||||
{
|
||||
if (GetSerial(serial)) {
|
||||
if (GetNullifier(serial)) {
|
||||
// If the serial is set, this transaction
|
||||
// double-spends!
|
||||
return false;
|
||||
|
|
|
@ -347,7 +347,7 @@ public:
|
|||
virtual bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
|
||||
|
||||
//! Determine whether a serial is spent or not
|
||||
virtual bool GetSerial(const uint256 &serial) const;
|
||||
virtual bool GetNullifier(const uint256 &serial) const;
|
||||
|
||||
//! Retrieve the CCoins (unspent transaction outputs) for a given txid
|
||||
virtual bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
|
@ -387,7 +387,7 @@ protected:
|
|||
public:
|
||||
CCoinsViewBacked(CCoinsView *viewIn);
|
||||
bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
|
||||
bool GetSerial(const uint256 &serial) const;
|
||||
bool GetNullifier(const uint256 &serial) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
bool HaveCoins(const uint256 &txid) const;
|
||||
uint256 GetBestBlock() const;
|
||||
|
@ -451,7 +451,7 @@ public:
|
|||
|
||||
// Standard CCoinsView methods
|
||||
bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
|
||||
bool GetSerial(const uint256 &serial) const;
|
||||
bool GetNullifier(const uint256 &serial) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
bool HaveCoins(const uint256 &txid) const;
|
||||
uint256 GetBestBlock() const;
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool GetSerial(const uint256 &serial) const
|
||||
bool GetNullifier(const uint256 &serial) const
|
||||
{
|
||||
std::map<uint256, bool>::const_iterator it = mapSerials_.find(serial);
|
||||
|
||||
|
@ -170,21 +170,21 @@ BOOST_AUTO_TEST_CASE(serials_test)
|
|||
|
||||
uint256 myserial = GetRandHash();
|
||||
|
||||
BOOST_CHECK(!cache.GetSerial(myserial));
|
||||
BOOST_CHECK(!cache.GetNullifier(myserial));
|
||||
cache.SetSerial(myserial, true);
|
||||
BOOST_CHECK(cache.GetSerial(myserial));
|
||||
BOOST_CHECK(cache.GetNullifier(myserial));
|
||||
cache.Flush();
|
||||
|
||||
CCoinsViewCacheTest cache2(&base);
|
||||
|
||||
BOOST_CHECK(cache2.GetSerial(myserial));
|
||||
BOOST_CHECK(cache2.GetNullifier(myserial));
|
||||
cache2.SetSerial(myserial, false);
|
||||
BOOST_CHECK(!cache2.GetSerial(myserial));
|
||||
BOOST_CHECK(!cache2.GetNullifier(myserial));
|
||||
cache2.Flush();
|
||||
|
||||
CCoinsViewCacheTest cache3(&base);
|
||||
|
||||
BOOST_CHECK(!cache3.GetSerial(myserial));
|
||||
BOOST_CHECK(!cache3.GetNullifier(myserial));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(anchors_flush_test)
|
||||
|
|
|
@ -81,7 +81,7 @@ bool CCoinsViewDB::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree)
|
|||
return read;
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::GetSerial(const uint256 &serial) const {
|
||||
bool CCoinsViewDB::GetNullifier(const uint256 &serial) const {
|
||||
bool spent = false;
|
||||
bool read = db.Read(make_pair(DB_SERIAL, serial), spent);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||
|
||||
bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const;
|
||||
bool GetSerial(const uint256 &serial) const;
|
||||
bool GetNullifier(const uint256 &serial) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
bool HaveCoins(const uint256 &txid) const;
|
||||
uint256 GetBestBlock() const;
|
||||
|
|
|
@ -319,7 +319,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||
|
||||
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
||||
assert(!pcoins->GetSerial(serial));
|
||||
assert(!pcoins->GetNullifier(serial));
|
||||
}
|
||||
|
||||
ZCIncrementalMerkleTree tree;
|
||||
|
@ -484,11 +484,11 @@ bool CTxMemPool::HasNoInputsOf(const CTransaction &tx) const
|
|||
|
||||
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
|
||||
|
||||
bool CCoinsViewMemPool::GetSerial(const uint256 &serial) const {
|
||||
bool CCoinsViewMemPool::GetNullifier(const uint256 &serial) const {
|
||||
if (mempool.mapSerials.count(serial))
|
||||
return true;
|
||||
|
||||
return base->GetSerial(serial);
|
||||
return base->GetNullifier(serial);
|
||||
}
|
||||
|
||||
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) const {
|
||||
|
|
|
@ -177,7 +177,7 @@ protected:
|
|||
|
||||
public:
|
||||
CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn);
|
||||
bool GetSerial(const uint256 &txid) const;
|
||||
bool GetNullifier(const uint256 &txid) const;
|
||||
bool GetCoins(const uint256 &txid, CCoins &coins) const;
|
||||
bool HaveCoins(const uint256 &txid) const;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue