Skip to content

Commit

Permalink
Fix: p2p_leak_tx.py test
Browse files Browse the repository at this point in the history
  • Loading branch information
meherett committed Jun 10, 2024
1 parent 263eae8 commit f9f92a7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/functional/p2p_leak_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction upload"""

from decimal import Decimal

from test_framework.messages import msg_getdata, CInv, MSG_TX, MSG_WTX
from test_framework.p2p import p2p_lock, P2PDataStore, P2PTxInvStore
from test_framework.test_framework import BitcoinTestFramework
Expand Down Expand Up @@ -36,10 +38,10 @@ def test_tx_in_block(self):

self.log.debug("Generate transaction and block")
inbound_peer.last_message.pop("inv", None)
wtxid = self.miniwallet.send_self_transfer(from_node=self.gen_node)["wtxid"]
wtxid = self.miniwallet.send_self_transfer(from_node=self.gen_node, fee_rate=Decimal("0.004"))["wtxid"]
inbound_peer.wait_until(lambda: "inv" in inbound_peer.last_message and inbound_peer.last_message.get("inv").inv[0].hash == int(wtxid, 16))
want_tx = msg_getdata(inv=inbound_peer.last_message.get("inv").inv)
self.generate(self.gen_node, 1)
# self.generate(self.gen_node, 1)

self.log.debug("Request transaction")
inbound_peer.last_message.pop("tx", None)
Expand All @@ -51,7 +53,7 @@ def test_notfound_on_replaced_tx(self):
inbound_peer = self.gen_node.add_p2p_connection(P2PTxInvStore())

self.log.info("Transaction tx_a is broadcast")
tx_a = self.miniwallet.send_self_transfer(from_node=self.gen_node)
tx_a = self.miniwallet.send_self_transfer(from_node=self.gen_node, fee_rate=Decimal("0.004"))
inbound_peer.wait_for_broadcast(txns=[tx_a["wtxid"]])

tx_b = tx_a["tx"]
Expand Down Expand Up @@ -83,7 +85,7 @@ def test_notfound_on_unannounced_tx(self):
self.log.info("Running test up to {} times.".format(MAX_REPEATS))
for i in range(MAX_REPEATS):
self.log.info('Run repeat {}'.format(i + 1))
txid = self.miniwallet.send_self_transfer(from_node=self.gen_node)["wtxid"]
txid = self.miniwallet.send_self_transfer(from_node=self.gen_node, fee_rate=Decimal("0.004"))["wtxid"]

want_tx = msg_getdata()
want_tx.inv.append(CInv(t=MSG_TX, h=int(txid, 16)))
Expand Down

0 comments on commit f9f92a7

Please sign in to comment.