aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/state.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-11-08 15:58:51 +0800
committerGitHub <noreply@github.com>2018-11-08 15:58:51 +0800
commit1ee5863fd4a295d34c3a2d602d5603e8746e3f7b (patch)
tree044308b22000bb0c9f5a8c3c21f465159418db24 /core/test/state.go
parentdbe83ea4a324941417d6ff09230e5874d5ba5df5 (diff)
downloaddexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar.gz
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar.bz2
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar.lz
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar.xz
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.tar.zst
dexon-consensus-1ee5863fd4a295d34c3a2d602d5603e8746e3f7b.zip
simulation: use test.Governacne in simulation (#311)
* Move simulation.Network to test package * Use test.Governance in simulation * Pack/Apply state request in blocks payload * Add Governance.SwitchToRemoteMode This would trigger governance to broadcast pending state change requests when changes. * Allow to marshal/unmarshal packedStateChanges * Attach test.Network and test.State
Diffstat (limited to 'core/test/state.go')
-rw-r--r--core/test/state.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/test/state.go b/core/test/state.go
index 2bb04e5..630c43f 100644
--- a/core/test/state.go
+++ b/core/test/state.go
@@ -518,9 +518,11 @@ func (s *State) AddRequestsFromOthers(reqsAsBytes []byte) (err error) {
// PackRequests pack all current pending requests, include those from others.
func (s *State) PackRequests() (b []byte, err error) {
- // Convert own requests to global one for packing.
- if _, err = s.PackOwnRequests(); err != nil {
- return
+ if s.local {
+ // Convert own requests to global one for packing.
+ if _, err = s.PackOwnRequests(); err != nil {
+ return
+ }
}
// Pack requests in global pool.
packed := []*StateChangeRequest{}