@ -625,12 +625,6 @@ class Network(util.DaemonThread):
# Response is now in canonical form
# Response is now in canonical form
self . process_response ( interface , response , callbacks )
self . process_response ( interface , response , callbacks )
def addr_to_scripthash ( self , addr ) :
h = bitcoin . address_to_scripthash ( addr )
if h not in self . h2addr :
self . h2addr [ h ] = addr
return h
def overload_cb ( self , callback ) :
def overload_cb ( self , callback ) :
def cb2 ( x ) :
def cb2 ( x ) :
x2 = x . copy ( )
x2 = x . copy ( )
@ -641,12 +635,14 @@ class Network(util.DaemonThread):
return cb2
return cb2
def subscribe_to_addresses ( self , addresses , callback ) :
def subscribe_to_addresses ( self , addresses , callback ) :
hashes = [ self . addr_to_scripthash ( addr ) for addr in addresses ]
hash2address = { bitcoin . address_to_scripthash ( address ) : address for address in addresses }
msgs = [ ( ' blockchain.scripthash.subscribe ' , [ x ] ) for x in hashes ]
self . h2addr . update ( hash2address )
msgs = [ ( ' blockchain.scripthash.subscribe ' , [ x ] ) for x in hash2address . keys ( ) ]
self . send ( msgs , self . overload_cb ( callback ) )
self . send ( msgs , self . overload_cb ( callback ) )
def request_address_history ( self , address , callback ) :
def request_address_history ( self , address , callback ) :
h = self . addr_to_scripthash ( address )
h = bitcoin . address_to_scripthash ( address )
self . h2addr . update ( { h : address } )
self . send ( [ ( ' blockchain.scripthash.get_history ' , [ h ] ) ] , self . overload_cb ( callback ) )
self . send ( [ ( ' blockchain.scripthash.get_history ' , [ h ] ) ] , self . overload_cb ( callback ) )
def send ( self , messages , callback ) :
def send ( self , messages , callback ) :