mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +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 constants import FedpegConstants
|
||||
|
||||
from httplib import CannotSendRequest
|
||||
from httplib import CannotSendRequest, BadStatusLine
|
||||
import socket
|
||||
|
||||
settings = FedpegConstants()
|
||||
|
|
@ -39,6 +39,9 @@ def check_reset_connections():
|
|||
except CannotSendRequest as e:
|
||||
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||
connections_good = False
|
||||
except BadStatusLine as e:
|
||||
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||
connections_good = False
|
||||
except socket.timeout as e:
|
||||
sidechain[thread_id()] = AuthServiceProxy(settings.sidechain_url)
|
||||
connections_good = False
|
||||
|
|
@ -48,6 +51,9 @@ def check_reset_connections():
|
|||
except CannotSendRequest as e:
|
||||
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||
connections_good = False
|
||||
except BadStatusLine as e:
|
||||
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||
connections_good = False
|
||||
except socket.timeout as e:
|
||||
bitcoin[thread_id()] = AuthServiceProxy(settings.bitcoin_url)
|
||||
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):
|
||||
global donated_funds
|
||||
|
||||
check_reset_connections()
|
||||
|
||||
tx_raw = bitcoin[thread_id()].decoderawtransaction(tx_hex)
|
||||
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):
|
||||
for vout, output in enumerate(tx["vout"]):
|
||||
if output["scriptPubKey"]["type"] == "withdrawout":
|
||||
check_reset_connections()
|
||||
|
||||
outp = output["scriptPubKey"]["asm"].split(" ")
|
||||
check_raise(len(outp) == 16)
|
||||
|
||||
|
|
@ -578,6 +588,7 @@ try:
|
|||
print("done")
|
||||
|
||||
print("Step 2. Bitcoin blockchain scan for withdraws completed and coins to functionaries...")
|
||||
check_reset_connections()
|
||||
bitcoin_block_count = bitcoin[thread_id()].getblockcount()
|
||||
process_confirmed_bitcoin_blockchain(447000, bitcoin_block_count - 5)
|
||||
print("done")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue