1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

update bitcore to insight in tx_api.py

This commit is contained in:
Pavol Rusnak 2014-12-02 03:58:26 +01:00
parent 608251bece
commit 87d3688ed7

View File

@ -51,7 +51,7 @@ def opcode_serialize(opcode):
except: except:
raise Exception('Unknown script opcode: %s' % opcode) raise Exception('Unknown script opcode: %s' % opcode)
def bitcore_tx(url): def insight_tx(url):
f = urllib2.urlopen(url) f = urllib2.urlopen(url)
data = json.load(f) data = json.load(f)
@ -66,8 +66,8 @@ def bitcore_tx(url):
i.prev_index = 0xffffffff # signed int -1 i.prev_index = 0xffffffff # signed int -1
i.script_sig = binascii.unhexlify(vin['coinbase']) i.script_sig = binascii.unhexlify(vin['coinbase'])
i.sequence = vin['sequence'] i.sequence = vin['sequence']
else: else:
i.prev_hash = binascii.unhexlify(vin['txid']) i.prev_hash = binascii.unhexlify(vin['txid'])
i.prev_index = vin['vout'] i.prev_index = vin['vout']
asm = vin['scriptSig']['asm'].split(' ') asm = vin['scriptSig']['asm'].split(' ')
@ -88,12 +88,12 @@ class TXAPIBitcoin(object):
@filecache(MONTH) @filecache(MONTH)
def get_tx(self, txhash): def get_tx(self, txhash):
url = 'http://live.bitcore.io/api/tx/%s' % txhash url = 'https://insight.bitpay.com/api/tx/%s' % txhash
return bitcore_tx(url) return insight_tx(url)
class TXAPITestnet(object): class TXAPITestnet(object):
@filecache(MONTH) @filecache(MONTH)
def get_tx(self, txhash): def get_tx(self, txhash):
url = 'http://test.bitcore.io/api/tx/%s' % txhash url = 'https://insight.bitpay.com/api/tx/%s' % txhash
return bitcore_tx(url) return insight_tx(url)