From 1b352d9e52839c8b6c316c2601d08c91c995d8f0 Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Fri, 7 Dec 2018 18:02:59 +0800 Subject: core: fix bugs found when node-set is not equal to notary-set (#362) --- core/test/state-change-request.go | 8 ++++++-- core/test/state.go | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'core/test') diff --git a/core/test/state-change-request.go b/core/test/state-change-request.go index 84d4d3f..1515fd2 100644 --- a/core/test/state-change-request.go +++ b/core/test/state-change-request.go @@ -185,7 +185,11 @@ func (req *StateChangeRequest) String() (ret string) { ret += fmt.Sprintf( "{Type:AddNode %s", types.NewNodeID(req.Payload.(crypto.PublicKey)).String()[:6]) + default: + panic(fmt.Errorf( + "attempting to dump unknown type of state change request: %v", + req.Type)) } - panic(fmt.Errorf( - "attempting to dump unknown type of state change request: %v", req.Type)) + ret += "}" + return } diff --git a/core/test/state.go b/core/test/state.go index b360fa2..30ed8af 100644 --- a/core/test/state.go +++ b/core/test/state.go @@ -177,6 +177,11 @@ func (s *State) Snapshot() (*types.Config, []crypto.PublicKey) { }, nodes } +// AttachLogger allows to attach custom logger. +func (s *State) AttachLogger(logger common.Logger) { + s.logger = logger +} + func (s *State) unpackPayload( raw *rawStateChangeRequest) (v interface{}, err error) { switch raw.Type { -- cgit