From b5e7ee553c1336061c4b30d39b3d0db5f890f07f Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Mon, 10 Oct 2022 15:36:57 -0400 Subject: [PATCH] feat: add Error::ChannelClosed() variant to detect thread hangups --- src/chainstate/stacks/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/chainstate/stacks/mod.rs b/src/chainstate/stacks/mod.rs index fe35b8192..1c5b205be 100644 --- a/src/chainstate/stacks/mod.rs +++ b/src/chainstate/stacks/mod.rs @@ -121,6 +121,7 @@ pub enum Error { PoxNoRewardCycle, ProblematicTransaction(Txid), MinerAborted, + ChannelClosed(String), } impl From for Error { @@ -197,6 +198,7 @@ impl fmt::Display for Error { txid ), Error::MinerAborted => write!(f, "Mining attempt aborted by signal"), + Error::ChannelClosed(ref s) => write!(f, "Channel '{}' closed", s), } } } @@ -232,6 +234,7 @@ impl error::Error for Error { Error::StacksTransactionSkipped(ref _r) => None, Error::ProblematicTransaction(ref _txid) => None, Error::MinerAborted => None, + Error::ChannelClosed(ref _s) => None, } } } @@ -267,6 +270,7 @@ impl Error { Error::StacksTransactionSkipped(ref _r) => "StacksTransactionSkipped", Error::ProblematicTransaction(ref _txid) => "ProblematicTransaction", Error::MinerAborted => "MinerAborted", + Error::ChannelClosed(ref _s) => "ChannelClosed", } }