Browse Source

Subscribe to raw headers

The old interface is deprecated

Port of fe303c97c3
3.2.x
Neil Booth 7 years ago
parent
commit
1900e58e88
  1. 9
      lib/network.py

9
lib/network.py

@ -711,7 +711,7 @@ class Network(util.DaemonThread):
interface.mode = 'default' interface.mode = 'default'
interface.request = None interface.request = None
self.interfaces[server] = interface self.interfaces[server] = interface
self.queue_request('blockchain.headers.subscribe', [], interface) self.queue_request('blockchain.headers.subscribe', [True], interface)
if server == self.default_server: if server == self.default_server:
self.switch_to_interface(server) self.switch_to_interface(server)
#self.notify('interfaces') #self.notify('interfaces')
@ -983,10 +983,9 @@ class Network(util.DaemonThread):
self.stop_network() self.stop_network()
self.on_stop() self.on_stop()
def on_notify_header(self, interface, header): def on_notify_header(self, interface, header_dict):
height = header.get('block_height') header_hex, height = header_dict['hex'], header_dict['height']
if not height: header = blockchain.deserialize_header(bfh(header_hex), height)
return
if height < self.max_checkpoint(): if height < self.max_checkpoint():
self.connection_down(interface.server) self.connection_down(interface.server)
return return

Loading…
Cancel
Save