提交 dcb276a0 编写于 作者: V Vitalik Buterin 提交者: Jeffrey Wilcke

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

上级 53864a73
......@@ -34,11 +34,18 @@ var (
// If two or more are set to anything other than a 0 the canary
// dies a horrible death.
func Canary(statedb *state.StateDB) bool {
r := new(big.Int)
r.Add(r, statedb.GetState(jeff, common.Hash{}).Big())
r.Add(r, statedb.GetState(vitalik, common.Hash{}).Big())
r.Add(r, statedb.GetState(christoph, common.Hash{}).Big())
r.Add(r, statedb.GetState(gav, common.Hash{}).Big())
return r.Cmp(big.NewInt(1)) > 0
var r int
if (statedb.GetState(jeff, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r++
}
if (statedb.GetState(gav, common.Hash{}).Big().Cmp(big.NewInt(0)) > 0) {
r++
}
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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册