Exemple #1
0
        public Message ParseMessage(byte[] bytes, ProtocolVersion version = ProtocolVersion.PROTOCOL_VERSION)
        {
            BitcoinStream bstream = new BitcoinStream(bytes);
            Message       message = new Message();

            using (bstream.ProtocolVersionScope(version))
            {
                bstream.ReadWrite(ref message);
            }
            if (message.Magic != magic)
            {
                throw new FormatException("Unexpected magic field in the message");
            }
            return(message);
        }