mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
parent
ebf6f2e344
commit
2482fd4427
1 changed files with 11 additions and 5 deletions
|
@ -1318,11 +1318,17 @@ class LightningNode(object):
|
|||
# Hack so we can mutate the txid: pass it in a list
|
||||
def rbf_or_txid_broadcast(txids):
|
||||
# RBF onchain txid d4b597505b543a4b8b42ab4d481fd7a533febb7e7df150ca70689e6d046612f7 (fee 6564sat) with txid 979878b8f855d3895d1cd29bd75a60b21492c4842e38099186a8e649bee02c7c (fee 8205sat)
|
||||
# We can have noop RBFs: ignore those (increases are logged INFO level)
|
||||
line = self.daemon.is_in_log(" INFO .*RBF (onchain|HTLC) txid {}".format(txids[-1]))
|
||||
if line is not None:
|
||||
newtxid = re.search(r'with txid ([0-9a-fA-F]*)', line).group(1)
|
||||
txids.append(newtxid)
|
||||
# Even DEBUG-level "noop" rbfs can get landed, if they're the first one!
|
||||
self.daemon.logs_catchup()
|
||||
for t in txids:
|
||||
for line in self.daemon.logs:
|
||||
m = re.search(fr'RBF (onchain|HTLC) txid {t} \(fee [0-9]*sat\) with txid ([0-9a-fA-F]*)', line)
|
||||
if m is None:
|
||||
continue
|
||||
newtxid = m.group(2)
|
||||
if newtxid not in txids:
|
||||
txids.append(newtxid)
|
||||
|
||||
mempool = self.bitcoin.rpc.getrawmempool()
|
||||
return any([t in mempool for t in txids])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue