Пример #1
0
        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;
        }
Пример #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)
 {
 }
Пример #3
0
        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;
        }
Пример #4
0
 public HeadersPayload(Block[] headers)
     : this(headers, true)
 {
 }
Пример #5
0
        public BlockPayload(Block block)
        {
            Block = block;

            ByteSize = Block.ByteSize;
        }