aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/governance.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-16 17:26:50 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commitfd188f89845ea16c40c2b6af2ffa67b0f445b854 (patch)
tree9db6403388483324e6e7916fae3f8c2249f3ffdc /core/vm/governance.go
parent652ec743c6e05a94212745daec4c10565e57524b (diff)
downloadgo-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar.gz
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar.bz2
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar.lz
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar.xz
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.tar.zst
go-tangerine-fd188f89845ea16c40c2b6af2ffa67b0f445b854.zip
core: fix light node synchronization issue (#30)
InsertChain() need to record the correct roundHeight mapping in order to process snapshotRoundHeight() governance method correctly.
Diffstat (limited to 'core/vm/governance.go')
-rw-r--r--core/vm/governance.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go
index b38733e1a..f406294d2 100644
--- a/core/vm/governance.go
+++ b/core/vm/governance.go
@@ -1767,16 +1767,18 @@ func (g *GovernanceContract) transferOwnership(newOwner common.Address) ([]byte,
}
func (g *GovernanceContract) snapshotRound(round, height *big.Int) ([]byte, error) {
- // Validate if this mapping is correct.
- realHeight, ok := g.evm.Context.GetRoundHeight(round.Uint64())
- if !ok {
- g.penalize()
- return nil, errExecutionReverted
- }
+ // Validate if this mapping is correct. Only block proposer need to verify this.
+ if g.evm.IsBlockProposer() {
+ realHeight, ok := g.evm.Context.GetRoundHeight(round.Uint64())
+ if !ok {
+ g.penalize()
+ return nil, errExecutionReverted
+ }
- if height.Cmp(new(big.Int).SetUint64(realHeight)) != 0 {
- g.penalize()
- return nil, errExecutionReverted
+ if height.Cmp(new(big.Int).SetUint64(realHeight)) != 0 {
+ g.penalize()
+ return nil, errExecutionReverted
+ }
}
// Only allow updating the next round.