File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 11use crate :: error:: RPCError ;
2- use ckb_chain:: ChainController ;
2+ use ckb_chain:: { ChainController , VerifiedBlockStatus , VerifyResult } ;
33use ckb_jsonrpc_types:: { Block , BlockTemplate , Uint64 , Version } ;
44use ckb_logger:: { debug, error, warn} ;
55use ckb_network:: { NetworkController , PeerIndex , SupportProtocols , TargetSession } ;
@@ -271,10 +271,10 @@ impl MinerRpc for MinerRpcImpl {
271271 . verify ( & header)
272272 . map_err ( |err| handle_submit_error ( & work_id, & err) ) ?;
273273
274- let verify_result = self . chain . blocking_process_block ( Arc :: clone ( & block) ) ;
274+ let verify_result: VerifyResult = self . chain . blocking_process_block ( Arc :: clone ( & block) ) ;
275275
276- // TODO: need to consider every enum item of verify_result
277- let is_new = verify_result. is_ok ( ) ;
276+ // TODO: review this logic
277+ let is_new = matches ! ( verify_result, Ok ( VerifiedBlockStatus :: FirstSeenAndVerified ) ) ;
278278
279279 // Announce only new block
280280 if is_new {
Original file line number Diff line number Diff line change @@ -316,8 +316,7 @@ impl Relayer {
316316 let peer = peer. clone ( ) ;
317317 move |result : VerifyResult | match result {
318318 Ok ( verified_block_status) => match verified_block_status {
319- VerifiedBlockStatus :: FirstSeenAndVerified
320- | VerifiedBlockStatus :: FirstSeenButNotVerified => {
319+ VerifiedBlockStatus :: FirstSeenAndVerified => {
321320 match broadcast_compact_block_tx. send ( ( block, peer) ) {
322321 Err ( _) => {
323322 error ! (
You can’t perform that action at this time.
0 commit comments