Exemple #1
0
 private static bool Fill(StealthMetadata output, Script metadata)
 {
     byte[][] datas = _Template.ExtractScriptPubKeyParameters(metadata);
     if (datas == null)
     {
         return(false);
     }
     foreach (byte[] data in datas)
     {
         if (Fill(output, metadata, data))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
        private bool ReadScript(Script script)
        {
            try
            {
                var data = _Template.ExtractScriptPubKeyParameters(script);
                if (data == null)
                {
                    return(false);
                }
                BitcoinStream stream = new BitcoinStream(data);
                ushort        marker = 0;
                stream.ReadWrite(ref marker);
                if (marker != Tag)
                {
                    return(false);
                }
                stream.ReadWrite(ref _Version);
                if (_Version != 1)
                {
                    return(false);
                }

                ulong quantityCount = 0;
                stream.ReadWriteAsVarInt(ref quantityCount);
                Quantities = new ulong[quantityCount];

                for (ulong i = 0; i < quantityCount; i++)
                {
                    Quantities[i] = ReadLEB128(stream);
                    if (Quantities[i] > MAX_QUANTITY)
                    {
                        return(false);
                    }
                }

                stream.ReadWriteAsVarString(ref _Metadata);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }