Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-segwit-recovery.py
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# submit current tip and check it was accepted | # submit current tip and check it was accepted | ||||
def accepted(node): | def accepted(node): | ||||
node.p2p.send_blocks_and_test([self.tip], node) | node.p2p.send_blocks_and_test([self.tip], node) | ||||
# submit current tip and check it was rejected (and we are banned) | # submit current tip and check it was rejected (and we are banned) | ||||
def rejected(node, reject_code, reject_reason): | def rejected(node, reject_code, reject_reason): | ||||
node.p2p.send_blocks_and_test( | node.p2p.send_blocks_and_test( | ||||
[self.tip], node, success=False, reject_code=reject_code, reject_reason=reject_reason) | [self.tip], node, success=False, reject_code=reject_code, reject_reason=reject_reason, expect_disconnect=True) | ||||
node.p2p.wait_for_disconnect() | |||||
self.reconnect_p2p() | self.reconnect_p2p() | ||||
# move the tip back to a previous block | # move the tip back to a previous block | ||||
def tip(number): | def tip(number): | ||||
self.tip = self.blocks[number] | self.tip = self.blocks[number] | ||||
# adds transactions to the block and updates state | # adds transactions to the block and updates state | ||||
def update_block(block_number, new_transactions): | def update_block(block_number, new_transactions): | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
CScript([OP_HASH160, hash160(CScript([OP_TRUE])), OP_EQUAL]))] | CScript([OP_HASH160, hash160(CScript([OP_TRUE])), OP_EQUAL]))] | ||||
txspend.rehash() | txspend.rehash() | ||||
return txfund, txspend | return txfund, txspend | ||||
# Check we are not banned when sending a txn that is rejected. | # Check we are not banned when sending a txn that is rejected. | ||||
def check_for_no_ban_on_rejected_tx(node, tx, reject_code, reject_reason): | def check_for_no_ban_on_rejected_tx(node, tx, reject_code, reject_reason): | ||||
node.p2p.send_txs_and_test( | node.p2p.send_txs_and_test( | ||||
[tx], self.nodes[0], success=False, reject_code=reject_code, reject_reason=reject_reason) | [tx], node, success=False, reject_code=reject_code, reject_reason=reject_reason) | ||||
# Create a new block | # Create a new block | ||||
block(0) | block(0) | ||||
save_spendable_output() | save_spendable_output() | ||||
accepted(node_nonstd) | accepted(node_nonstd) | ||||
# Now we need that block to mature so we can spend the coinbase. | # Now we need that block to mature so we can spend the coinbase. | ||||
matureblocks = [] | matureblocks = [] | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |