Skip to content

Commit 5077c9c

Browse files
committed
Stop generating block if consensus cannot make a seal
If Tendermint consensus received an outdated block request, it returns empty seal. Miner should stop the block generation if the seal is empty.
1 parent dff4ff4 commit 5077c9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/miner/miner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use crate::client::{
4343
};
4444
use crate::codechain_machine::CodeChainMachine;
4545
use crate::consensus::{CodeChainEngine, EngineType};
46-
use crate::error::Error;
46+
use crate::error::{BlockError, Error};
4747
use crate::scheme::Scheme;
4848
use crate::transaction::{PendingSignedTransactions, SignedTransaction, UnverifiedTransaction};
4949
use crate::types::{BlockId, TransactionId};
@@ -491,7 +491,7 @@ impl Miner {
491491
if let Some(seal_bytes) = seal.seal_fields() {
492492
open_block.seal(self.engine.borrow(), seal_bytes).expect("Sealing always success");
493493
} else {
494-
panic!("Seal should not be none")
494+
return Err(BlockError::InvalidSeal.into())
495495
}
496496
}
497497

0 commit comments

Comments
 (0)