mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-12 15:17:32 +01:00
sweeper+lntest: remove conflicting tx
For anchor channels and neutrino backends we need to make sure that sweeps of the same exclusive group are removed when one of them is confirmed. Otherwise for neutrino backends those sweep transaction are always rebroadcasted and are blocking funds in the worst case scenario.
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lntest/rpc"
|
||||
"github.com/lightningnetwork/lnd/lntest/wait"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@@ -693,6 +694,27 @@ func (h *HarnessTest) AssertStreamChannelForceClosed(hn *node.HarnessNode,
|
||||
closingTxid := h.WaitForChannelCloseEvent(stream)
|
||||
h.Miner.AssertTxInBlock(block, closingTxid)
|
||||
|
||||
// This makes sure that we do not have any lingering unconfirmed anchor
|
||||
// cpfp transactions blocking some of our utxos. Especially important
|
||||
// in case of a neutrino backend.
|
||||
if anchors {
|
||||
err := wait.NoError(func() error {
|
||||
utxos := h.GetUTXOsUnconfirmed(
|
||||
hn, lnwallet.DefaultAccountName,
|
||||
)
|
||||
total := len(utxos)
|
||||
if total == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("%s: assert %s failed: want %d "+
|
||||
"got: %d", hn.Name(), "no unconfirmed cpfp "+
|
||||
"achor sweep transactions", 0, total)
|
||||
}, DefaultTimeout)
|
||||
require.NoErrorf(hn, err, "expected no unconfirmed cpfp "+
|
||||
"anchor sweep utxos")
|
||||
}
|
||||
|
||||
// We should see zero waiting close channels and 1 pending force close
|
||||
// channels now.
|
||||
h.AssertNumWaitingClose(hn, 0)
|
||||
|
||||
Reference in New Issue
Block a user