From 1ee5863fd4a295d34c3a2d602d5603e8746e3f7b Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Thu, 8 Nov 2018 15:58:51 +0800 Subject: 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 --- core/test/state.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core/test/state.go') 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{} -- cgit v1.2.3