public GetBlockHeadersMessage Deserialize(byte[] bytes) { GetBlockHeadersMessage message = new GetBlockHeadersMessage(); Rlp.DecoderContext context = bytes.AsRlpContext(); context.ReadSequenceLength(); int position = context.Position; byte[] startingBytes = context.DecodeByteArray(); context.Position = position; if (startingBytes.Length == 32) { message.StartingBlockHash = context.DecodeKeccak(); } else { message.StartingBlockNumber = (long)context.DecodeUInt256(); } message.MaxHeaders = context.DecodeInt(); message.Skip = context.DecodeInt(); message.Reverse = context.DecodeNibble(); return(message); }