Skip to content

Commit be49720

Browse files
committed
Functional test coverage
1 parent 2379c2d commit be49720

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/functional/rpc_invalidateblock.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
from test_framework.test_framework import PivxTestFramework
88
from test_framework.util import assert_equal, connect_nodes, wait_until
99

10+
1011
class InvalidateTest(PivxTestFramework):
1112
def set_test_params(self):
1213
self.setup_clean_chain = True
1314
self.num_nodes = 3
15+
self.extra_args = [["-nuparams=v5_shield:1"]] * self.num_nodes
1416

1517
def setup_network(self):
1618
self.setup_nodes()
@@ -79,6 +81,18 @@ def run_test(self):
7981
# Should be back at the tip by now
8082
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
8183

84+
self.log.info("Verify that it works for more than 100 blocks (sapling cache reconstruction)")
85+
blocks = self.nodes[1].generate(200)
86+
assert_equal(self.nodes[0].getblockchaininfo()['upgrades']['v5 shield']['status'], 'active')
87+
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
88+
# Invalidate a block deeper than the maximum cache size (i.e deeper than 100 blocks)
89+
self.nodes[1].invalidateblock(blocks[-140])
90+
assert_equal(self.nodes[1].getbestblockhash(), blocks[-141])
91+
# Reconsider only the previous tip
92+
self.nodes[1].reconsiderblock(blocks[-140])
93+
# Should be back at the tip by now
94+
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
95+
8296

8397
if __name__ == '__main__':
8498
InvalidateTest().main()

0 commit comments

Comments
 (0)