Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/blocktools.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2016 The Bitcoin Core developers | # Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Utilities for manipulating blocks and transactions.""" | """Utilities for manipulating blocks and transactions.""" | ||||
from .mininode import * | from .script import ( | ||||
from .script import CScript, OP_TRUE, OP_CHECKSIG, OP_RETURN, OP_PUSHDATA2, OP_DUP, OP_HASH160, OP_EQUALVERIFY | CScript, | ||||
from .mininode import CTransaction, CTxOut, CTxIn | OP_CHECKSIG, | ||||
from .util import satoshi_round | OP_DUP, | ||||
OP_EQUALVERIFY, | |||||
OP_HASH160, | |||||
OP_PUSHDATA2, | |||||
OP_RETURN, | |||||
OP_TRUE, | |||||
) | |||||
from .messages import ( | |||||
CBlock, | |||||
COIN, | |||||
COutPoint, | |||||
CTransaction, | |||||
CTxIn, | |||||
CTxOut, | |||||
FromHex, | |||||
ToHex, | |||||
ser_string, | |||||
) | |||||
from .txtools import pad_tx | from .txtools import pad_tx | ||||
from .util import satoshi_round | |||||
# Create a block (with regtest difficulty) | # Create a block (with regtest difficulty) | ||||
def create_block(hashprev, coinbase, nTime=None): | def create_block(hashprev, coinbase, nTime=None): | ||||
block = CBlock() | block = CBlock() | ||||
if nTime is None: | if nTime is None: | ||||
import time | import time | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |