Commit 8160b861 authored by Vitalik Buterin's avatar Vitalik Buterin Committed by Jeffrey Wilcke

Fixed canary to require 2+ nonzero, not sum 2+

parent 02c50227
...@@ -34,11 +34,18 @@ var ( ...@@ -34,11 +34,18 @@ var (
// If two or more are set to anything other than a 0 the canary // If two or more are set to anything other than a 0 the canary
// dies a horrible death. // dies a horrible death.
func Canary(statedb *state.StateDB) bool { func Canary(statedb *state.StateDB) bool {
r := new(big.Int) var r int
r.Add(r, statedb.GetState(jeff, common.Hash{}).Big()) if (statedb.GetState(jeff, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r.Add(r, statedb.GetState(vitalik, common.Hash{}).Big()) r++
r.Add(r, statedb.GetState(christoph, common.Hash{}).Big()) }
r.Add(r, statedb.GetState(gav, common.Hash{}).Big()) if (statedb.GetState(gav, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r++
return r.Cmp(big.NewInt(1)) > 0 }
if (statedb.GetState(christoph, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r++
}
if (statedb.GetState(vitalik, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r++
}
return r > 1
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment