mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
lnwallet: add new ErrMempoolFee error.
This commit is contained in:
parent
6da0f2a157
commit
54bacec422
2 changed files with 16 additions and 2 deletions
|
@ -1192,8 +1192,9 @@ func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32,
|
|||
// PublishTransaction performs cursory validation (dust checks, etc), then
|
||||
// finally broadcasts the passed transaction to the Bitcoin network. If
|
||||
// publishing the transaction fails, an error describing the reason is returned
|
||||
// (currently ErrDoubleSpend). If the transaction is already published to the
|
||||
// network (either in the mempool or chain) no error will be returned.
|
||||
// and mapped to the wallet's internal error types. If the transaction is
|
||||
// already published to the network (either in the mempool or chain) no error
|
||||
// will be returned.
|
||||
func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error {
|
||||
if err := b.wallet.PublishTransaction(tx, label); err != nil {
|
||||
// If we failed to publish the transaction, check whether we
|
||||
|
@ -1210,6 +1211,13 @@ func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error {
|
|||
case *base.ErrReplacement:
|
||||
return lnwallet.ErrDoubleSpend
|
||||
|
||||
// If the wallet reports that fee requirements for accepting the
|
||||
// tx into mempool are not met, convert it to our internal
|
||||
// ErrMempoolFee and return.
|
||||
case *base.ErrMempoolFee:
|
||||
return fmt.Errorf("%w: %v", lnwallet.ErrMempoolFee,
|
||||
err.Error())
|
||||
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -69,6 +69,12 @@ var (
|
|||
// ErrNotMine is an error denoting that a WalletController instance is
|
||||
// unable to spend a specified output.
|
||||
ErrNotMine = errors.New("the passed output doesn't belong to the wallet")
|
||||
|
||||
// ErrMempoolFee is returned from PublishTransaction in case the tx
|
||||
// being published is not accepted into mempool because the fee
|
||||
// requirements of the mempool backend are not met.
|
||||
ErrMempoolFee = errors.New("transaction rejected by the mempool " +
|
||||
"because of low fees")
|
||||
)
|
||||
|
||||
// ErrNoOutputs is returned if we try to create a transaction with no outputs
|
||||
|
|
Loading…
Add table
Reference in a new issue