public HeadersPayload(Block[] headers, bool autoConvertBlocksToHeaders)
        {
            if (autoConvertBlocksToHeaders)
            {
                headers = (from b in headers select b.ConvertToBlockHeader()).ToArray();
            }
            Headers = new VarArray<Block>(headers);

            ByteSize = Headers.ByteSize;
        }
Beispiel #2
0
 public Block(Block block, bool convertToHeader)
     : this(block.Version,
            block.PreviousBlock,
            block.MerkleRoot,
            block.Timestamp,
            block.Bits,
            block.Nonce,
            convertToHeader ? VarArray<Tx>.Empty : block.Transactions)
 {
 }
        public BlockPayload(byte[] buffer, int offset)
            : base(buffer, offset)
        {
            Contract.Requires<ArgumentNullException>(buffer != null, "buffer");
            Contract.Requires<ArgumentException>(buffer.Length >= BlockPayload.MinimumByteSize, "buffer");
            Contract.Requires<ArgumentOutOfRangeException>(offset >= 0, "offset");
            Contract.Requires<ArgumentOutOfRangeException>(offset <= buffer.Length - BlockPayload.MinimumByteSize, "offset");

            Block = new Block(buffer, offset);

            ByteSize = Block.ByteSize;
        }
 public HeadersPayload(Block[] headers)
     : this(headers, true)
 {
 }
        public BlockPayload(Block block)
        {
            Block = block;

            ByteSize = Block.ByteSize;
        }