diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index d7bfc42e2..23f2610cc 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -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 { diff --git a/pkg/core/dao.go b/pkg/core/dao.go index fbab4c6ef..f211a2d42 100644 --- a/pkg/core/dao.go +++ b/pkg/core/dao.go @@ -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 } }