OSDN Git Service

checkProofOfWork
authorjeason <jeason_ustc@.com>
Tue, 1 Aug 2017 08:23:45 +0000 (01:23 -0700)
committerjeason <jeason_ustc@.com>
Tue, 1 Aug 2017 08:23:45 +0000 (01:23 -0700)
rpc/core/generate.go

index 3210db5..2579e23 100644 (file)
@@ -64,3 +64,11 @@ func solveBlock(header *wire.BlockHeader, targetDifficulty *big.Int) bool {
 
        return false
 }
+
+func checkProofOfWork(header *wire.BlockHeader, targetDifficulty *big.Int) bool {
+     hash := hdr.BlockHash()
+     if wire.HashToBig(&hash).Cmp(targetDifficulty) <= 0 {
+             return true
+     }
+}
+