BitSharper.Block.CloneAsHeader C# (CSharp) Method

CloneAsHeader() public method

Returns a copy of the block, but without any transactions.
public CloneAsHeader ( ) : Block
return Block
        public Block CloneAsHeader()
        {
            var block = new Block(Params);
            block._nonce = _nonce;
            block._prevBlockHash = _prevBlockHash.Duplicate();
            block._merkleRoot = MerkleRoot.Duplicate();
            block._version = _version;
            block._time = _time;
            block._difficultyTarget = _difficultyTarget;
            block.Transactions = null;
            block._hash = Hash.Duplicate();
            return block;
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Creates a new StoredBlock, calculating the additional fields by adding to the values in this block.
        /// </summary>
        /// <exception cref="VerificationException"/>
        public StoredBlock Build(Block block)
        {
            // Stored blocks track total work done in this chain, because the canonical chain is the one that represents
            // the largest amount of work done not the tallest.
            var chainWork = _chainWork.Add(block.GetWork());
            var height    = _height + 1;

            return(new StoredBlock(block.CloneAsHeader(), chainWork, height));
        }
All Usage Examples Of BitSharper.Block::CloneAsHeader