Skip to content

Commit a26b657

Browse files
committed
qa: sanity check mined block have their coinbase timelocked to height
1 parent a8707e5 commit a26b657

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/functional/mining_basic.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
COIN,
2929
DEFAULT_BLOCK_RESERVED_WEIGHT,
3030
MAX_BLOCK_WEIGHT,
31+
MAX_SEQUENCE_NONFINAL,
3132
MINIMUM_BLOCK_RESERVED_WEIGHT,
3233
ser_uint256,
33-
WITNESS_SCALE_FACTOR
34+
WITNESS_SCALE_FACTOR,
3435
)
3536
from test_framework.p2p import P2PDataStore
3637
from test_framework.test_framework import BitcoinTestFramework
@@ -318,6 +319,12 @@ def test_block_max_weight(self):
318319
expected_msg=f"Error: Specified -blockmaxweight ({MAX_BLOCK_WEIGHT + 1}) exceeds consensus maximum block weight ({MAX_BLOCK_WEIGHT})",
319320
)
320321

322+
def test_height_in_locktime(self):
323+
self.log.info("Sanity check generated blocks have their coinbase timelocked to their height.")
324+
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
325+
block = self.nodes[0].getblock(self.nodes[0].getbestblockhash(), 2)
326+
assert_equal(block["tx"][0]["locktime"], block["height"] - 1)
327+
assert_equal(block["tx"][0]["vin"][0]["sequence"], MAX_SEQUENCE_NONFINAL)
321328

322329
def run_test(self):
323330
node = self.nodes[0]
@@ -547,6 +554,7 @@ def chain_tip(b_hash, *, status='headers-only', branchlen=1):
547554
self.test_block_max_weight()
548555
self.test_timewarp()
549556
self.test_pruning()
557+
self.test_height_in_locktime()
550558

551559

552560
if __name__ == '__main__':

0 commit comments

Comments
 (0)