Skip to content

Commit ff5344a

Browse files
post cleanup
1 parent 9023c5d commit ff5344a

File tree

4 files changed

+5
-104
lines changed

4 files changed

+5
-104
lines changed

src/bitcoind_client.rs

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,6 @@ impl BitcoindClient {
153153
fees.get(&Target::HighPriority)
154154
.unwrap()
155155
.store(high_prio_estimate, Ordering::Release);
156-
// match fees.get(Target::Background) {
157-
// Some(fee) => fee.store(background_estimate, Ordering::Release),
158-
// None =>
159-
// }
160-
// if let Some(fee) = background_estimate.feerate {
161-
// fees.get("background").unwrap().store(fee, Ordering::Release);
162-
// }
163-
// if let Some(fee) = normal_estimate.feerate {
164-
// fees.get("normal").unwrap().store(fee, Ordering::Release);
165-
// }
166-
// if let Some(fee) = high_prio_estimate.feerate {
167-
// fees.get("high_prio").unwrap().store(fee, Ordering::Release);
168-
// }
169156
tokio::time::sleep(Duration::from_secs(60)).await;
170157
}
171158
});
@@ -235,43 +222,6 @@ impl FeeEstimator for BitcoindClient {
235222
self.fees.get(&Target::HighPriority).unwrap().load(Ordering::Acquire)
236223
}
237224
}
238-
// self.fees.g
239-
// 253
240-
// match confirmation_target {
241-
// ConfirmationTarget::Background =>
242-
// }
243-
// let mut rpc = self.bitcoind_rpc_client.lock().unwrap();
244-
245-
// let (conf_target, estimate_mode, default) = match confirmation_target {
246-
// ConfirmationTarget::Background => (144, "ECONOMICAL", 253),
247-
// ConfirmationTarget::Normal => (18, "ECONOMICAL", 20000),
248-
// ConfirmationTarget::HighPriority => (6, "CONSERVATIVE", 50000),
249-
// };
250-
251-
// // This function may be called from a tokio runtime, or not. So we need to check before
252-
// // making the call to avoid the error "cannot run a tokio runtime from within a tokio runtime".
253-
// let conf_target_json = serde_json::json!(conf_target);
254-
// let estimate_mode_json = serde_json::json!(estimate_mode);
255-
// let resp = match Handle::try_current() {
256-
// Ok(_) => tokio::task::block_in_place(|| {
257-
// runtime
258-
// .block_on(rpc.call_method::<FeeResponse>(
259-
// "estimatesmartfee",
260-
// &vec![conf_target_json, estimate_mode_json],
261-
// ))
262-
// .unwrap()
263-
// }),
264-
// _ => runtime
265-
// .block_on(rpc.call_method::<FeeResponse>(
266-
// "estimatesmartfee",
267-
// &vec![conf_target_json, estimate_mode_json],
268-
// ))
269-
// .unwrap(),
270-
// };
271-
// if resp.errored {
272-
// return default;
273-
// }
274-
// resp.feerate.unwrap()
275225
}
276226
}
277227

@@ -283,32 +233,5 @@ impl BroadcasterInterface for BitcoindClient {
283233
let mut rpc = bitcoind_rpc_client.lock().await;
284234
rpc.call_method::<RawTx>("sendrawtransaction", &vec![tx_serialized]).await.unwrap();
285235
});
286-
// let bitcoind_rpc_client = self.bitcoind_rpc_client.clone();
287-
// tokio::spawn(async move {
288-
// let rpc = bitcoind_rpc_client.lock().await;
289-
// rpc.call_method::<R>
290-
// });
291-
// let mut rpc = self.bitcoind_rpc_client.lock().unwrap();
292-
// let runtime = self.runtime.lock().unwrap();
293-
294-
// let tx_serialized = serde_json::json!(encode::serialize_hex(tx));
295-
// // This function may be called from a tokio runtime, or not. So we need to check before
296-
// // making the call to avoid the error "cannot run a tokio runtime from within a tokio runtime".
297-
// match Handle::try_current() {
298-
// Ok(_) => {
299-
// tokio::task::block_in_place(|| {
300-
// runtime
301-
// .block_on(
302-
// rpc.call_method::<RawTx>("sendrawtransaction", &vec![tx_serialized]),
303-
// )
304-
// .unwrap();
305-
// });
306-
// }
307-
// _ => {
308-
// runtime
309-
// .block_on(rpc.call_method::<RawTx>("sendrawtransaction", &vec![tx_serialized]))
310-
// .unwrap();
311-
// }
312-
// }
313236
}
314237
}

src/cli.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ pub(crate) async fn poll_for_user_input(
156156
continue;
157157
};
158158

159-
// let private_channel = match words.next().as_ref().map(String::as_str) {
160159
let announce_channel = match words.next() {
161160
Some("--public") | Some("--public=true") => true,
162161
Some("--public=false") => false,
@@ -577,7 +576,6 @@ fn get_invoice(
577576
Some(info) => info,
578577
None => continue,
579578
};
580-
println!("VMW: adding routehop, info.fee base: {}", forwarding_info.fee_base_msat);
581579
invoice = invoice.route(vec![lightning_invoice::RouteHop {
582580
pubkey: channel.remote_network_id,
583581
short_channel_id,

src/convert.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ impl TryInto<NewAddress> for JsonResponse {
5252

5353
pub struct FeeResponse {
5454
pub feerate: Option<u32>,
55-
// pub errors: Array<String>,
5655
pub errored: bool,
5756
}
5857

@@ -62,13 +61,10 @@ impl TryInto<FeeResponse> for JsonResponse {
6261
let errored = !self.0["errors"].is_null();
6362
Ok(FeeResponse {
6463
errored,
65-
feerate: match self.0["feerate"].as_f64() {
66-
Some(fee) => Some((fee * 100_000_000.0).round() as u32),
67-
None => None
68-
}
69-
// true => None,
70-
// // The feerate from bitcoind is in BTC/kb, and we want satoshis/kb.
71-
// false => Some((self.0["feerate"].as_f64().unwrap() * 100_000_000.0).round() as u32),
64+
feerate: match self.0["feerate"].as_f64() {
65+
Some(fee) => Some((fee * 100_000_000.0).round() as u32),
66+
None => None,
67+
},
7268
})
7369
}
7470
}

src/main.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ async fn handle_ldk_events(
237237
tokio::spawn(async move {
238238
let min = time_forwardable.as_secs();
239239
let seconds_to_sleep = thread_rng().gen_range(min, min * 5);
240-
// thread::sleep(Duration::new(seconds_to_sleep, 0));
241240
tokio::time::sleep(Duration::from_secs(seconds_to_sleep)).await;
242241
forwarding_channel_manager.process_pending_htlc_forwards();
243242
});
@@ -277,7 +276,7 @@ pub async fn main() {
277276
fs::create_dir_all(ldk_data_dir.clone()).unwrap();
278277

279278
// Initialize our bitcoind client.
280-
let mut bitcoind_client = match BitcoindClient::new(
279+
let bitcoind_client = match BitcoindClient::new(
281280
args.bitcoind_rpc_host.clone(),
282281
args.bitcoind_rpc_port,
283282
args.bitcoind_rpc_username.clone(),
@@ -291,7 +290,6 @@ pub async fn main() {
291290
return;
292291
}
293292
};
294-
// let mut bitcoind_rpc_client = bitcoind_client.get_new_rpc_client().unwrap();
295293

296294
// ## Setup
297295
// Step 1: Initialize the FeeEstimator
@@ -421,7 +419,6 @@ pub async fn main() {
421419
}
422420
chain_tip = Some(
423421
init::synchronize_listeners(
424-
// &mut bitcoind_rpc_client,
425422
&mut bitcoind_client.deref(),
426423
args.network,
427424
&mut cache,
@@ -482,21 +479,16 @@ pub async fn main() {
482479

483480
// Step 17: Connect and Disconnect Blocks
484481
if chain_tip.is_none() {
485-
// chain_tip = Some(init::validate_best_block_header(&mut bitcoind_client).await.unwrap());
486482
chain_tip =
487483
Some(init::validate_best_block_header(&mut bitcoind_client.deref()).await.unwrap());
488-
// chain_tip = Some(init::validate_best_block_header(&mut bitcoind_rpc_client).await.unwrap());
489484
}
490485
let channel_manager_listener = channel_manager.clone();
491486
let chain_monitor_listener = chain_monitor.clone();
492487
let bitcoind_block_source = bitcoind_client.clone();
493488
let network = args.network;
494489
tokio::spawn(async move {
495-
// let chain_poller = poll::ChainPoller::new(&mut bitcoind_client, network);
496490
let mut derefed = bitcoind_block_source.deref();
497-
// let chain_poller = poll::ChainPoller::new(&mut bitcoind_block_source.deref(), network);
498491
let chain_poller = poll::ChainPoller::new(&mut derefed, network);
499-
// let chain_poller = poll::ChainPoller::new(&mut bitcoind_rpc_client, network);
500492
let chain_listener = (chain_monitor_listener, channel_manager_listener);
501493
let mut spv_client =
502494
SpvClient::new(chain_tip.unwrap(), chain_poller, &mut cache, &chain_listener);
@@ -533,21 +525,13 @@ pub async fn main() {
533525
let payment_info: PaymentInfoStorage = Arc::new(Mutex::new(HashMap::new()));
534526
let payment_info_for_events = payment_info.clone();
535527
let network = args.network;
536-
// let bitcoind = BitcoindClient::new(
537-
// args.bitcoind_rpc_host.clone(),
538-
// args.bitcoind_rpc_port,
539-
// args.bitcoind_rpc_username.clone(),
540-
// args.bitcoind_rpc_password.clone(),
541-
// ).await.unwrap();
542528
let bitcoind_rpc = bitcoind_client.clone();
543529
tokio::spawn(async move {
544530
handle_ldk_events(
545531
peer_manager_event_listener,
546532
channel_manager_event_listener,
547533
chain_monitor_event_listener,
548-
// bitcoind_client.clone(),
549534
bitcoind_rpc,
550-
// bitcoind,
551535
keys_manager_listener,
552536
payment_info_for_events,
553537
network,

0 commit comments

Comments
 (0)