Skip to content

Commit

Permalink
scripted-diff: replace p2p with p2ps[0] in p2p_invalid_tx
Browse files Browse the repository at this point in the history
-BEGIN VERIFY SCRIPT-
sed -i 's/\.p2p\./.p2ps[0]./g' test/functional/p2p_invalid_tx.py
-END VERIFY SCRIPT-
  • Loading branch information
glozow committed Sep 10, 2020
1 parent 7a0de46 commit 549d30f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/functional/p2p_invalid_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_test(self):
# Save the coinbase for later
block1 = block
tip = block.sha256
node.p2p.send_blocks_and_test([block], node, success=True)
node.p2ps[0].send_blocks_and_test([block], node, success=True)

self.log.info("Mature the block.")
self.nodes[0].generatetoaddress(100, self.nodes[0].get_deterministic_priv_key().address)
Expand All @@ -72,7 +72,7 @@ def run_test(self):
self.log.info("Testing invalid transaction: %s", BadTxTemplate.__name__)
template = BadTxTemplate(spend_block=block1)
tx = template.get_tx()
node.p2p.send_txs_and_test(
node.p2ps[0].send_txs_and_test(
[tx], node, success=False,
expect_disconnect=template.expect_disconnect,
reject_reason=template.reject_reason,
Expand Down Expand Up @@ -121,7 +121,7 @@ def run_test(self):

self.log.info('Send the orphans ... ')
# Send valid orphan txs from p2ps[0]
node.p2p.send_txs_and_test([tx_orphan_1, tx_orphan_2_no_fee, tx_orphan_2_valid], node, success=False)
node.p2ps[0].send_txs_and_test([tx_orphan_1, tx_orphan_2_no_fee, tx_orphan_2_valid], node, success=False)
# Send invalid tx from p2ps[1]
node.p2ps[1].send_txs_and_test([tx_orphan_2_invalid], node, success=False)

Expand All @@ -130,7 +130,7 @@ def run_test(self):

self.log.info('Send the withhold tx ... ')
with node.assert_debug_log(expected_msgs=["bad-txns-in-belowout"]):
node.p2p.send_txs_and_test([tx_withhold], node, success=True)
node.p2ps[0].send_txs_and_test([tx_withhold], node, success=True)

# Transactions that should end up in the mempool
expected_mempool = {
Expand All @@ -155,14 +155,14 @@ def run_test(self):
orphan_tx_pool[i].vout.append(CTxOut(nValue=11 * COIN, scriptPubKey=SCRIPT_PUB_KEY_OP_TRUE))

with node.assert_debug_log(['mapOrphan overflow, removed 1 tx']):
node.p2p.send_txs_and_test(orphan_tx_pool, node, success=False)
node.p2ps[0].send_txs_and_test(orphan_tx_pool, node, success=False)

rejected_parent = CTransaction()
rejected_parent.vin.append(CTxIn(outpoint=COutPoint(tx_orphan_2_invalid.sha256, 0)))
rejected_parent.vout.append(CTxOut(nValue=11 * COIN, scriptPubKey=SCRIPT_PUB_KEY_OP_TRUE))
rejected_parent.rehash()
with node.assert_debug_log(['not keeping orphan with rejected parents {}'.format(rejected_parent.hash)]):
node.p2p.send_txs_and_test([rejected_parent], node, success=False)
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)


if __name__ == '__main__':
Expand Down

0 comments on commit 549d30f

Please sign in to comment.