From 285e70d01a9d378c19f41685078f5b8d66aa9ef3 Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Fri, 1 Sep 2023 16:55:48 +1000 Subject: [PATCH 1/3] chore(app): Catch exception thrown when setting up Firebase It looks less scary this way, as the app does work after this happens. --- mobile/lib/main.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 8dfa2c0d7..276e3531e 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -223,13 +223,16 @@ class _TenTenOneAppState extends State { init(config); WidgetsBinding.instance.addPostFrameCallback((_) async { - await initFirebase(); - await requestNotificationPermission(); - final flutterLocalNotificationsPlugin = initLocalNotifications(); - await configureFirebase(flutterLocalNotificationsPlugin); + try { + await initFirebase(); + await requestNotificationPermission(); + final flutterLocalNotificationsPlugin = initLocalNotifications(); + await configureFirebase(flutterLocalNotificationsPlugin); + } catch (e) { + FLog.error(text: "Error setting up Firebase: ${e.toString()}"); + } PackageInfo packageInfo = await PackageInfo.fromPlatform(); - final messenger = scaffoldMessengerKey.currentState!; try { From c050e00721779ff54af996f15a4c9b60b320a19c Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Fri, 1 Sep 2023 17:05:16 +1000 Subject: [PATCH 2/3] chore(app): Pre-fill invoice amount on regtest It speeds up manual testing! --- mobile/lib/features/wallet/create_invoice_screen.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/lib/features/wallet/create_invoice_screen.dart b/mobile/lib/features/wallet/create_invoice_screen.dart index 730fcf0dc..9b62f6c7f 100644 --- a/mobile/lib/features/wallet/create_invoice_screen.dart +++ b/mobile/lib/features/wallet/create_invoice_screen.dart @@ -1,6 +1,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:get_10101/bridge_generated/bridge_definitions.dart' as bridge; import 'package:get_10101/common/amount_text.dart'; import 'package:get_10101/common/amount_text_input_form_field.dart'; import 'package:get_10101/common/application/channel_info_service.dart'; @@ -57,6 +58,10 @@ class _CreateInvoiceScreenState extends State { void initState() { final ChannelInfoService channelInfoService = context.read(); initChannelInfo(channelInfoService); + + final bridge.Config config = context.read(); + amount = config.network == "regtest" ? Amount(100000) : null; + super.initState(); } From c3c44008ae1201656cd240147937df248211da6b Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Fri, 1 Sep 2023 17:06:56 +1000 Subject: [PATCH 3/3] chore: Remove parking_lot deadlock_detection feature We were using up a dedicated thread just for this and we know we have limited resources on the phone. We should add this code locally if we ever suspect there is a problem with deadlocks. --- coordinator/Cargo.toml | 1 - crates/ln-dlc-node/Cargo.toml | 2 +- crates/ln-dlc-node/src/node/mod.rs | 21 --------------------- mobile/native/Cargo.toml | 2 +- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index 34b02ba47..f494e391a 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -77,7 +77,6 @@ path = "../crates/orderbook-commons" [dependencies.parking_lot] version = "0.12.1" -features = ["deadlock_detection"] [dependencies.rust_decimal] version = "1" diff --git a/crates/ln-dlc-node/Cargo.toml b/crates/ln-dlc-node/Cargo.toml index 5de882f91..e0c77d520 100644 --- a/crates/ln-dlc-node/Cargo.toml +++ b/crates/ln-dlc-node/Cargo.toml @@ -30,7 +30,7 @@ lightning-persister = { version = "0.0.114" } lightning-transaction-sync = { version = "0.0.114", features = ["esplora-blocking"] } log = "0.4.17" p2pd-oracle-client = { version = "0.1.0" } -parking_lot = { version = "0.12.1", features = ["deadlock_detection"] } +parking_lot = { version = "0.12.1" } rand = "0.8.5" reqwest = { version = "0.11", default-features = false, features = ["json"] } rust-bitcoin-coin-selection = { version = "0.1.0", features = ["rand"] } diff --git a/crates/ln-dlc-node/src/node/mod.rs b/crates/ln-dlc-node/src/node/mod.rs index bdd00bcc6..f1e226dc5 100644 --- a/crates/ln-dlc-node/src/node/mod.rs +++ b/crates/ln-dlc-node/src/node/mod.rs @@ -486,8 +486,6 @@ where self.keys_manager.clone(), )); - std::thread::spawn(monitor_for_deadlocks()); - tracing::info!("Lightning node started with node ID {}", self.info); Ok(RunningNode { _handles: handles }) @@ -573,25 +571,6 @@ fn spawn_background_processor( remote_handle } -/// Parking lot mutexes have the ability to mark deadlocks. -/// -/// Take advantage of this behaviour and log deadlocks when they occur. -fn monitor_for_deadlocks() -> impl Fn() { - move || loop { - let deadlocks = parking_lot::deadlock::check_deadlock(); - - for (i, threads) in deadlocks.iter().enumerate() { - tracing::error!(%i, "Deadlock detected"); - for t in threads { - tracing::error!(thread_id = %t.thread_id()); - tracing::error!("{:#?}", t.backtrace()); - } - } - - std::thread::sleep(Duration::from_secs(10)); - } -} - async fn lightning_wallet_sync( channel_manager: Arc, chain_monitor: Arc, diff --git a/mobile/native/Cargo.toml b/mobile/native/Cargo.toml index e6c7dfdd6..9bf3f788f 100644 --- a/mobile/native/Cargo.toml +++ b/mobile/native/Cargo.toml @@ -26,7 +26,7 @@ ln-dlc-node = { path = "../../crates/ln-dlc-node" } openssl = { version = "0.10.55", features = ["vendored"] } orderbook-client = { path = "../../crates/orderbook-client" } orderbook-commons = { path = "../../crates/orderbook-commons" } -parking_lot = { version = "0.12.1", features = ["deadlock_detection"] } +parking_lot = { version = "0.12.1" } reqwest = { version = "0.11", default-features = false, features = ["json"] } rust_decimal = { version = "1", features = ["serde-with-float"] } serde = { version = "1.0.152", features = ["serde_derive"] }