Browse Source

Pass raw=True when subscribing to headers

Remove use of deprecated bitcoin address
3.2.x
Neil Booth 7 years ago
parent
commit
b164cc4bba
  1. 3
      scripts/block_headers
  2. 5
      scripts/watch_address

3
scripts/block_headers

@ -21,7 +21,8 @@ if not network.is_connected():
# 2. send the subscription # 2. send the subscription
callback = lambda response: print_msg(json_encode(response.get('result'))) callback = lambda response: print_msg(json_encode(response.get('result')))
network.send([('blockchain.headers.subscribe',[])], callback) network.send([('server.version',["block_headers script", "1.2"])], callback)
network.send([('blockchain.headers.subscribe',[True])], callback)
# 3. wait for results # 3. wait for results
while network.is_connected(): while network.is_connected():

5
scripts/watch_address

@ -2,6 +2,7 @@
import sys import sys
import time import time
from electrum import bitcoin
from electrum import SimpleConfig, Network from electrum import SimpleConfig, Network
from electrum.util import print_msg, json_encode from electrum.util import print_msg, json_encode
@ -11,6 +12,8 @@ except Exception:
print("usage: watch_address <bitcoin_address>") print("usage: watch_address <bitcoin_address>")
sys.exit(1) sys.exit(1)
sh = bitcoin.address_to_scripthash(addr)
# start network # start network
c = SimpleConfig() c = SimpleConfig()
network = Network(c) network = Network(c)
@ -26,7 +29,7 @@ if not network.is_connected():
# 2. send the subscription # 2. send the subscription
callback = lambda response: print_msg(json_encode(response.get('result'))) callback = lambda response: print_msg(json_encode(response.get('result')))
network.send([('blockchain.address.subscribe',[addr])], callback) network.send([('blockchain.scripthash.subscribe',[sh])], callback)
# 3. wait for results # 3. wait for results
while network.is_connected(): while network.is_connected():

Loading…
Cancel
Save