From e5ba4e819ebe42a03cf0de8395b00bc042cf310d Mon Sep 17 00:00:00 2001 From: Glenn Willen Date: Mon, 30 Aug 2021 16:48:15 -0700 Subject: [PATCH] Regression test for pegin validation issues during sync Add a regression test for https://github.com/ElementsProject/elements/issues/891 . This checks that we can sync successfully when making a bunch of new blocks just as we have transient loss of parent daemon connectivity. This reliably fails without the fix, and reliably succeeds with it. (It stands in for the situation, more common in production, where we sync faster than the parent daemon can keep up after a long outage.) --- test/functional/feature_fedpeg.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/functional/feature_fedpeg.py b/test/functional/feature_fedpeg.py index 6aeaa841e9..896b804ece 100755 --- a/test/functional/feature_fedpeg.py +++ b/test/functional/feature_fedpeg.py @@ -125,6 +125,7 @@ class FedPegTest(BitcoinTestFramework): '-parent_bech32_hrp=bcrt', # Turn of consistency checks that can cause assert when parent node stops # and a peg-in transaction fails this belt-and-suspenders check. + # NOTE: This can cause spurious problems in regtest, and should be dealt with in a better way. '-checkmempool=0', ] if not self.options.parent_bitcoin: @@ -470,9 +471,12 @@ class FedPegTest(BitcoinTestFramework): self.start_node(1) connect_nodes_bi(self.nodes, 0, 1) - # Don't make a block, race condition when pegin-invalid block - # is awaiting further validation, nodes reject subsequent blocks - # even ones they create + # Make a bunch of blocks while catching up, as a regression test for + # https://github.com/ElementsProject/elements/issues/891 (sporadic + # failures when catching up after loss of parent daemon connectivity.) + print("Generating some blocks, to stress-test handling of parent daemon reconnection") + sidechain.generate(10) + print("Now waiting for node to re-evaluate peg-in witness failed block... should take a few seconds") self.sync_all(self.node_groups) print("Completed!\n")