Ejemplo n.º 1
0
    def handle_inv(self, payload):
        count, payload = Bitcoin.unserialize_variable_int(payload)

        for i in range(count):
            inv, payload = Bitcoin.unserialize_inv(payload)

            if inv['type'] == BitcoinNetwork.MSG_ERROR:
                continue

            elif inv['type'] == BitcoinNetwork.MSG_TX:
                #print('got inv for tx {}'.format(Bitcoin.bytes_to_hexstring(inv['hash'])))
                self.known_transactions.add((inv['hash'], time.time()))

            elif inv['type'] == BitcoinNetwork.MSG_BLOCK:
                #print('got inv for block {}'.format(Bitcoin.bytes_to_hexstring(inv['hash'])))
                pass
Ejemplo n.º 2
0
    def handle_inv(self, payload):
        count, payload = Bitcoin.unserialize_variable_int(payload)

        for i in range(count):
            inv, payload = Bitcoin.unserialize_inv(payload)

            if inv['type'] == BitcoinNetwork.MSG_ERROR:
                continue

            elif inv['type'] == BitcoinNetwork.MSG_TX:
                #print('got inv for tx {}'.format(Bitcoin.bytes_to_hexstring(inv['hash'])))
                self.known_transactions.add((inv['hash'], time.time()))

            elif inv['type'] == BitcoinNetwork.MSG_BLOCK:
                #print('got inv for block {}'.format(Bitcoin.bytes_to_hexstring(inv['hash'])))
                pass