From b164cc4bba25693daedbb4519ff90ef9967737ca Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 30 May 2018 13:53:19 +0800 Subject: [PATCH] Pass raw=True when subscribing to headers Remove use of deprecated bitcoin address --- scripts/block_headers | 3 ++- scripts/watch_address | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/block_headers b/scripts/block_headers index 82f6b100f..14ae918a9 100755 --- a/scripts/block_headers +++ b/scripts/block_headers @@ -21,7 +21,8 @@ if not network.is_connected(): # 2. send the subscription 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 while network.is_connected(): diff --git a/scripts/watch_address b/scripts/watch_address index 461e41863..a8446fc81 100755 --- a/scripts/watch_address +++ b/scripts/watch_address @@ -2,6 +2,7 @@ import sys import time +from electrum import bitcoin from electrum import SimpleConfig, Network from electrum.util import print_msg, json_encode @@ -11,6 +12,8 @@ except Exception: print("usage: watch_address ") sys.exit(1) +sh = bitcoin.address_to_scripthash(addr) + # start network c = SimpleConfig() network = Network(c) @@ -26,7 +29,7 @@ if not network.is_connected(): # 2. send the subscription 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 while network.is_connected():