This commit is contained in:
MinJae Kwon 2021-06-29 03:57:09 -04:00 committed by GitHub
commit 19f48a7716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ func (u UTXOSet) FindSpendableOutputs(pubkeyHash []byte, amount int) (int, map[s
txID := hex.EncodeToString(k)
outs := DeserializeOutputs(v)
if accumulated >= amount {
break
}
for outIdx, out := range outs.Outputs {
if out.IsLockedWithKey(pubkeyHash) && accumulated < amount {
accumulated += out.Value