mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
wallet/wallet: prevent logging resend tx error if already accepted into
mempool
This commit is contained in:
parent
ee93fa9871
commit
4976c84f8f
1 changed files with 15 additions and 3 deletions
|
@ -2786,6 +2786,15 @@ func (w *Wallet) resendUnminedTxs() {
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
resp, err := chainClient.SendRawTransaction(tx, false)
|
resp, err := chainClient.SendRawTransaction(tx, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// If the transaction has already been accepted into the
|
||||||
|
// mempool, we can continue without logging the error.
|
||||||
|
switch {
|
||||||
|
case strings.Contains(err.Error(), "already have transaction"):
|
||||||
|
fallthrough
|
||||||
|
case strings.Contains(err.Error(), "txn-already-known"):
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("Could not resend transaction %v: %v",
|
log.Debugf("Could not resend transaction %v: %v",
|
||||||
tx.TxHash(), err)
|
tx.TxHash(), err)
|
||||||
|
|
||||||
|
@ -2817,9 +2826,12 @@ func (w *Wallet) resendUnminedTxs() {
|
||||||
|
|
||||||
// As the transaction was rejected, we'll attempt to
|
// As the transaction was rejected, we'll attempt to
|
||||||
// remove the unmined transaction all together.
|
// remove the unmined transaction all together.
|
||||||
// Otherwise, we'll keep attempting to rebroadcast
|
// Otherwise, we'll keep attempting to rebroadcast this,
|
||||||
// this, and we may be computing our balance
|
// and we may be computing our balance incorrectly if
|
||||||
// incorrectly if this tx credits or debits to us.
|
// this transaction credits or debits to us.
|
||||||
|
//
|
||||||
|
// TODO(wilmer): if already confirmed, move to mined
|
||||||
|
// bucket - need to determine the confirmation block.
|
||||||
err := walletdb.Update(w.db, func(dbTx walletdb.ReadWriteTx) error {
|
err := walletdb.Update(w.db, func(dbTx walletdb.ReadWriteTx) error {
|
||||||
txmgrNs := dbTx.ReadWriteBucket(wtxmgrNamespaceKey)
|
txmgrNs := dbTx.ReadWriteBucket(wtxmgrNamespaceKey)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue