diff --git a/internal/vsp/vsp.go b/internal/vsp/vsp.go index aec4ca9a9..203cff2ff 100644 --- a/internal/vsp/vsp.go +++ b/internal/vsp/vsp.go @@ -375,11 +375,11 @@ func (v *VSP) Process(ctx context.Context, ticketHash chainhash.Hash, credits [] } // set fee tx as unpublished, because it will be published by the vsp. feeHash := feeTx.TxHash() - err = v.cfg.Wallet.AddTransaction(ctx, feeTx, nil) + err = v.cfg.Wallet.SetPublished(ctx, &feeHash, false) if err != nil { return nil, err } - err = v.cfg.Wallet.SetPublished(ctx, &feeHash, false) + err = v.cfg.Wallet.AddTransaction(ctx, feeTx, nil) if err != nil { return nil, err } diff --git a/wallet/chainntfns.go b/wallet/chainntfns.go index bdf782e81..c52b2fb71 100644 --- a/wallet/chainntfns.go +++ b/wallet/chainntfns.go @@ -566,8 +566,13 @@ func (w *Wallet) processTransactionRecord(ctx context.Context, dbtx walletdb.Rea } // Skip unlocking outpoints if the transaction is a vote or revocation as the lock - // is not held. - skipOutpoints := rec.TxType == stake.TxTypeSSGen || rec.TxType == stake.TxTypeSSRtx + // is not held. Also if it is an unpublished tx. + var isUnpublished bool + err = walletdb.View(ctx, w.db, func(tx walletdb.ReadTx) error { + isUnpublished = w.txStore.ExistsUnpublished(tx, &rec.Hash) + return nil + }) + skipOutpoints := rec.TxType == stake.TxTypeSSGen || rec.TxType == stake.TxTypeSSRtx || isUnpublished // Handle input scripts that contain P2PKs that we care about. for i, input := range rec.MsgTx.TxIn { diff --git a/wallet/udb/txunmined.go b/wallet/udb/txunmined.go index 4b5d45cff..10325ac4e 100644 --- a/wallet/udb/txunmined.go +++ b/wallet/udb/txunmined.go @@ -141,6 +141,12 @@ func (s *Store) SetPublished(dbtx walletdb.ReadWriteTx, txHash *chainhash.Hash, return putUnpublished(ns, txHash[:]) } +// ExistsUnpublished exported method of exists Unpublished +func (s *Store) ExistsUnpublished(dbtx walletdb.ReadTx, txHash *chainhash.Hash) bool { + ns := dbtx.ReadBucket(wtxmgrBucketKey) + return existsUnpublished(ns, txHash[:]) +} + // removeDoubleSpends checks for any unmined transactions which would introduce // a double spend if tx was added to the store (either as a confirmed or unmined // transaction). Each conflicting transaction and all transactions which spend