Example #1
0
        public BlockHeader(uint version, uint256 prev_block_hash, uint256 merkle_root_hash, uint timestamp, Target bits, uint nonce)
        {
            if(prev_block_hash == null) throw new ArgumentNullException("prev_block_hash");
            if(merkle_root_hash == null) throw new ArgumentNullException("merkle_root_hash");
            if(bits == null) throw new ArgumentNullException("bits");

            Version = version;
            PrevBlockHash = prev_block_hash;
            MerkleRootHash = merkle_root_hash;
            Timestamp = timestamp;
            Bits = bits;
            Nonce = nonce;
        }
Example #2
0
 public void CalculateDifficulty(int bits, double difficulty)
 {
     var target = new Target(bits);
     Assert.That(target.Difficulty, Is.EqualTo(difficulty).Within(.00005));
 }