multi: add itest testSweepAnchorCPFPLocalForceClose

This commit adds an itest case that focuses on validating the CPFP logic
in anchor sweeping.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:36 +08:00
1 parent a2b8f4e19c
commit 94e0e32c74
6 files changed
+434 -7

No files matched your search

+15 -2
View File
@@ -508,7 +508,8 @@ func (t *TxPublisher) createAndCheckTx(req *BumpRequest, f FeeFunction) (
return tx, fee, nil
}
return nil, 0, err
return nil, 0, fmt.Errorf("tx=%v failed mempool check: %w", tx.TxHash(),
err)
}
// broadcast takes a monitored tx and publishes it to the network. Prior to the
@@ -852,7 +853,7 @@ func (t *TxPublisher) createAndPublishTx(requestID uint64,
// directly here.
tx, fee, err := t.createAndCheckTx(r.req, r.feeFunction)
// If the error is fee related, we will return an error and let the fee
// If the error is fee related, we will return no error and let the fee
// bumper retry it at next block.
//
// NOTE: we can check the RBF error here and ask the fee function to
@@ -912,6 +913,18 @@ func (t *TxPublisher) createAndPublishTx(requestID uint64,
return fn.None[BumpResult]()
}
// If the result error is fee related, we will return no error and let
// the fee bumper retry it at next block.
//
// NOTE: we may get this error if we've bypassed the mempool check,
// which means we are suing neutrino backend.
if errors.Is(result.Err, rpcclient.ErrInsufficientFee) ||
errors.Is(result.Err, lnwallet.ErrMempoolFee) {
log.Debugf("Failed to bump tx %v: %v", oldTx.TxHash(), err)
return fn.None[BumpResult]()
}
// A successful replacement tx is created, attach the old tx.
result.ReplacedTx = oldTx
+2 -1
View File
@@ -931,7 +931,8 @@ func (s *UtxoSweeper) markInputsPublished(tr *TxRecord,
// Valdiate that the input is in an expected state.
if pi.state != PendingPublish {
log.Errorf("Expect input %v to have %v, instead it "+
// We may get a Published if this is a replacement tx.
log.Debugf("Expect input %v to have %v, instead it "+
"has %v", input.PreviousOutPoint,
PendingPublish, pi.state)