Rename PushAnchor to PushSproutAnchor.
This commit is contained in:
parent
008f4ee8e7
commit
2bd59e1473
|
@ -158,7 +158,7 @@ bool CCoinsViewCache::GetNullifier(const uint256 &nullifier, ShieldedType type)
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoinsViewCache::PushAnchor(const ZCIncrementalMerkleTree &tree) {
|
void CCoinsViewCache::PushSproutAnchor(const ZCIncrementalMerkleTree &tree) {
|
||||||
uint256 newrt = tree.root();
|
uint256 newrt = tree.root();
|
||||||
|
|
||||||
auto currentRoot = GetBestAnchor();
|
auto currentRoot = GetBestAnchor();
|
||||||
|
|
|
@ -453,7 +453,7 @@ public:
|
||||||
|
|
||||||
// Adds the tree to mapAnchors and sets the current commitment
|
// Adds the tree to mapAnchors and sets the current commitment
|
||||||
// root to this root.
|
// root to this root.
|
||||||
void PushAnchor(const ZCIncrementalMerkleTree &tree);
|
void PushSproutAnchor(const ZCIncrementalMerkleTree &tree);
|
||||||
|
|
||||||
// Removes the current commitment root from mapAnchors and sets
|
// Removes the current commitment root from mapAnchors and sets
|
||||||
// the new current root.
|
// the new current root.
|
||||||
|
|
|
@ -2411,7 +2411,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||||
pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION);
|
pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
view.PushAnchor(tree);
|
view.PushSproutAnchor(tree);
|
||||||
if (!fJustCheck) {
|
if (!fJustCheck) {
|
||||||
pindex->hashSproutAnchorEnd = tree.root();
|
pindex->hashSproutAnchorEnd = tree.root();
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE(anchor_pop_regression_test)
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
|
|
||||||
// Add the anchor
|
// Add the anchor
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
// Remove the anchor
|
// Remove the anchor
|
||||||
|
@ -333,7 +333,7 @@ BOOST_AUTO_TEST_CASE(anchor_pop_regression_test)
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
// Add the anchor back
|
// Add the anchor back
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
// The base contains the anchor, of course!
|
// The base contains the anchor, of course!
|
||||||
|
@ -355,7 +355,7 @@ BOOST_AUTO_TEST_CASE(anchor_pop_regression_test)
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
|
|
||||||
// Add the anchor and flush to disk
|
// Add the anchor and flush to disk
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
// Remove the anchor, but don't flush yet!
|
// Remove the anchor, but don't flush yet!
|
||||||
|
@ -363,7 +363,7 @@ BOOST_AUTO_TEST_CASE(anchor_pop_regression_test)
|
||||||
|
|
||||||
{
|
{
|
||||||
CCoinsViewCacheTest cache2(&cache1); // Build cache on top
|
CCoinsViewCacheTest cache2(&cache1); // Build cache on top
|
||||||
cache2.PushAnchor(tree); // Put the same anchor back!
|
cache2.PushSproutAnchor(tree); // Put the same anchor back!
|
||||||
cache2.Flush(); // Flush to cache1
|
cache2.Flush(); // Flush to cache1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE(anchor_regression_test)
|
||||||
ZCIncrementalMerkleTree tree;
|
ZCIncrementalMerkleTree tree;
|
||||||
uint256 cm = GetRandHash();
|
uint256 cm = GetRandHash();
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
cache1.PopAnchor(ZCIncrementalMerkleTree::empty_root());
|
cache1.PopAnchor(ZCIncrementalMerkleTree::empty_root());
|
||||||
|
@ -415,7 +415,7 @@ BOOST_AUTO_TEST_CASE(anchor_regression_test)
|
||||||
ZCIncrementalMerkleTree tree;
|
ZCIncrementalMerkleTree tree;
|
||||||
uint256 cm = GetRandHash();
|
uint256 cm = GetRandHash();
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
cache1.PopAnchor(ZCIncrementalMerkleTree::empty_root());
|
cache1.PopAnchor(ZCIncrementalMerkleTree::empty_root());
|
||||||
|
@ -433,7 +433,7 @@ BOOST_AUTO_TEST_CASE(anchor_regression_test)
|
||||||
ZCIncrementalMerkleTree tree;
|
ZCIncrementalMerkleTree tree;
|
||||||
uint256 cm = GetRandHash();
|
uint256 cm = GetRandHash();
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -457,7 +457,7 @@ BOOST_AUTO_TEST_CASE(anchor_regression_test)
|
||||||
ZCIncrementalMerkleTree tree;
|
ZCIncrementalMerkleTree tree;
|
||||||
uint256 cm = GetRandHash();
|
uint256 cm = GetRandHash();
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
cache1.PushAnchor(tree);
|
cache1.PushSproutAnchor(tree);
|
||||||
cache1.Flush();
|
cache1.Flush();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -507,7 +507,7 @@ BOOST_AUTO_TEST_CASE(anchors_flush_test)
|
||||||
|
|
||||||
newrt = tree.root();
|
newrt = tree.root();
|
||||||
|
|
||||||
cache.PushAnchor(tree);
|
cache.PushSproutAnchor(tree);
|
||||||
cache.Flush();
|
cache.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ BOOST_AUTO_TEST_CASE(anchors_test)
|
||||||
uint256 newrt = tree.root();
|
uint256 newrt = tree.root();
|
||||||
uint256 newrt2;
|
uint256 newrt2;
|
||||||
|
|
||||||
cache.PushAnchor(tree);
|
cache.PushSproutAnchor(tree);
|
||||||
BOOST_CHECK(cache.GetBestAnchor() == newrt);
|
BOOST_CHECK(cache.GetBestAnchor() == newrt);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -646,7 +646,7 @@ BOOST_AUTO_TEST_CASE(anchors_test)
|
||||||
|
|
||||||
newrt2 = tree.root();
|
newrt2 = tree.root();
|
||||||
|
|
||||||
cache.PushAnchor(tree);
|
cache.PushSproutAnchor(tree);
|
||||||
BOOST_CHECK(cache.GetBestAnchor() == newrt2);
|
BOOST_CHECK(cache.GetBestAnchor() == newrt2);
|
||||||
|
|
||||||
ZCIncrementalMerkleTree test_tree;
|
ZCIncrementalMerkleTree test_tree;
|
||||||
|
|
Loading…
Reference in New Issue