Ejemplo n.º 1
0
        private static bool Fill(StealthMetadata output, Script metadata, byte[] data)
        {
            if (data == null || data.Length != 1 + 4 + 33)
            {
                return(false);
            }
            MemoryStream ms = new MemoryStream(data);

            output.Version = ms.ReadByte();
            if (output.Version != 6)
            {
                return(false);
            }
            output.Nonce    = ms.ReadBytes(4);
            output.EphemKey = new PubKey(ms.ReadBytes(33));
            output.Script   = metadata;
            output.Hash     = Hashes.Hash256(data);
            var msprefix = new MemoryStream(output.Hash.ToBytes(false));

            output.BitField = Utils.ToUInt32(msprefix.ReadBytes(4), true);
            return(true);
        }