bench: Add Orchard logic to zcbenchmarks

The missing `ORCHARD` case in `FakeCoinsViewDB::GetBestAnchor` caused
an exception to be thrown during the `connectblockslow` benchmark.
This commit is contained in:
Jack Grigg 2021-09-22 17:32:17 +01:00
parent 38bdae6df9
commit 5731ba431c
1 changed files with 16 additions and 1 deletions

View File

@ -448,6 +448,7 @@ class FakeCoinsViewDB : public CCoinsView {
uint256 hash;
SproutMerkleTree sproutTree;
SaplingMerkleTree saplingTree;
OrchardMerkleTree orchardTree;
public:
FakeCoinsViewDB(std::string dbName, uint256& hash) : db(GetDataDir() / dbName, 100, false, false), hash(hash) {}
@ -468,6 +469,14 @@ public:
return false;
}
bool GetOrchardAnchorAt(const uint256 &rt, OrchardMerkleTree &tree) const {
if (rt == orchardTree.root()) {
tree = orchardTree;
return true;
}
return false;
}
bool GetNullifier(const uint256 &nf, ShieldedType type) const {
return false;
}
@ -490,6 +499,8 @@ public:
return sproutTree.root();
case SAPLING:
return saplingTree.root();
case ORCHARD:
return orchardTree.root();
default:
throw new std::runtime_error("Unknown shielded type");
}
@ -499,10 +510,14 @@ public:
const uint256 &hashBlock,
const uint256 &hashSproutAnchor,
const uint256 &hashSaplingAnchor,
const uint256 &hashOrchardAnchor,
CAnchorsSproutMap &mapSproutAnchors,
CAnchorsSaplingMap &mapSaplingAnchors,
CAnchorsOrchardMap &mapOrchardAnchors,
CNullifiersMap &mapSproutNullifiers,
CNullifiersMap &mapSaplingNullifiers) {
CNullifiersMap &mapSaplingNullifiers,
CNullifiersMap &mapOrchardNullifiers,
CHistoryCacheMap &historyCacheMap) {
return false;
}