From 72b50d63fcc75f53ff864820c115328bf5f6dec5 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sun, 20 Mar 2022 22:22:08 -0500 Subject: [PATCH] Add more logging to LND and Bitcoin updates --- rootfs/standard/var/pynode/bitcoin_info.py | 11 ++++++++--- rootfs/standard/var/pynode/lightning_info.py | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/rootfs/standard/var/pynode/bitcoin_info.py b/rootfs/standard/var/pynode/bitcoin_info.py index 2d369154..de61df8f 100644 --- a/rootfs/standard/var/pynode/bitcoin_info.py +++ b/rootfs/standard/var/pynode/bitcoin_info.py @@ -72,7 +72,7 @@ def update_bitcoin_main_info(): bitcoin_blockchain_info = info except Exception as e: - log_message("ERROR: In update_bitcoin_info - {}".format( str(e) )) + log_message("ERROR: In update_bitcoin_info - {} DATA: {}".format( str(e), str(info) )) return False update_bitcoin_json_cache() @@ -110,6 +110,7 @@ def update_bitcoin_other_info(): bitcoin_recent_blocks_last_cache_height = mynode_block_height # Get peers and cleanup data + log_message("update_bitcoin_other_info - PEERS") peerdata = rpc_connection.getpeerinfo() peers = [] if peerdata != None: @@ -127,6 +128,7 @@ def update_bitcoin_other_info(): bitcoin_peers = peers # Get network info + log_message("update_bitcoin_other_info - NETWORK") network_data = rpc_connection.getnetworkinfo() if network_data != None: network_data["relayfee"] = str(network_data["relayfee"]) @@ -134,6 +136,7 @@ def update_bitcoin_other_info(): bitcoin_network_info = network_data # Get mempool + log_message("update_bitcoin_other_info - MEMPOOL") mempool_data = rpc_connection.getmempoolinfo() if mempool_data != None: mempool_data["total_fee"] = str(mempool_data["total_fee"]) @@ -142,6 +145,7 @@ def update_bitcoin_other_info(): bitcoin_mempool = mempool_data # Get wallet info + log_message("update_bitcoin_other_info - WALLETS") wallets = rpc_connection.listwallets() wallet_data = [] for w in wallets: @@ -157,6 +161,7 @@ def update_bitcoin_other_info(): bitcoin_wallets = wallet_data # Get recommended fee info (from mempool on port 4080) + log_message("update_bitcoin_other_info - MEMPOOL") if is_service_enabled("mempool"): try: r = requests.get("http://localhost:4080/api/v1/fees/recommended", timeout=1) @@ -172,10 +177,10 @@ def update_bitcoin_other_info(): else: bitcoin_recommended_fees = None except Exception as e1: - log_message("ERROR: In update_bitcoin_other_info - {}".format( str(e1) )) + log_message("ERROR: In update_bitcoin_other_info (1) - {} DATA: {}".format( str(e1), str() )) except Exception as e2: - log_message("ERROR: In update_bitcoin_other_info - {}".format( str(e2) )) + log_message("ERROR: In update_bitcoin_other_info (2) - {} DATA: {}".format( str(e2), str() )) return False update_bitcoin_json_cache() diff --git a/rootfs/standard/var/pynode/lightning_info.py b/rootfs/standard/var/pynode/lightning_info.py index 63fcc624..98f78e0a 100644 --- a/rootfs/standard/var/pynode/lightning_info.py +++ b/rootfs/standard/var/pynode/lightning_info.py @@ -99,16 +99,20 @@ def update_lightning_info(): return True if lnd_ready: + log_message("update_lightning_info - LND READY") if lightning_desync_count > 0: os.system("printf \"%s | De-sync greater than 0 (was {}), but now synced! Setting to 0. \\n\" \"$(date)\" >> /tmp/lnd_failures".format(lightning_desync_count)) lightning_desync_count = 0 + log_message("update_lightning_info - GET PEERS, CHANNELS, BALANCE, WALLET") lightning_peers = lnd_get("/peers") lightning_channels = lnd_get("/channels") lightning_channel_balance = lnd_get("/balance/channels") lightning_wallet_balance = lnd_get("/balance/blockchain") + log_message("update_lightning_info - GET WATCHTOWER") if is_watchtower_enabled(): lightning_watchtower_server_info = lnd_get_v2("/watchtower/server") towers = lnd_get_v2("/watchtower/client?include_sessions=1") + log_message("update_lightning_info - TOWER DETAILS") tower_details = [] if towers != None and "towers" in towers: for tower in towers["towers"]: @@ -118,11 +122,13 @@ def update_lightning_info(): tower["pubkey_b16"] = pubkey_b16 tower_details.append(tower) lightning_watchtower_client_towers = tower_details + log_message("update_lightning_info - GET CLIENT STATS, POLICY") lightning_watchtower_client_stats = lnd_get_v2("/watchtower/client/stats") lightning_watchtower_client_policy = lnd_get_v2("/watchtower/client/policy") # Poll slower (make sure we gather data early) if lightning_update_count < 30 or lightning_update_count % 2 == 0: + log_message("update_lightning_info - GET TX INFO") update_lightning_tx_info() update_lightning_json_cache()