Changes for most chain power rule

This commit is contained in:
miketout
2018-09-28 01:38:14 -07:00
parent f82b75eb8b
commit 4b729ec577
51 changed files with 666 additions and 444 deletions

View File

@@ -243,7 +243,7 @@ TEST(WalletTests, FindUnspentSproutNotes) {
auto blockHash2 = block2.GetHash();
CBlockIndex fakeIndex2 {block2};
mapBlockIndex.insert(std::make_pair(blockHash2, &fakeIndex2));
fakeIndex2.nHeight = 1;
fakeIndex2.SetHeight(1);
chainActive.SetTip(&fakeIndex2);
EXPECT_TRUE(chainActive.Contains(&fakeIndex2));
EXPECT_EQ(1, chainActive.Height());
@@ -302,7 +302,7 @@ TEST(WalletTests, FindUnspentSproutNotes) {
auto blockHash3 = block3.GetHash();
CBlockIndex fakeIndex3 {block3};
mapBlockIndex.insert(std::make_pair(blockHash3, &fakeIndex3));
fakeIndex3.nHeight = 2;
fakeIndex3.SetHeight(2);
chainActive.SetTip(&fakeIndex3);
EXPECT_TRUE(chainActive.Contains(&fakeIndex3));
EXPECT_EQ(2, chainActive.Height());
@@ -1136,7 +1136,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) {
auto blockHash2 = block2.GetHash();
CBlockIndex fakeIndex2 {block2};
mapBlockIndex.insert(std::make_pair(blockHash2, &fakeIndex2));
fakeIndex2.nHeight = 1;
fakeIndex2.SetHeight(1);
chainActive.SetTip(&fakeIndex2);
EXPECT_TRUE(chainActive.Contains(&fakeIndex2));
EXPECT_EQ(1, chainActive.Height());
@@ -1236,7 +1236,7 @@ TEST(WalletTests, CachedWitnessesChainTip) {
{
// First block (case tested in _empty_chain)
CBlockIndex index1(block1);
index1.nHeight = 1;
index1.SetHeight(1);
auto outpts = CreateValidBlock(wallet, sk, index1, block1, sproutTree, saplingTree);
// Called to fetch anchor
@@ -1277,7 +1277,7 @@ TEST(WalletTests, CachedWitnessesChainTip) {
block2.hashPrevBlock = block1.GetHash();
block2.vtx.push_back(wtx);
CBlockIndex index2(block2);
index2.nHeight = 2;
index2.SetHeight(2);
SproutMerkleTree sproutTree2 {sproutTree};
SaplingMerkleTree saplingTree2 {saplingTree};
wallet.IncrementNoteWitnesses(&index2, &block2, sproutTree2, saplingTree2);
@@ -1337,7 +1337,7 @@ TEST(WalletTests, CachedWitnessesDecrementFirst) {
// First block (case tested in _empty_chain)
CBlock block1;
CBlockIndex index1(block1);
index1.nHeight = 1;
index1.SetHeight(1);
CreateValidBlock(wallet, sk, index1, block1, sproutTree, saplingTree);
}
@@ -1347,7 +1347,7 @@ TEST(WalletTests, CachedWitnessesDecrementFirst) {
{
// Second block (case tested in _chain_tip)
index2.nHeight = 2;
index2.SetHeight(2);
auto outpts = CreateValidBlock(wallet, sk, index2, block2, sproutTree, saplingTree);
// Called to fetch anchor
@@ -1428,7 +1428,7 @@ TEST(WalletTests, CachedWitnessesCleanIndex) {
blocks.resize(numBlocks);
indices.resize(numBlocks);
for (size_t i = 0; i < numBlocks; i++) {
indices[i].nHeight = i;
indices[i].SetHeight(i);
auto oldSproutRoot = sproutTree.root();
auto oldSaplingRoot = saplingTree.root();
auto outpts = CreateValidBlock(wallet, sk, indices[i], blocks[i], sproutTree, saplingTree);