From 984c961917b94ab2b71bee56e16881699d579e1c Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Thu, 2 Nov 2023 16:35:41 +1100 Subject: [PATCH] Load ChainMonitor in (DLC) Manager constructor if possible Otherwise we forget about all the registered transactions on restart, which can lead to loss of funds. --- dlc-manager/src/manager.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlc-manager/src/manager.rs b/dlc-manager/src/manager.rs index b4486674..9d5ee09b 100644 --- a/dlc-manager/src/manager.rs +++ b/dlc-manager/src/manager.rs @@ -177,6 +177,10 @@ where fee_estimator: F, ) -> Result { let init_height = blockchain.get_blockchain_height()?; + let chain_monitor = store + .get_chain_monitor()? + .unwrap_or(ChainMonitor::new(init_height)); + Ok(Manager { secp: secp256k1_zkp::Secp256k1::new(), wallet, @@ -185,7 +189,7 @@ where oracles, time, fee_estimator, - chain_monitor: ChainMonitor::new(init_height), + chain_monitor, }) }