示例#1
0
文件: relay.py 项目: daedalus/relaytx
def getVersionMsg():
    version = 60002
    services = 1
    timestamp = int(time.time())
    addr_me = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)
    addr_you = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)
    
    nonce = random.getrandbits(64)
    sub_version_num = utils.varstr('')
    start_height = 0
 
    payload = struct.pack('<LQQ26s26sQsL', version, services, timestamp, addr_me,
        addr_you, nonce, sub_version_num, start_height)
    return makeMessage(magic, 'version', payload)
示例#2
0
def getVersionMsg():
    version = 70002
    services = 1
    timestamp = int(time.time())
    addr_me = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)
    addr_you = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)

    nonce = random.getrandbits(64)
    sub_version_num = utils.varstr('')
    start_height = 0

    payload = struct.pack('<LQQ26s26sQsL', version, services, timestamp,
                          addr_me, addr_you, nonce, sub_version_num,
                          start_height)
    return makeMessage(magic, 'version', payload)
示例#3
0
def getVersionMsg():
    # version(4), services(8), timestamp(8), addr_me(26), addr_you(26), nonce(8)
    # sub_version_num (var_str), start_height(4)
    version = 60002
    services = 1
    timestamp = int(time.time())
    #addr_me = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)
    #addr_you = utils.netaddr(socket.inet_aton("127.0.0.1"), 8333)
    addr_me = utils.netaddr(socket.inet_aton("127.0.0.1"), 19000)
    addr_you = utils.netaddr(socket.inet_aton("127.0.0.1"), 19001)
    nonce = random.getrandbits(64)
    sub_version_num = utils.varstr(b'')
    start_height = 0

    payload = struct.pack('<LQQ26s26sQsL', version, services, timestamp,
                          addr_me, addr_you, nonce, sub_version_num,
                          start_height)
    return makeMessage(magic, 'version', payload)
示例#4
0
def getVersionMsg():
    # version = 60002
    version = 70015
    services = 0
    timestamp = int(time.time())
    addr_me = utils.netaddr(socket.inet_aton("127.0.0.1"), 18444)
    addr_you = utils.netaddr(socket.inet_aton("127.0.0.1"), 18444)
    nonce = random.getrandbits(64)
    # sub_version_num = utils.varstr('')
    user_agent_bytes = 0
    start_height = 0
    relay = True

    # print ["addr_me", addr_me]

    payload = struct.pack('<iQQ26s26sQBi?', version, services, timestamp,
                          addr_me, addr_you, nonce, user_agent_bytes,
                          start_height, relay)
    return makeMessage(magic, 'version', payload)