diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-10-12 19:36:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 19:36:32 +0800 |
commit | 09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94 (patch) | |
tree | 61eb287e8119f0de7670cb7a98dfa35cd431cc82 /simulation | |
parent | 48f5fdb27e3218e2476b27ae99bcf242533b3bc3 (diff) | |
download | dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar.gz dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar.bz2 dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar.lz dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar.xz dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.tar.zst dexon-consensus-09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94.zip |
core: modify interface (#194)
* Add a new method to notify full node about round cutting.
* Modify interface to return error when preparing block
Diffstat (limited to 'simulation')
-rw-r--r-- | simulation/app.go | 8 | ||||
-rw-r--r-- | simulation/governance.go | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/simulation/app.go b/simulation/app.go index 0e3e184..0ca65c9 100644 --- a/simulation/app.go +++ b/simulation/app.go @@ -98,18 +98,18 @@ func (a *simApp) getAckedBlocks(ackHash common.Hash) (output common.Hashes) { } // PreparePayload implements core.Application. -func (a *simApp) PreparePayload(position types.Position) []byte { - return []byte{} +func (a *simApp) PreparePayload(position types.Position) ([]byte, error) { + return []byte{}, nil } // PrepareWitness implements core.Application. -func (a *simApp) PrepareWitness(height uint64) types.Witness { +func (a *simApp) PrepareWitness(height uint64) (types.Witness, error) { a.latestWitnessReady.L.Lock() defer a.latestWitnessReady.L.Unlock() for a.latestWitness.Height < height { a.latestWitnessReady.Wait() } - return a.latestWitness + return a.latestWitness, nil } // StronglyAcked is called when a block is strongly acked by DEXON diff --git a/simulation/governance.go b/simulation/governance.go index 2b0f56b..0a2c886 100644 --- a/simulation/governance.go +++ b/simulation/governance.go @@ -114,6 +114,11 @@ func (g *simGovernance) CRS(round uint64) common.Hash { return g.crs[round] } +// NotifyRoundHeight notifies governance contract to snapshot configuration +// for that round with the block on that consensus height. +func (g *simGovernance) NotifyRoundHeight(round, height uint64) { +} + // ProposeCRS proposes a CRS of round. func (g *simGovernance) ProposeCRS(signedCRS []byte) { crs := crypto.Keccak256Hash(signedCRS) |