From 245e5aca956c840246d81ccd49ca5e70a96cd128 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Mon, 19 Nov 2018 15:16:07 +0800 Subject: core, test: Fix various issues (#337) --- core/consensus.go | 4 +++- core/test/network.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/consensus.go b/core/consensus.go index d5a386d..215b9f7 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -136,6 +136,8 @@ func (recv *consensusBAReceiver) ConfirmBlock( "hash", hash, "chainID", recv.chainID) recv.agreementModule.addCandidateBlock(block) + recv.agreementModule.lock.Lock() + defer recv.agreementModule.lock.Unlock() recv.ConfirmBlock(block.Hash, votes) }() return @@ -570,7 +572,7 @@ func (con *Consensus) runDKG(round uint64, config *types.Config) { } }() if err := con.cfgModule.runDKG(round); err != nil { - panic(err) + con.logger.Error("Failed to runDKG", "error", err) } }() } diff --git a/core/test/network.go b/core/test/network.go index e603a45..8bcb050 100644 --- a/core/test/network.go +++ b/core/test/network.go @@ -544,7 +544,7 @@ func (n *Network) addBlockToCache(b *types.Block) { break } } - n.blockCache[b.Hash] = b + n.blockCache[b.Hash] = b.Clone() } func (n *Network) addVoteToCache(v *types.Vote) { -- cgit v1.2.3