コード例 #1
0
 def test_target_mismatch(self):
     with self.assertRaises(Exception):
         other_target = Blockchain.bits_to_target(0x1d00eeee)
         Blockchain.verify_header(self.header, self.prev_hash, other_target)
コード例 #2
0
 def test_prev_hash_mismatch(self):
     with self.assertRaises(Exception):
         Blockchain.verify_header(self.header, "foo", self.target)
コード例 #3
0
 def test_valid_header(self):
     Blockchain.verify_header(self.header, self.prev_hash, self.target)
コード例 #4
0
 def test_expected_hash_mismatch(self):
     with self.assertRaises(Exception):
         Blockchain.verify_header(self.header,
                                  self.prev_hash,
                                  self.target,
                                  expected_header_hash="foo")
コード例 #5
0
 def test_insufficient_pow(self):
     with self.assertRaises(Exception):
         self.header["nonce"] = 100
         Blockchain.verify_header(self.header, self.prev_hash, self.target)