Exemplo n.º 1
0
        public static NetAddr FromStream(Stream s)
        {
            NetAddr x = new NetAddr();

            x.Read(s);
            return(x);
        }
Exemplo n.º 2
0
        public void Read(Stream s)
        {
            BinaryReader br = new BinaryReader(s);

            addr_list = new TimeNetAddr[VarInt.FromStream(s)];
            for (int i = 0; i < addr_list.Length; i++)
            {
                addr_list[i].time     = br.ReadUInt32();
                addr_list[i].net_addr = NetAddr.FromStream(s);
            }
        }
Exemplo n.º 3
0
        public void Read(Stream s)
        {
            BinaryReader br = new BinaryReader(s);

            version      = br.ReadInt32();
            services     = (Services)br.ReadUInt64();
            timestamp    = br.ReadInt64();
            addr_recv    = NetAddr.FromStream(s);
            addr_from    = NetAddr.FromStream(s);
            nonce        = br.ReadUInt64();
            user_agent   = VarStr.FromStream(s);
            start_height = br.ReadInt32();
        }
Exemplo n.º 4
0
        public static Version Default(NetAddr addr_recv, NetAddr addr_from, Int32 start_height)
        {
            Random rand       = new Random();
            String user_agent = "/Bitcoin-Tool:" +
                                Assembly.GetExecutingAssembly().GetName().Version.ToString() + "/";

            Version v = new Version();

            v.version      = 60001;
            v.services     = Services.NODE_NETWORK;
            v.timestamp    = UnixTimestamp.Now;
            v.addr_recv    = addr_recv;
            v.addr_from    = addr_from;
            v.nonce        = (((UInt64)rand.Next()) << 32) | (UInt32)rand.Next();
            v.user_agent   = new VarStr(user_agent);
            v.start_height = start_height;
            return(v);
        }