Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions tests/test_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,12 +1571,24 @@ def censoring_sendrawtx(r):

# Make a 3rd inflight that won't make it into the mempool
signed_psbt = run_retry()
last = len(l1.daemon.logs)
# Snapshot the logs only after catching up: len(logs) does not read
# new output, so a stale snapshot would match the *2nd* inflight's
# "sendrawtx exit 0" and we'd unmock before the 3rd is broadcast.
l1.daemon.logs_catchup()
l2.daemon.logs_catchup()
last1 = len(l1.daemon.logs)
last2 = len(l2.daemon.logs)
l1.rpc.openchannel_signed(chan_id, signed_psbt)

wait_for(lambda: l1.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last))
# Both nodes broadcast the (censored) funding tx, and either request
# may still be in flight, so wait for both before unmocking: otherwise
# the still-mocked attempt would be forwarded for real and replace the
# 2nd inflight in the mempool.
wait_for(lambda: l1.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last1))
wait_for(lambda: l2.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last2))
import time
time.sleep(.05)

time.sleep(0.05)

l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
l2.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
Expand Down Expand Up @@ -1686,11 +1698,22 @@ def censoring_sendrawtx(r):

# Make a 3rd inflight that won't make it into the mempool
signed_psbt = run_retry()
last = len(l1.daemon.logs)
# Snapshot the logs only after catching up: len(logs) does not read
# new output, so a stale snapshot would match the *2nd* inflight's
# "sendrawtx exit 0" and we'd unmock before the 3rd is broadcast.
l1.daemon.logs_catchup()
l2.daemon.logs_catchup()
last1 = len(l1.daemon.logs)
last2 = len(l2.daemon.logs)
l1.rpc.openchannel_signed(chan_id, signed_psbt)

wait_for(lambda: l1.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last))
time.sleep(.05)
# Both nodes broadcast the (censored) funding tx, and either request
# may still be in flight, so wait for both before unmocking: otherwise
# the still-mocked attempt would be forwarded for real and replace the
# 2nd inflight in the mempool.
wait_for(lambda: l1.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last1))
wait_for(lambda: l2.daemon.is_in_log("plugin-bcli: sendrawtx exit 0", start=last2))
time.sleep(0.05)

l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
l2.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
Expand Down
Loading