Skip to content

Commit c7958e8

Browse files
authored
Merge pull request #45 from SiaFoundation/pj/fix-utxo-values
Cache ephemeral utxo values
2 parents 6dc8ac8 + fe8a472 commit c7958e8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

wallet/update.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,18 @@ func applyChainState(tx UpdateTx, address types.Address, cau chain.ApplyUpdate)
158158
utxoValues := make(map[types.SiacoinOutputID]types.Currency)
159159

160160
cau.ForEachSiacoinElement(func(se types.SiacoinElement, spent bool) {
161-
if se.SiacoinOutput.Address != address || ephemeral[types.Hash256(se.ID)] {
161+
if se.SiacoinOutput.Address != address {
162162
return
163163
}
164164

165165
// cache the value of the utxo to use when calculating outflow
166166
utxoValues[types.SiacoinOutputID(se.ID)] = se.SiacoinOutput.Value
167+
168+
// ignore ephemeral elements
169+
if ephemeral[se.ID] {
170+
return
171+
}
172+
167173
if spent {
168174
spentUTXOs = append(spentUTXOs, se)
169175
} else {

0 commit comments

Comments
 (0)