Beispiel #1
0
 public static Tx Read(BitcoinStreamReader reader)
 {
     uint version = reader.ReadUInt32();
     TxIn[] inputs = reader.ReadArray(1024*1024, TxIn.Read);
     TxOut[] outputs = reader.ReadArray(1024*1024, TxOut.Read);
     uint lockTime = reader.ReadUInt32();
     return new Tx(version, inputs, outputs, lockTime);
 }
        public static BlockMessage Read(BitcoinStreamReader reader)
        {
            BlockHeader blockHeader = BlockHeader.Read(reader);

            //todo: see if there is actual limitation for this field
            Tx[] transactions = reader.ReadArray(1024 * 1024, Tx.Read);

            return new BlockMessage(blockHeader, transactions);
        }
 public static HeadersMessage Read(BitcoinStreamReader reader)
 {
     BlockHeader[] headers = reader.ReadArray(MaxHeadersPerMessage, r =>
     {
         BlockHeader header = BlockHeader.Read(r);
         ulong txCount = r.ReadUInt64Compact();
         if (txCount != 0)
         {
             throw new BitcoinNetworkException($"Invalid transaction count in {Command} message: {txCount}.");
         }
         return header;
     });
     return new HeadersMessage(headers);
 }
 public static AddrMessage Read(BitcoinStreamReader reader)
 {
     NetAddr[] addressList = reader.ReadArray(MaxAddressesPerMessage, NetAddr.Read);
     return new AddrMessage(addressList);
 }