File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,11 @@ impl Validate for BlockHeaderData {
59
59
type T = ValidatedBlockHeader ;
60
60
61
61
fn validate ( self , block_hash : BlockHash ) -> BlockSourceResult < Self :: T > {
62
- self . header
62
+ let pow_valid_block_hash = self . header
63
63
. validate_pow ( & self . header . target ( ) )
64
64
. or_else ( |e| Err ( BlockSourceError :: persistent ( e) ) ) ?;
65
65
66
- // TODO: Use the result of validate_pow instead of recomputing the block hash once upstream.
67
- if self . header . block_hash ( ) != block_hash {
66
+ if pow_valid_block_hash != block_hash {
68
67
return Err ( BlockSourceError :: persistent ( "invalid block hash" ) ) ;
69
68
}
70
69
@@ -76,12 +75,11 @@ impl Validate for Block {
76
75
type T = ValidatedBlock ;
77
76
78
77
fn validate ( self , block_hash : BlockHash ) -> BlockSourceResult < Self :: T > {
79
- self . header
78
+ let pow_valid_block_hash = self . header
80
79
. validate_pow ( & self . header . target ( ) )
81
80
. or_else ( |e| Err ( BlockSourceError :: persistent ( e) ) ) ?;
82
81
83
- // TODO: Use the result of validate_pow instead of recomputing the block hash once upstream.
84
- if self . block_hash ( ) != block_hash {
82
+ if pow_valid_block_hash != block_hash {
85
83
return Err ( BlockSourceError :: persistent ( "invalid block hash" ) ) ;
86
84
}
87
85
You can’t perform that action at this time.
0 commit comments