lnwallet: add new ErrMempoolFee error.
This commit is contained in:
2 files changed
+16
-2
No files matched your search
@@ -1192,8 +1192,9 @@ func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32,
|
|||||||
// PublishTransaction performs cursory validation (dust checks, etc), then
|
// PublishTransaction performs cursory validation (dust checks, etc), then
|
||||||
// finally broadcasts the passed transaction to the Bitcoin network. If
|
// finally broadcasts the passed transaction to the Bitcoin network. If
|
||||||
// publishing the transaction fails, an error describing the reason is returned
|
// publishing the transaction fails, an error describing the reason is returned
|
||||||
// (currently ErrDoubleSpend). If the transaction is already published to the
|
// and mapped to the wallet's internal error types. If the transaction is
|
||||||
// network (either in the mempool or chain) no error will be returned.
|
// 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 {
|
func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error {
|
||||||
if err := b.wallet.PublishTransaction(tx, label); err != nil {
|
if err := b.wallet.PublishTransaction(tx, label); err != nil {
|
||||||
// If we failed to publish the transaction, check whether we
|
// 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:
|
case *base.ErrReplacement:
|
||||||
return lnwallet.ErrDoubleSpend
|
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:
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ var (
|
|||||||
// ErrNotMine is an error denoting that a WalletController instance is
|
// ErrNotMine is an error denoting that a WalletController instance is
|
||||||
// unable to spend a specified output.
|
// unable to spend a specified output.
|
||||||
ErrNotMine = errors.New("the passed output doesn't belong to the wallet")
|
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
|
// ErrNoOutputs is returned if we try to create a transaction with no outputs
|
||||||
|
|||||||
Reference in new issue
Block a user