Rename Merkle Trees to include sprout or sapling

This commit is contained in:
Eirik Ogilvie-Wigley
2018-08-01 10:31:09 -06:00
parent d84f14ec4a
commit 4fc309f0f5
28 changed files with 151 additions and 151 deletions

View File

@@ -2269,7 +2269,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
if (NetworkUpgradeActive(pindex->pprev->nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING);
} else {
view.PopAnchor(ZCSaplingIncrementalMerkleTree::empty_root(), SAPLING);
view.PopAnchor(SaplingMerkleTree::empty_root(), SAPLING);
}
// move best block pointer to prevout block
@@ -2414,7 +2414,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!fJustCheck) {
view.SetBestBlock(pindex->GetBlockHash());
// Before the genesis block, there was an empty tree
ZCIncrementalMerkleTree tree;
SproutMerkleTree tree;
pindex->hashSproutAnchor = tree.root();
// The genesis block contained no JoinSplits
pindex->hashFinalSproutRoot = pindex->hashSproutAnchor;
@@ -2455,7 +2455,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
if (!fJustCheck) {
pindex->hashSproutAnchor = old_sprout_tree_root;
}
ZCIncrementalMerkleTree sprout_tree;
SproutMerkleTree sprout_tree;
// This should never fail: we should always be able to get the root
// that is on the tip of our chain
assert(view.GetSproutAnchorAt(old_sprout_tree_root, sprout_tree));
@@ -2466,7 +2466,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
assert(sprout_tree.root() == old_sprout_tree_root);
}
ZCSaplingIncrementalMerkleTree sapling_tree;
SaplingMerkleTree sapling_tree;
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
// Grab the consensus branch ID for the block's height
@@ -2836,8 +2836,8 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) {
// Update chainActive and related variables.
UpdateTip(pindexDelete->pprev);
// Get the current commitment tree
ZCIncrementalMerkleTree newSproutTree;
ZCSaplingIncrementalMerkleTree newSaplingTree;
SproutMerkleTree newSproutTree;
SaplingMerkleTree newSaplingTree;
assert(pcoinsTip->GetSproutAnchorAt(pcoinsTip->GetBestAnchor(SPROUT), newSproutTree));
assert(pcoinsTip->GetSaplingAnchorAt(pcoinsTip->GetBestAnchor(SAPLING), newSaplingTree));
// Let wallets know transactions went from 1-confirmed to
@@ -2872,8 +2872,8 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
pblock = █
}
// Get the current commitment tree
ZCIncrementalMerkleTree oldSproutTree;
ZCSaplingIncrementalMerkleTree oldSaplingTree;
SproutMerkleTree oldSproutTree;
SaplingMerkleTree oldSaplingTree;
assert(pcoinsTip->GetSproutAnchorAt(pcoinsTip->GetBestAnchor(SPROUT), oldSproutTree));
assert(pcoinsTip->GetSaplingAnchorAt(pcoinsTip->GetBestAnchor(SAPLING), oldSaplingTree));
// Apply the block atomically to the chain state.