mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
core: treat state.Coin as a bitfield
As it was intended to.
This commit is contained in:
parent
377fb382aa
commit
e1f194ea7b
2 changed files with 2 additions and 2 deletions
|
@ -501,7 +501,7 @@ func (bc *Blockchain) storeBlock(block *block.Block) error {
|
|||
}
|
||||
oldSpentCoinLen := len(spentCoin.Items)
|
||||
for _, input := range inputs {
|
||||
unspent.States[input.PrevIndex] = state.CoinSpent
|
||||
unspent.States[input.PrevIndex] |= state.CoinSpent
|
||||
prevTXOutput := prevTX.Outputs[input.PrevIndex]
|
||||
account, err := cache.GetAccountStateOrNew(prevTXOutput.ScriptHash)
|
||||
if err != nil {
|
||||
|
|
|
@ -590,7 +590,7 @@ func (dao *dao) IsDoubleSpend(tx *transaction.Transaction) bool {
|
|||
return false
|
||||
}
|
||||
for _, input := range inputs {
|
||||
if int(input.PrevIndex) >= len(unspent.States) || unspent.States[input.PrevIndex] == state.CoinSpent {
|
||||
if int(input.PrevIndex) >= len(unspent.States) || (unspent.States[input.PrevIndex]&state.CoinSpent) != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue