Skip to content

Commit

Permalink
Merge pull request dogecoin#19 from JeremyRand/namecoin-fix-hash-veri…
Browse files Browse the repository at this point in the history
…fication

Fix verification bug in Namecoin.
  • Loading branch information
Ross Nicoll authored Mar 22, 2017
2 parents faadcca + 0237a50 commit 1419b81
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public Transaction getNameTransaction(String name, Sha256Hash blockHash, String
// The full block hasn't been verified in any way!
// So let's do that now.

if (! nameFullBlock.getHash().equals(blockHash)) {
throw new Exception("Block hash mismatch!");
}

// Now we know that the received block actually does have a header that matches the hash that we requested.
// However, that doesn't mean that the block's contents are valid.

final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class);
nameFullBlock.verify(-1, flags);

Expand Down

0 comments on commit 1419b81

Please sign in to comment.