BitSharp.Core.DataDecoder.DecodeBlockTxNode C# (CSharp) Method

DecodeBlockTxNode() public static method

public static DecodeBlockTxNode ( byte buffer, bool skipTxBytes = false ) : BlockTxNode
buffer byte
skipTxBytes bool
return BlockTxNode
        public static BlockTxNode DecodeBlockTxNode(byte[] buffer, bool skipTxBytes = false)
        {
            var offset = 0;
            var index = DecodeInt32(buffer, ref offset);
            var depth = DecodeInt32(buffer, ref offset);
            var hash = DecodeUInt256(buffer, ref offset);
            var pruned = DecodeBool(buffer, ref offset);

            ImmutableArray<byte>? txBytes;
            if (!skipTxBytes)
            {
                var bytesRemaining = buffer.Length - offset;
                txBytes = ImmutableArray.Create(buffer, offset, bytesRemaining);
            }
            else
                txBytes = null;

            return new BlockTxNode(index, depth, hash, pruned, txBytes);
        }