Skip to content

Commit

Permalink
wallet: make use of v2 pool in selectUTXOs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Aug 7, 2024
1 parent 95e927e commit f2cc300
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@ func (sw *SingleAddressWallet) selectUTXOs(amount types.Currency, inputs int, us
}
}
}
for _, txn := range sw.cm.V2PoolTransactions() {
for _, sci := range txn.SiacoinInputs {
tpoolSpent[types.Hash256(sci.Parent.ID)] = true
delete(tpoolUtxos, types.Hash256(sci.Parent.ID))
}
txnID := txn.ID()
for i, sco := range txn.SiacoinOutputs {
tpoolUtxos[types.Hash256(txn.SiacoinOutputID(txnID, i))] = types.SiacoinElement{
StateElement: types.StateElement{
ID: types.Hash256(types.SiacoinOutputID(txn.SiacoinOutputID(txnID, i))),
},
SiacoinOutput: sco,
}
}
}

// remove immature, locked and spent outputs
cs := sw.cm.TipState()
Expand Down Expand Up @@ -569,6 +584,11 @@ func (sw *SingleAddressWallet) selectRedistributeUTXOs(bh uint64, outputs int, a
inPool[types.Hash256(sci.ParentID)] = true
}
}
for _, txn := range sw.cm.V2PoolTransactions() {
for _, sci := range txn.SiacoinInputs {
inPool[types.Hash256(sci.Parent.ID)] = true
}
}

// adjust the number of desired outputs for any output we encounter that is
// unused, matured and has the same value
Expand Down

0 comments on commit f2cc300

Please sign in to comment.