Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-magnetic-anomaly-activation.py
Show All 12 Lines | |||||
from test_framework.blocktools import create_coinbase, create_block | from test_framework.blocktools import create_coinbase, create_block | ||||
from test_framework.mininode import * | from test_framework.mininode import * | ||||
from test_framework.script import * | from test_framework.script import * | ||||
from test_framework.cdefs import MIN_TX_SIZE | from test_framework.cdefs import MIN_TX_SIZE | ||||
from collections import deque | from collections import deque | ||||
# far into the future | # far into the future | ||||
MAGNETIC_ANOMALY_START_TIME = 2000000000 | MAGNETIC_ANOMALY_START_TIME = 2000000000 | ||||
RPC_VERIFY_REJECTED = -26 | |||||
class PreviousSpendableOutput(): | class PreviousSpendableOutput(): | ||||
def __init__(self, tx=CTransaction(), n=-1): | def __init__(self, tx=CTransaction(), n=-1): | ||||
self.tx = tx | self.tx = tx | ||||
self.n = n # the output we're spending | self.n = n # the output we're spending | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | def get_tests(self): | ||||
# non clean stack transactions. | # non clean stack transactions. | ||||
non_cleanstack_tx_block = block(4447, | non_cleanstack_tx_block = block(4447, | ||||
transaction(out[1], MIN_TX_SIZE, cleanstack=False)) | transaction(out[1], MIN_TX_SIZE, cleanstack=False)) | ||||
yield rejected(RejectResult(16, b'blk-bad-inputs')) | yield rejected(RejectResult(16, b'blk-bad-inputs')) | ||||
# Rewind bad block. | # Rewind bad block. | ||||
tip(4444) | tip(4444) | ||||
# Verfiy that ATMP doesn't accept undersize transactions | |||||
undersized_tx = transaction(out[1], MIN_TX_SIZE - 1) | |||||
assert_raises_rpc_error(RPC_VERIFY_REJECTED, "bad-txns-undersize", | |||||
node.sendrawtransaction, ToHex(undersized_tx), True) | |||||
# But large transactions are still ok. | # But large transactions are still ok. | ||||
large_tx_block = block(3333, transaction(out[1], MIN_TX_SIZE)) | large_tx_block = block(3333, transaction(out[1], MIN_TX_SIZE)) | ||||
assert_equal(len(large_tx_block.vtx[1].serialize()), MIN_TX_SIZE) | assert_equal(len(large_tx_block.vtx[1].serialize()), MIN_TX_SIZE) | ||||
yield accepted() | yield accepted() | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MagneticAnomalyActivationTest().main() | MagneticAnomalyActivationTest().main() |