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 1
1
use crate :: error:: RPCError ;
2
- use ckb_chain:: ChainController ;
2
+ use ckb_chain:: { ChainController , VerifiedBlockStatus , VerifyResult } ;
3
3
use ckb_jsonrpc_types:: { Block , BlockTemplate , Uint64 , Version } ;
4
4
use ckb_logger:: { debug, error, warn} ;
5
5
use ckb_network:: { NetworkController , PeerIndex , SupportProtocols , TargetSession } ;
@@ -271,10 +271,10 @@ impl MinerRpc for MinerRpcImpl {
271
271
. verify ( & header)
272
272
. map_err ( |err| handle_submit_error ( & work_id, & err) ) ?;
273
273
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) ) ;
275
275
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 ) ) ;
278
278
279
279
// Announce only new block
280
280
if is_new {
Original file line number Diff line number Diff line change @@ -316,8 +316,7 @@ impl Relayer {
316
316
let peer = peer. clone ( ) ;
317
317
move |result : VerifyResult | match result {
318
318
Ok ( verified_block_status) => match verified_block_status {
319
- VerifiedBlockStatus :: FirstSeenAndVerified
320
- | VerifiedBlockStatus :: FirstSeenButNotVerified => {
319
+ VerifiedBlockStatus :: FirstSeenAndVerified => {
321
320
match broadcast_compact_block_tx. send ( ( block, peer) ) {
322
321
Err ( _) => {
323
322
error ! (
You can’t perform that action at this time.
0 commit comments