Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_fullblocktest.py
Show All 12 Lines | |||||
import random | import random | ||||
import time | import time | ||||
from collections import deque | from collections import deque | ||||
from test_framework.blocktools import ( | from test_framework.blocktools import ( | ||||
create_block, | create_block, | ||||
create_coinbase, | create_coinbase, | ||||
create_tx_with_script, | |||||
make_conform_to_ctor, | make_conform_to_ctor, | ||||
) | ) | ||||
from test_framework.cdefs import ONE_MEGABYTE | from test_framework.cdefs import ONE_MEGABYTE | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
Show All 34 Lines | def add_options(self, parser): | ||||
super().add_options(parser) | super().add_options(parser) | ||||
parser.add_argument( | parser.add_argument( | ||||
"--runbarelyexpensive", dest="runbarelyexpensive", default=True) | "--runbarelyexpensive", dest="runbarelyexpensive", default=True) | ||||
def add_transactions_to_block(self, block, tx_list): | def add_transactions_to_block(self, block, tx_list): | ||||
[tx.rehash() for tx in tx_list] | [tx.rehash() for tx in tx_list] | ||||
block.vtx.extend(tx_list) | block.vtx.extend(tx_list) | ||||
# this is a little handier to use than the version in blocktools.py | |||||
def create_tx(self, spend, value, script=CScript([OP_TRUE])): | |||||
tx = create_tx_with_script(spend.tx, spend.n, b"", value, script) | |||||
return tx | |||||
def next_block(self, number, spend=None, | def next_block(self, number, spend=None, | ||||
script=CScript([OP_TRUE]), block_size=0): | script=CScript([OP_TRUE]), block_size=0): | ||||
if self.tip is None: | if self.tip is None: | ||||
base_block_hash = self.genesis_hash | base_block_hash = self.genesis_hash | ||||
block_time = int(time.time()) + 1 | block_time = int(time.time()) + 1 | ||||
else: | else: | ||||
base_block_hash = self.tip.sha256 | base_block_hash = self.tip.sha256 | ||||
block_time = self.tip.nTime + 1 | block_time = self.tip.nTime + 1 | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |