mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
test: Create all blocks with version 4 or higher
This commit is contained in:
parent
8cb43077b3
commit
fac90c55be
2 changed files with 3 additions and 2 deletions
|
@ -59,6 +59,7 @@ COINBASE_MATURITY = 100
|
|||
WITNESS_COMMITMENT_HEADER = b"\xaa\x21\xa9\xed"
|
||||
|
||||
NORMAL_GBT_REQUEST_PARAMS = {"rules": ["segwit"]}
|
||||
VERSIONBITS_LAST_OLD_BLOCK_VERSION = 4
|
||||
|
||||
|
||||
def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl=None, txlist=None):
|
||||
|
@ -66,7 +67,7 @@ def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl
|
|||
block = CBlock()
|
||||
if tmpl is None:
|
||||
tmpl = {}
|
||||
block.nVersion = version or tmpl.get('version') or 1
|
||||
block.nVersion = version or tmpl.get('version') or VERSIONBITS_LAST_OLD_BLOCK_VERSION
|
||||
block.nTime = ntime or tmpl.get('curtime') or int(time.time() + 600)
|
||||
block.hashPrevBlock = hashprev or int(tmpl['previousblockhash'], 0x10)
|
||||
if tmpl and not tmpl.get('bits') is None:
|
||||
|
|
|
@ -615,7 +615,7 @@ class CBlockHeader:
|
|||
self.calc_sha256()
|
||||
|
||||
def set_null(self):
|
||||
self.nVersion = 1
|
||||
self.nVersion = 4
|
||||
self.hashPrevBlock = 0
|
||||
self.hashMerkleRoot = 0
|
||||
self.nTime = 0
|
||||
|
|
Loading…
Add table
Reference in a new issue