Skip to content

Commit 2482fd4

Browse files
committed
pytest: detect RBF more reliably
``` 2023-10-30T20:52:48.0652403Z [gw2] [ 63%] FAILED tests/test_closing.py::test_onchain_timeout[True] ... ... bitcoind.generate_block(4) bitcoind.generate_block(1, wait_for_mempool=txid1) > l1.mine_txid_or_rbf(txid2) tests/test_closing.py:1987: ``` Turns out that the DEBUG-level "no feechange" RBF can happen, as we can actually call the RBF routine before we even broadcast the first one: ``` 2023-10-30T21:07:42.2201798Z lightningd-1 2023-10-30T20:49:44.184Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 14aa9c78fbcbff01faf96d3e734eba52355437078a67f46b8fbca9e72d1494e5 (fee 121sat) with txid 14aa9c78fbcbff01faf96d3e734eba52355437078a67f46b8fbca9e72d1494e5 (fee 121sat) 2023-10-30T21:07:42.2214788Z lightningd-1 2023-10-30T20:49:44.185Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000->02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000 2023-10-30T21:07:42.2230434Z lightningd-1 2023-10-30T20:49:44.196Z DEBUG lightningd: sendrawtransaction: 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000 ... 2023-10-30T21:07:42.2258455Z lightningd-1 2023-10-30T20:49:44.250Z DEBUG plugin-bcli: sendrawtx exit 0 (bitcoin-cli -regtest -datadir=/tmp/ltests-b6i5i0cl/test_onchain_timeout_1/lightning-1/ -rpcport=43613 -rpcuser=... -stdinrpcpass sendrawtransaction 02000000000101e37ffb981f28875509cd0069de2b457763cb252c9372725c1d8ba813c493b09e030000000005000000019b920d0000000000160014071c49cad2f420f3c805f9f6b98a57269cb1415003473044022007fff5174a0ea980ad158a4893cf9dcbc87dba1edf28adf8379bd7cdca6d8d1e02201b55b50e79446e580b4c53c6894f6c0384a36fd228a553f975c38cb128e454fd01004b632102f1d7d753e58aa4a0b3f245775f5588ac0f02f072d1854c5d846c3d1bac0738bb6755b27521033dbabb9463042008146aa9e5be6bc3fb48cfb3ead4bb1876f1c1a73159cc56a068ac00000000 0) ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent ebf6f2e commit 2482fd4

File tree

1 file changed

+11
-5
lines changed
  • contrib/pyln-testing/pyln/testing

1 file changed

+11
-5
lines changed

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,11 +1318,17 @@ def mine_txid_or_rbf(self, txid, numblocks=1):
13181318
# Hack so we can mutate the txid: pass it in a list
13191319
def rbf_or_txid_broadcast(txids):
13201320
# RBF onchain txid d4b597505b543a4b8b42ab4d481fd7a533febb7e7df150ca70689e6d046612f7 (fee 6564sat) with txid 979878b8f855d3895d1cd29bd75a60b21492c4842e38099186a8e649bee02c7c (fee 8205sat)
1321-
# We can have noop RBFs: ignore those (increases are logged INFO level)
1322-
line = self.daemon.is_in_log(" INFO .*RBF (onchain|HTLC) txid {}".format(txids[-1]))
1323-
if line is not None:
1324-
newtxid = re.search(r'with txid ([0-9a-fA-F]*)', line).group(1)
1325-
txids.append(newtxid)
1321+
# Even DEBUG-level "noop" rbfs can get landed, if they're the first one!
1322+
self.daemon.logs_catchup()
1323+
for t in txids:
1324+
for line in self.daemon.logs:
1325+
m = re.search(fr'RBF (onchain|HTLC) txid {t} \(fee [0-9]*sat\) with txid ([0-9a-fA-F]*)', line)
1326+
if m is None:
1327+
continue
1328+
newtxid = m.group(2)
1329+
if newtxid not in txids:
1330+
txids.append(newtxid)
1331+
13261332
mempool = self.bitcoin.rpc.getrawmempool()
13271333
return any([t in mempool for t in txids])
13281334

0 commit comments

Comments
 (0)