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