From 82a98b113376d5ce4da3d1ec96b799b6fc4f4120 Mon Sep 17 00:00:00 2001 From: ennmichael Date: Thu, 21 Oct 2021 19:55:30 +0200 Subject: [PATCH] Fixed a bug where unconfirmed txn notifications were missing a label --- wallet/wallet.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index 911185519c..482e57c3fb 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -3468,19 +3468,16 @@ func (w *Wallet) reliablyPublishTransaction(tx *wire.MsgTx, } } - if err := w.addRelevantTx(dbTx, txRec, nil); err != nil { - return err - } - - // If the tx label is empty, we can return early. - if len(label) == 0 { - return nil - } - // If there is a label we should write, get the namespace key // and record it in the tx store. - txmgrNs := dbTx.ReadWriteBucket(wtxmgrNamespaceKey) - return w.TxStore.PutTxLabel(txmgrNs, tx.TxHash(), label) + if len(label) != 0 { + txmgrNs := dbTx.ReadWriteBucket(wtxmgrNamespaceKey) + if err = w.TxStore.PutTxLabel(txmgrNs, tx.TxHash(), label); err != nil { + return err + } + } + + return w.addRelevantTx(dbTx, txRec, nil) }) if err != nil { return nil, err