From 8b09ac38aa9467793df3ba9144911952aa1bad9d Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 18 Dec 2020 12:28:12 +0100 Subject: [PATCH] pyln: Log mempool when we generate blocks in BitcoinD fixture We sometimes have very specific sequences of tx broadcasts and blocks being generated to confirm them. If the confirmation is missed the test can completely get out of sync. Make debugging this easier by logging what we confirmed. --- contrib/pyln-testing/pyln/testing/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 9ab4e1743..2435df73d 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -401,6 +401,14 @@ class BitcoinD(TailableProc): wait_for(lambda: all(txid in self.rpc.getrawmempool() for txid in wait_for_mempool)) else: wait_for(lambda: len(self.rpc.getrawmempool()) >= wait_for_mempool) + + mempool = self.rpc.getrawmempool() + logging.debug("Generating {numblocks}, confirming {lenmempool} transactions: {mempool}".format( + numblocks=numblocks, + mempool=mempool, + lenmempool=len(mempool), + )) + # As of 0.16, generate() is removed; use generatetoaddress. return self.rpc.generatetoaddress(numblocks, self.rpc.getnewaddress())