test: Assumeutxo with more than just coinbase transactions

This commit is contained in:
MarcoFalke
2024-01-31 11:28:18 +01:00
parent cad2df24b3
commit fa5cd66f0a
3 changed files with 27 additions and 16 deletions

View File

@ -16,6 +16,7 @@ from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
)
from test_framework.wallet import MiniWallet
START_HEIGHT = 199
SNAPSHOT_BASE_HEIGHT = 299
@ -55,6 +56,8 @@ class AssumeutxoTest(BitcoinTestFramework):
n0 = self.nodes[0]
n1 = self.nodes[1]
self.mini_wallet = MiniWallet(n0)
# Mock time for a deterministic chain
for n in self.nodes:
n.setmocktime(n.getblockheader(n.getbestblockhash())['time'])
@ -69,7 +72,9 @@ class AssumeutxoTest(BitcoinTestFramework):
# though, we have to ferry over the new headers to n1 so that it
# isn't waiting forever to see the header of the snapshot's base block
# while disconnected from n0.
for _ in range(100):
for i in range(100):
if i % 3 == 0:
self.mini_wallet.send_self_transfer(from_node=n0)
self.generate(n0, nblocks=1, sync_fun=self.no_op)
newblock = n0.getblock(n0.getbestblockhash(), 0)
@ -94,8 +99,8 @@ class AssumeutxoTest(BitcoinTestFramework):
assert_equal(
dump_output['txoutset_hash'],
'61d9c2b29a2571a5fe285fe2d8554f91f93309666fc9b8223ee96338de25ff53')
assert_equal(dump_output['nchaintx'], 300)
"a4bf3407ccb2cc0145c49ebba8fa91199f8a3903daf0883875941497d2493c27")
assert_equal(dump_output["nchaintx"], 334)
assert_equal(n0.getblockchaininfo()["blocks"], SNAPSHOT_BASE_HEIGHT)
# Mine more blocks on top of the snapshot that n1 hasn't yet seen. This