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
2024-04-01 21:28:54 +08:00
parent a2b8f4e19c
commit 94e0e32c74
6 changed files with 434 additions and 7 deletions

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