Fixing exchanges and block explorer for FLO
This commit is contained in:
parent
c0daef2657
commit
1e6edd0abc
@ -182,7 +182,7 @@ class Blockchain(util.PrintError):
|
|||||||
raise Exception("prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')))
|
raise Exception("prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')))
|
||||||
if constants.net.TESTNET:
|
if constants.net.TESTNET:
|
||||||
return
|
return
|
||||||
print("I'm inside verify_header")
|
#print("I'm inside verify_header")
|
||||||
#bits = self.target_to_bits(target)
|
#bits = self.target_to_bits(target)
|
||||||
bits = target
|
bits = target
|
||||||
if bits != header.get('bits'):
|
if bits != header.get('bits'):
|
||||||
@ -191,18 +191,19 @@ class Blockchain(util.PrintError):
|
|||||||
target_val = self.bits_to_target(bits)
|
target_val = self.bits_to_target(bits)
|
||||||
if int('0x' + _powhash, 16) > target_val:
|
if int('0x' + _powhash, 16) > target_val:
|
||||||
raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target_val))
|
raise Exception("insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target_val))
|
||||||
print("I passed verify_header(). Calc target values have been matched")
|
#print("I passed verify_header(). Calc target values have been matched")
|
||||||
|
|
||||||
def verify_chunk(self, index, data):
|
def verify_chunk(self, index, data):
|
||||||
num = len(data) // 80
|
num = len(data) // 80
|
||||||
current_header = (index * 2016)
|
current_header = (index * 2016)
|
||||||
# last = (index * 2016 + 2015)
|
# last = (index * 2016 + 2015)
|
||||||
|
print(index*2016)
|
||||||
prev_hash = self.get_hash(current_header - 1)
|
prev_hash = self.get_hash(current_header - 1)
|
||||||
for i in range(num):
|
for i in range(num):
|
||||||
target = self.get_target(current_header - 1)
|
target = self.get_target(current_header - 1)
|
||||||
raw_header = data[i*80:(i+1) * 80]
|
raw_header = data[i*80:(i+1) * 80]
|
||||||
header = deserialize_header(raw_header, current_header)
|
header = deserialize_header(raw_header, current_header)
|
||||||
print(i)
|
#print(i)
|
||||||
self.verify_header(header, prev_hash, target)
|
self.verify_header(header, prev_hash, target)
|
||||||
self.save_chunk_part(header)
|
self.save_chunk_part(header)
|
||||||
prev_hash = hash_header(header)
|
prev_hash = hash_header(header)
|
||||||
|
|||||||
@ -357,7 +357,7 @@
|
|||||||
"Bitvalor": [
|
"Bitvalor": [
|
||||||
"BRL"
|
"BRL"
|
||||||
],
|
],
|
||||||
"BlockchainInfo": [
|
"Bittrex": [
|
||||||
"AUD",
|
"AUD",
|
||||||
"BRL",
|
"BRL",
|
||||||
"CAD",
|
"CAD",
|
||||||
|
|||||||
@ -208,11 +208,13 @@ class Bitvalor(ExchangeBase):
|
|||||||
return {'BRL': Decimal(json['ticker_1h']['total']['last'])}
|
return {'BRL': Decimal(json['ticker_1h']['total']['last'])}
|
||||||
|
|
||||||
|
|
||||||
class BlockchainInfo(ExchangeBase):
|
class Bittrex(ExchangeBase):
|
||||||
|
|
||||||
def get_rates(self, ccy):
|
def get_rates(self, ccy):
|
||||||
|
json = self.get_json('bittrex.com','/api/v1.1/public/getticker?market=BTC-FLO')
|
||||||
|
floPrice_inBTC = json['result']['Last']
|
||||||
json = self.get_json('blockchain.info', '/ticker')
|
json = self.get_json('blockchain.info', '/ticker')
|
||||||
return dict([(r, Decimal(json[r]['15m'])) for r in json])
|
return dict([(r, Decimal(json[r]['15m'] * floPrice_inBTC)) for r in json])
|
||||||
|
|
||||||
|
|
||||||
class BTCChina(ExchangeBase):
|
class BTCChina(ExchangeBase):
|
||||||
|
|||||||
@ -584,43 +584,17 @@ def time_difference(distance_in_time, include_seconds):
|
|||||||
return "over %d years" % (round(distance_in_minutes / 525600))
|
return "over %d years" % (round(distance_in_minutes / 525600))
|
||||||
|
|
||||||
mainnet_block_explorers = {
|
mainnet_block_explorers = {
|
||||||
'Biteasy.com': ('https://www.biteasy.com/blockchain/',
|
'Florincoin.info': ('https://florincoin.info/',
|
||||||
{'tx': 'transactions/', 'addr': 'addresses/'}),
|
{'tx': 'transactions/', 'addr': 'address/'}),
|
||||||
'Bitflyer.jp': ('https://chainflyer.bitflyer.jp/',
|
|
||||||
{'tx': 'Transaction/', 'addr': 'Address/'}),
|
|
||||||
'Blockchain.info': ('https://blockchain.info/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'blockchainbdgpzk.onion': ('https://blockchainbdgpzk.onion/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'Blockr.io': ('https://btc.blockr.io/',
|
|
||||||
{'tx': 'tx/info/', 'addr': 'address/info/'}),
|
|
||||||
'Blocktrail.com': ('https://www.blocktrail.com/BTC/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'BTC.com': ('https://chain.btc.com/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'Chain.so': ('https://www.chain.so/',
|
|
||||||
{'tx': 'tx/BTC/', 'addr': 'address/BTC/'}),
|
|
||||||
'Insight.is': ('https://insight.bitpay.com/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'TradeBlock.com': ('https://tradeblock.com/blockchain/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'BlockCypher.com': ('https://live.blockcypher.com/btc/',
|
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
|
||||||
'Blockchair.com': ('https://blockchair.com/bitcoin/',
|
|
||||||
{'tx': 'transaction/', 'addr': 'address/'}),
|
|
||||||
'blockonomics.co': ('https://www.blockonomics.co/',
|
|
||||||
{'tx': 'api/tx?txid=', 'addr': '#/search?q='}),
|
|
||||||
'OXT.me': ('https://oxt.me/',
|
|
||||||
{'tx': 'transaction/', 'addr': 'address/'}),
|
|
||||||
'system default': ('blockchain:/',
|
'system default': ('blockchain:/',
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
{'tx': 'tx/', 'addr': 'address/'})
|
||||||
}
|
}
|
||||||
|
|
||||||
testnet_block_explorers = {
|
testnet_block_explorers = {
|
||||||
'Blocktrail.com': ('https://www.blocktrail.com/tBTC/',
|
'testnet.Florincoin.info': ('https://testnet.florincoin.info/',
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
{'tx': 'transactions/', 'addr': 'address/'}),
|
||||||
'system default': ('blockchain://000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943/',
|
'system default': ('blockchain://000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943/',
|
||||||
{'tx': 'tx/', 'addr': 'address/'}),
|
{'tx': 'tx/', 'addr': 'address/'})
|
||||||
}
|
}
|
||||||
|
|
||||||
def block_explorer_info():
|
def block_explorer_info():
|
||||||
@ -628,7 +602,7 @@ def block_explorer_info():
|
|||||||
return testnet_block_explorers if constants.net.TESTNET else mainnet_block_explorers
|
return testnet_block_explorers if constants.net.TESTNET else mainnet_block_explorers
|
||||||
|
|
||||||
def block_explorer(config):
|
def block_explorer(config):
|
||||||
return config.get('block_explorer', 'Blocktrail.com')
|
return config.get('block_explorer', 'Florincoin.info')
|
||||||
|
|
||||||
def block_explorer_tuple(config):
|
def block_explorer_tuple(config):
|
||||||
return block_explorer_info().get(block_explorer(config))
|
return block_explorer_info().get(block_explorer(config))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user