Skip to content

Commit c7b533d

Browse files
committed
f - Validate PoW on fetched blocks
1 parent 8ce91cc commit c7b533d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning-block-sync/src/poll.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ impl Validate for Block {
6464
type T = ValidatedBlock;
6565

6666
fn validate(self, block_hash: BlockHash) -> BlockSourceResult<Self::T> {
67+
self.header
68+
.validate_pow(&self.header.target())
69+
.or_else(|e| Err(BlockSourceError::persistent(e)))?;
70+
6771
if self.block_hash() != block_hash {
6872
return Err(BlockSourceError::persistent("invalid block hash"));
6973
}

0 commit comments

Comments
 (0)