mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
qa: sanity check mined block have their coinbase timelocked to height
This commit is contained in:
parent
8f2078af6a
commit
a58cb3b1c1
1 changed files with 9 additions and 1 deletions
|
@ -28,9 +28,10 @@ from test_framework.messages import (
|
|||
COIN,
|
||||
DEFAULT_BLOCK_RESERVED_WEIGHT,
|
||||
MAX_BLOCK_WEIGHT,
|
||||
MAX_SEQUENCE_NONFINAL,
|
||||
MINIMUM_BLOCK_RESERVED_WEIGHT,
|
||||
ser_uint256,
|
||||
WITNESS_SCALE_FACTOR
|
||||
WITNESS_SCALE_FACTOR,
|
||||
)
|
||||
from test_framework.p2p import P2PDataStore
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
|
@ -362,6 +363,12 @@ class MiningTest(BitcoinTestFramework):
|
|||
expected_msg=f"Error: Specified -blockmaxweight ({MAX_BLOCK_WEIGHT + 1}) exceeds consensus maximum block weight ({MAX_BLOCK_WEIGHT})",
|
||||
)
|
||||
|
||||
def test_height_in_locktime(self):
|
||||
self.log.info("Sanity check generated blocks have their coinbase timelocked to their height.")
|
||||
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
|
||||
block = self.nodes[0].getblock(self.nodes[0].getbestblockhash(), 2)
|
||||
assert_equal(block["tx"][0]["locktime"], block["height"] - 1)
|
||||
assert_equal(block["tx"][0]["vin"][0]["sequence"], MAX_SEQUENCE_NONFINAL)
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
|
@ -592,6 +599,7 @@ class MiningTest(BitcoinTestFramework):
|
|||
self.test_block_max_weight()
|
||||
self.test_timewarp()
|
||||
self.test_pruning()
|
||||
self.test_height_in_locktime()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue