Skip to content

Commit

Permalink
UTXO selection fixes for unpublished transaction outputs
Browse files Browse the repository at this point in the history
When selecting UTXOs, skip over those unmined transactions which are
marked unpublished, not mined transactions.

Unset a transaction from being marked unpublished if it is moved from
the unmined buckets to the mined transaction buckets.
  • Loading branch information
jrick committed Feb 9, 2021
1 parent 67f3d09 commit 1a0cd1e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions wallet/udb/txmined.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@ func (s *Store) moveMinedTx(ns walletdb.ReadWriteBucket, addrmgrNs walletdb.Read
return err
}

err = deleteUnpublished(ns, rec.Hash[:])
if err != nil {
return err
}

return deleteRawUnmined(ns, rec.Hash[:])
}

Expand Down Expand Up @@ -2285,12 +2290,6 @@ func (s *Store) UnspentOutputs(dbtx walletdb.ReadTx) ([]*Credit, error) {
continue
}

// Skip outputs from unpublished transactions.
txHash := k[:32]
if existsUnpublished(ns, txHash) {
continue
}

err = readUnspentBlock(v, &block)
if err != nil {
c.Close()
Expand All @@ -2315,6 +2314,12 @@ func (s *Store) UnspentOutputs(dbtx walletdb.ReadTx) ([]*Credit, error) {
continue
}

// Skip outputs from unpublished transactions.
txHash := k[:32]
if existsUnpublished(ns, txHash) {
continue
}

err := readCanonicalOutPoint(k, &op)
if err != nil {
c.Close()
Expand Down

0 comments on commit 1a0cd1e

Please sign in to comment.