multi: update RPC error import path

These errors are now defined in `btcwallet/chain` instead of
`btcd/rpcclient`.
This commit is contained in:
yyforyongyu
2024-07-03 23:04:58 +08:00
parent e0a506ab26
commit ddf46f435c
6 changed files with 24 additions and 21 deletions

View File

@@ -1202,15 +1202,15 @@ func mapRpcclientError(err error) error {
switch {
// If the wallet reports a double spend, convert it to our internal
// ErrDoubleSpend and return.
case errors.Is(err, rpcclient.ErrMempoolConflict),
errors.Is(err, rpcclient.ErrMissingInputs):
case errors.Is(err, chain.ErrMempoolConflict),
errors.Is(err, chain.ErrMissingInputs):
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 errors.Is(err, rpcclient.ErrMempoolMinFeeNotMet):
case errors.Is(err, chain.ErrMempoolMinFeeNotMet):
return fmt.Errorf("%w: %v", lnwallet.ErrMempoolFee, err.Error())
}
@@ -1295,9 +1295,9 @@ func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error {
// `PublishTransaction` again because we need to mark the label in the
// wallet. We can remove this exception once we have the above TODO
// fixed.
case errors.Is(err, rpcclient.ErrTxAlreadyInMempool),
errors.Is(err, rpcclient.ErrTxAlreadyKnown),
errors.Is(err, rpcclient.ErrTxAlreadyConfirmed):
case errors.Is(err, chain.ErrTxAlreadyInMempool),
errors.Is(err, chain.ErrTxAlreadyKnown),
errors.Is(err, chain.ErrTxAlreadyConfirmed):
err := b.wallet.PublishTransaction(tx, label)
return mapRpcclientError(err)