From 7b661e5c9dd20a29d36a60e107edc0c4a63b5b8e Mon Sep 17 00:00:00 2001 From: Jinghui Liao Date: Tue, 8 Feb 2022 02:32:04 -0500 Subject: [PATCH] add log when exception happens under debug mode (#686) --- src/DBFTPlugin/Consensus/ConsensusContext.MakePayload.cs | 3 ++- src/DBFTPlugin/Consensus/ConsensusContext.cs | 3 ++- src/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs | 8 +++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/DBFTPlugin/Consensus/ConsensusContext.MakePayload.cs b/src/DBFTPlugin/Consensus/ConsensusContext.MakePayload.cs index e8af9f0ad..973ab34a5 100644 --- a/src/DBFTPlugin/Consensus/ConsensusContext.MakePayload.cs +++ b/src/DBFTPlugin/Consensus/ConsensusContext.MakePayload.cs @@ -47,8 +47,9 @@ private void SignPayload(ExtensiblePayload payload) sc = new ContractParametersContext(neoSystem.StoreView, payload, dbftSettings.Network); wallet.Sign(sc); } - catch (InvalidOperationException) + catch (InvalidOperationException exception) { + Utility.Log(nameof(ConsensusContext), LogLevel.Debug, exception.ToString()); return; } payload.Witness = sc.GetWitnesses()[0]; diff --git a/src/DBFTPlugin/Consensus/ConsensusContext.cs b/src/DBFTPlugin/Consensus/ConsensusContext.cs index 990b84961..dc0c3e1dc 100644 --- a/src/DBFTPlugin/Consensus/ConsensusContext.cs +++ b/src/DBFTPlugin/Consensus/ConsensusContext.cs @@ -160,8 +160,9 @@ public bool Load() { Deserialize(reader); } - catch + catch (Exception exception) { + Utility.Log(nameof(ConsensusContext), LogLevel.Debug, exception.ToString()); return false; } return true; diff --git a/src/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs b/src/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs index 32d2cce06..cc2baab60 100644 --- a/src/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs +++ b/src/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs @@ -24,14 +24,12 @@ private void OnConsensusPayload(ExtensiblePayload payload) { message = context.GetMessage(payload); } - catch (FormatException) - { - return; - } - catch (IOException) + catch (Exception ex) { + Utility.Log(nameof(ConsensusService), LogLevel.Debug, ex.ToString()); return; } + if (!message.Verify(neoSystem.Settings)) return; if (message.BlockIndex != context.Block.Index) {