wallet: catch remaining bitcoind errors, and generic RPC errors resendUnminedTxs
In this commit, ensure that upon restart, if any of the full-node based backends we support reject the transaction, then we'll properly remove the now invalid transaction from the tx store. Before this commit, we could miss a few errors from bitcoind. To remedy this, we explicitly catch those errors, but then also attempt to precisely catch the set of generic json RPC errors that can be returned.
This commit is contained in:
parent
8b2aebe89e
commit
921dae5d5e
1 changed files with 12 additions and 8 deletions
|
@ -2195,13 +2195,22 @@ func (w *Wallet) resendUnminedTxs() {
|
|||
// detect that the output has already been fully spent,
|
||||
// is an orphan, or is conflicting with another
|
||||
// transaction.
|
||||
//
|
||||
// TODO(roasbeef): SendRawTransaction needs to return
|
||||
// concrete error types, no need for string matching
|
||||
switch {
|
||||
// The following are errors returned from btcd's
|
||||
// mempool.
|
||||
case strings.Contains(err.Error(), "spent"):
|
||||
|
||||
case strings.Contains(err.Error(), "orphan"):
|
||||
|
||||
case strings.Contains(err.Error(), "conflict"):
|
||||
|
||||
// The following errors are returned from bitcoind's
|
||||
// mempool.
|
||||
case strings.Contains(err.Error(), "Missing inputs"):
|
||||
case strings.Contains(err.Error(), "already in block chain"):
|
||||
case strings.Contains(err.Error(), "fee not met"):
|
||||
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
@ -2221,12 +2230,7 @@ func (w *Wallet) resendUnminedTxs() {
|
|||
return err
|
||||
}
|
||||
|
||||
err = w.TxStore.RemoveUnminedTx(txmgrNs, txRec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
return w.TxStore.RemoveUnminedTx(txmgrNs, txRec)
|
||||
})
|
||||
if err != nil {
|
||||
log.Warnf("unable to remove conflicting "+
|
||||
|
|
Loading…
Reference in a new issue