unspentcoinstate: fix branch never executed

This commit is contained in:
Vsevolod Brekelov 2019-10-21 12:40:11 +03:00
parent 05ea84454c
commit 063fe5be9d

View file

@ -122,15 +122,14 @@ func IsDoubleSpend(s storage.Store, tx *transaction.Transaction) bool {
if r.Err != nil { if r.Err != nil {
return false return false
} }
if unspent == nil {
return true
}
for _, input := range inputs { for _, input := range inputs {
if int(input.PrevIndex) >= len(unspent.states) || unspent.states[input.PrevIndex] == CoinStateSpent { if int(input.PrevIndex) >= len(unspent.states) || unspent.states[input.PrevIndex] == CoinStateSpent {
return true return true
} }
} }
} else {
return true
} }
} }