contractcourt: handle mempool min fee error.

In case the mempool backend signals that our transaction does not
meet fee requirements when publishing it we will continue to
start up now. The transaction will be rebroadcasted in the
background and a specific log message will be printed to let the
user know that he could increase his mempool size to at least
have this transaction in his own mempool.
This commit is contained in:
ziggie 2023-06-03 14:05:16 +02:00
parent 54bacec422
commit 8314f0a879
No known key found for this signature in database
GPG key ID: 1AFF9C4DCED6D666
2 changed files with 18 additions and 4 deletions

View file

@ -553,7 +553,7 @@ func (c *ChannelArbitrator) Start(state *chanArbStartState) error {
// StateWaitingFullResolution after we've transitioned from
// StateContractClosed which can only be triggered by the local
// or remote close trigger. This trigger is only fired when we
// receive a chain event from the chain watcher than the
// receive a chain event from the chain watcher that the
// commitment has been confirmed on chain, and before we
// advance our state step, we call InsertConfirmedCommitSet.
err := c.relaunchResolvers(state.commitSet, triggerHeight)
@ -990,11 +990,18 @@ func (c *ChannelArbitrator) stateStep(
label := labels.MakeLabel(
labels.LabelTypeChannelClose, &c.cfg.ShortChanID,
)
if err := c.cfg.PublishTx(closeTx, label); err != nil {
log.Errorf("ChannelArbitrator(%v): unable to broadcast "+
"close tx: %v", c.cfg.ChanPoint, err)
if err != lnwallet.ErrDoubleSpend {
// This makes sure we don't fail at startup if the
// commitment transaction has too low fees to make it
// into mempool. The rebroadcaster makes sure this
// transaction is republished regularly until confirmed
// or replaced.
if !errors.Is(err, lnwallet.ErrDoubleSpend) &&
!errors.Is(err, lnwallet.ErrMempoolFee) {
return StateError, closeTx, err
}
}

View file

@ -3,6 +3,7 @@ package contractcourt
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"sync"
@ -872,7 +873,13 @@ func (u *UtxoNursery) sweepCribOutput(classHeight uint32, baby *babyOutput) erro
// confirmed before transitioning it to kindergarten.
label := labels.MakeLabel(labels.LabelTypeSweepTransaction, nil)
err := u.cfg.PublishTransaction(baby.timeoutTx, label)
if err != nil && err != lnwallet.ErrDoubleSpend {
// In case the tx does not meet mempool fee requirements we continue
// because the tx is rebroadcasted in the background and there is
// nothing we can do to bump this transaction anyways.
if err != nil && !errors.Is(err, lnwallet.ErrDoubleSpend) &&
!errors.Is(err, lnwallet.ErrMempoolFee) {
utxnLog.Errorf("Unable to broadcast baby tx: "+
"%v, %v", err, spew.Sdump(baby.timeoutTx))
return err