mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Add some additional error handling in ww for slow bitcoinds
This commit is contained in:
parent
b2b76c9cb9
commit
c71c2ab07f
1 changed files with 12 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ from threading import Lock, current_thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from constants import FedpegConstants
|
from constants import FedpegConstants
|
||||||
|
|
||||||
from httplib import CannotSendRequest
|
from httplib import CannotSendRequest, BadStatusLine
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
settings = FedpegConstants()
|
settings = FedpegConstants()
|
||||||
|
|
@ -39,6 +39,9 @@ def check_reset_connections():
|
||||||
except CannotSendRequest as e:
|
except CannotSendRequest as e:
|
||||||
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||||
connections_good = False
|
connections_good = False
|
||||||
|
except BadStatusLine as e:
|
||||||
|
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||||
|
connections_good = False
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||||
connections_good = False
|
connections_good = False
|
||||||
|
|
@ -48,6 +51,9 @@ def check_reset_connections():
|
||||||
except CannotSendRequest as e:
|
except CannotSendRequest as e:
|
||||||
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||||
connections_good = False
|
connections_good = False
|
||||||
|
except BadStatusLine as e:
|
||||||
|
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||||
|
connections_good = False
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||||
connections_good = False
|
connections_good = False
|
||||||
|
|
@ -138,6 +144,8 @@ def process_bitcoin_tx_for_utxos(tx, is_donation=False, manual_check=False):
|
||||||
def sign_withdraw_tx(tx_hex, txid_concat_list):
|
def sign_withdraw_tx(tx_hex, txid_concat_list):
|
||||||
global donated_funds
|
global donated_funds
|
||||||
|
|
||||||
|
check_reset_connections()
|
||||||
|
|
||||||
tx_raw = bitcoin[thread_id()].decoderawtransaction(tx_hex)
|
tx_raw = bitcoin[thread_id()].decoderawtransaction(tx_hex)
|
||||||
max_sidechain_height = sidechain[thread_id()].getblockcount() - 6
|
max_sidechain_height = sidechain[thread_id()].getblockcount() - 6
|
||||||
|
|
||||||
|
|
@ -362,6 +370,8 @@ class WatchPeerController(RotatingConsensus):
|
||||||
def process_sidechain_tx_for_utxos(tx, height, avoid_rescans):
|
def process_sidechain_tx_for_utxos(tx, height, avoid_rescans):
|
||||||
for vout, output in enumerate(tx["vout"]):
|
for vout, output in enumerate(tx["vout"]):
|
||||||
if output["scriptPubKey"]["type"] == "withdrawout":
|
if output["scriptPubKey"]["type"] == "withdrawout":
|
||||||
|
check_reset_connections()
|
||||||
|
|
||||||
outp = output["scriptPubKey"]["asm"].split(" ")
|
outp = output["scriptPubKey"]["asm"].split(" ")
|
||||||
check_raise(len(outp) == 16)
|
check_raise(len(outp) == 16)
|
||||||
|
|
||||||
|
|
@ -578,6 +588,7 @@ try:
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
print("Step 2. Bitcoin blockchain scan for withdraws completed and coins to functionaries...")
|
print("Step 2. Bitcoin blockchain scan for withdraws completed and coins to functionaries...")
|
||||||
|
check_reset_connections()
|
||||||
bitcoin_block_count = bitcoin[thread_id()].getblockcount()
|
bitcoin_block_count = bitcoin[thread_id()].getblockcount()
|
||||||
process_confirmed_bitcoin_blockchain(447000, bitcoin_block_count - 5)
|
process_confirmed_bitcoin_blockchain(447000, bitcoin_block_count - 5)
|
||||||
print("done")
|
print("done")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue