Skip to content

Commit

Permalink
Regression test for pegin validation issues during sync
Browse files Browse the repository at this point in the history
Add a regression test for #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.)
  • Loading branch information
gwillen committed Aug 30, 2021
1 parent 5d79fb5 commit 9c5ea27
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/functional/feature_fedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def setup_network(self, split=False):
'-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:
Expand Down Expand Up @@ -470,9 +471,12 @@ def run_test(self):
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")
Expand Down

0 comments on commit 9c5ea27

Please sign in to comment.