Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/mempool-accept-txn.py
Show All 11 Lines | |||||
from test_framework.test_framework import ComparisonTestFramework | from test_framework.test_framework import ComparisonTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.comptool import TestManager, TestInstance | from test_framework.comptool import TestManager, TestInstance | ||||
from test_framework.blocktools import * | from test_framework.blocktools import * | ||||
import time | import time | ||||
from test_framework.key import CECKey | from test_framework.key import CECKey | ||||
from test_framework.script import * | from test_framework.script import * | ||||
import struct | import struct | ||||
from test_framework.cdefs import LEGACY_MAX_BLOCK_SIZE, MAX_STANDARD_TX_SIGOPS | from test_framework.cdefs import MAX_STANDARD_TX_SIGOPS | ||||
# Error for too many sigops in one TX | # Error for too many sigops in one TX | ||||
TXNS_TOO_MANY_SIGOPS_ERROR = b'bad-txns-too-many-sigops' | TXNS_TOO_MANY_SIGOPS_ERROR = b'bad-txns-too-many-sigops' | ||||
RPC_TXNS_TOO_MANY_SIGOPS_ERROR = "64: " + TXNS_TOO_MANY_SIGOPS_ERROR.decode("utf-8") | RPC_TXNS_TOO_MANY_SIGOPS_ERROR = "64: " + TXNS_TOO_MANY_SIGOPS_ERROR.decode("utf-8") | ||||
class PreviousSpendableOutput(object): | class PreviousSpendableOutput(object): | ||||
def __init__(self, tx = CTransaction(), n = -1): | def __init__(self, tx = CTransaction(), n = -1): | ||||
self.tx = tx | self.tx = tx | ||||
Show All 23 Lines | def add_options(self, parser): | ||||
super().add_options(parser) | super().add_options(parser) | ||||
parser.add_option("--runbarelyexpensive", dest="runbarelyexpensive", default=True) | parser.add_option("--runbarelyexpensive", dest="runbarelyexpensive", default=True) | ||||
def run_test(self): | def run_test(self): | ||||
self.test = TestManager(self, self.options.tmpdir) | self.test = TestManager(self, self.options.tmpdir) | ||||
self.test.add_all_connections(self.nodes) | self.test.add_all_connections(self.nodes) | ||||
# Start up network handling in another thread | # Start up network handling in another thread | ||||
NetworkThread().start() | NetworkThread().start() | ||||
# Set the blocksize to legacy cap (1MB) as initial condition | |||||
self.nodes[0].setexcessiveblock(LEGACY_MAX_BLOCK_SIZE) | |||||
self.test.run() | self.test.run() | ||||
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_tx, n, value, script=CScript([OP_TRUE])): | def create_tx(self, spend_tx, n, value, script=CScript([OP_TRUE])): | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |