Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-p2p-fullblocktest.py
Show All 12 Lines | |||||
from collections import deque | from collections import deque | ||||
import random | import random | ||||
import time | import time | ||||
from test_framework.blocktools import ( | from test_framework.blocktools import ( | ||||
create_block, | create_block, | ||||
create_coinbase, | create_coinbase, | ||||
create_transaction, | create_tx_with_script, | ||||
make_conform_to_ctor, | make_conform_to_ctor, | ||||
) | ) | ||||
from test_framework.cdefs import ( | from test_framework.cdefs import ( | ||||
MAX_BLOCK_SIGOPS_PER_MB, | MAX_BLOCK_SIGOPS_PER_MB, | ||||
MAX_TX_SIGOPS_COUNT, | MAX_TX_SIGOPS_COUNT, | ||||
ONE_MEGABYTE, | ONE_MEGABYTE, | ||||
) | ) | ||||
from test_framework.key import CECKey | from test_framework.key import CECKey | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | def add_options(self, parser): | ||||
"--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 | # this is a little handier to use than the version in blocktools.py | ||||
def create_tx(self, spend, value, script=CScript([OP_TRUE])): | def create_tx(self, spend, value, script=CScript([OP_TRUE])): | ||||
tx = create_transaction(spend.tx, spend.n, b"", value, script) | tx = create_tx_with_script(spend.tx, spend.n, b"", value, script) | ||||
return tx | return tx | ||||
def next_block(self, number, spend=None, script=CScript([OP_TRUE]), block_size=0, extra_sigops=0): | def next_block(self, number, spend=None, script=CScript([OP_TRUE]), block_size=0, extra_sigops=0): | ||||
if self.tip == None: | if self.tip == 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 | ||||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |