From 80ad0fdd5ca906d540db56f05486dc79496d9e8c Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 12 Jun 2019 10:44:22 +0200 Subject: [PATCH] lntest: restart Alice after on-chain settle To ensure lnd is able to pick up an on-chain preimage properly after a restart, we suspend Alice and check that the payment is listed correctly as succeeded after a restart. --- .../lnd_multi-hop_htlc_local_chain_claim_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lntest/itest/lnd_multi-hop_htlc_local_chain_claim_test.go b/lntest/itest/lnd_multi-hop_htlc_local_chain_claim_test.go index 7d79eacb..123359dc 100644 --- a/lntest/itest/lnd_multi-hop_htlc_local_chain_claim_test.go +++ b/lntest/itest/lnd_multi-hop_htlc_local_chain_claim_test.go @@ -195,6 +195,13 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest) } } + // At this point we suspend Alice to make sure she'll handle the + // on-chain settle after a restart. + restartAlice, err := net.SuspendNode(net.Alice) + if err != nil { + t.Fatalf("unable to suspend alice: %v", err) + } + // Mine a block to confirm the two transactions (+ the coinbase). block = mineBlocks(t, net, 1, 2)[0] if len(block.Transactions) != 3 { @@ -285,6 +292,12 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest) bobSecondLevelCSV := uint32(defaultCSV) carolSecondLevelCSV-- + // Now that the preimage from Bob has hit the chain, restart Alice to + // ensure she'll pick it up. + if err := restartAlice(); err != nil { + t.Fatalf("unable to restart alice: %v", err) + } + // If we then mine 3 additional blocks, Carol's second level tx should // mature, and she can pull the funds from it with a sweep tx. if _, err := net.Miner.Node.Generate(carolSecondLevelCSV); err != nil {