diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-01-24 11:16:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 11:16:48 +0800 |
commit | 779f63a9f6fc3f4c628f0b97c822546ac51d0eb6 (patch) | |
tree | aa25f260483e8c9430686cb10eba87d286072830 /core/test/app.go | |
parent | 0e6dc8b38f7df249831aebd4928ec42b827038e3 (diff) | |
download | tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar.gz tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar.bz2 tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar.lz tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar.xz tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.tar.zst tangerine-consensus-779f63a9f6fc3f4c628f0b97c822546ac51d0eb6.zip |
core: remove Governance.NotifyRoundHeight (#431)
Diffstat (limited to 'core/test/app.go')
-rw-r--r-- | core/test/app.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/core/test/app.go b/core/test/app.go index dbee059..515ed23 100644 --- a/core/test/app.go +++ b/core/test/app.go @@ -110,21 +110,28 @@ type App struct { DeliverSequence common.Hashes deliveredLock sync.RWMutex state *State + gov *Governance lastPendingHeightLock sync.RWMutex LastPendingHeight uint64 + roundToNotify uint64 } // NewApp constructs a TestApp instance. -func NewApp(state *State) *App { - return &App{ +func NewApp(initRound uint64, gov *Governance) (app *App) { + app = &App{ Confirmed: make(map[common.Hash]*types.Block), LastConfirmedHeights: make(map[uint32]uint64), TotalOrdered: []*AppTotalOrderRecord{}, TotalOrderedByHash: make(map[common.Hash]*AppTotalOrderRecord), Delivered: make(map[common.Hash]*AppDeliveredRecord), DeliverSequence: common.Hashes{}, - state: state, + gov: gov, + roundToNotify: initRound, } + if gov != nil { + app.state = gov.State() + } + return app } // PreparePayload implements Application interface. @@ -274,6 +281,12 @@ func (app *App) BlockDelivered( panic(err) } } + if app.roundToNotify == pos.Round { + if app.gov != nil { + app.gov.NotifyRound(app.roundToNotify) + app.roundToNotify++ + } + } }() } |