[[package]]
name = "lightning"
version = "0.0.99"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bitcoin",
"secp256k1",
[[package]]
name = "lightning-background-processor"
version = "0.0.99"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bitcoin",
"lightning",
[[package]]
name = "lightning-block-sync"
version = "0.0.99"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bitcoin",
"chunked_transfer",
[[package]]
name = "lightning-invoice"
version = "0.7.0"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bech32",
"bitcoin_hashes",
[[package]]
name = "lightning-net-tokio"
version = "0.0.99"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bitcoin",
"lightning",
[[package]]
name = "lightning-persister"
version = "0.0.99"
-source = "git+https://github.com/rust-bitcoin/rust-lightning?branch=main#9d8d24f6906d6fbdc6c02a88e5e2298c1fa50825"
+source = "git+https://github.com/jkczyz/rust-lightning.git?branch=2021-07-network-update-handler#de7cb1d4fe22cc46eb0a59ebefb15017c43ba711"
dependencies = [
"bitcoin",
"libc",
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-lightning = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-block-sync = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main", features = [ "rpc-client" ] }
-lightning-invoice = { version = "0.7", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-net-tokio = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-persister = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
-lightning-background-processor = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+# lightning = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+# lightning-block-sync = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main", features = [ "rpc-client" ] }
+# lightning-invoice = { version = "0.7", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+# lightning-net-tokio = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+# lightning-persister = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+# lightning-background-processor = { version = "0.0.99", git = "https://github.com/rust-bitcoin/rust-lightning", branch = "main" }
+lightning = { git = "https://github.com/jkczyz/rust-lightning.git", branch = "2021-07-network-update-handler" }
+lightning-block-sync = { git = "https://github.com/jkczyz/rust-lightning", branch = "2021-07-network-update-handler", features = [ "rpc-client" ] }
+lightning-invoice = { git = "https://github.com/jkczyz/rust-lightning.git", branch = "2021-07-network-update-handler" }
+lightning-net-tokio = { git = "https://github.com/jkczyz/rust-lightning.git", branch = "2021-07-network-update-handler" }
+lightning-persister = { git = "https://github.com/jkczyz/rust-lightning.git", branch = "2021-07-network-update-handler" }
+lightning-background-processor = { git = "https://github.com/jkczyz/rust-lightning.git", branch = "2021-07-network-update-handler" }
base64 = "0.13.0"
bitcoin = "0.27"
use lightning::ln::features::InvoiceFeatures;
use lightning::ln::msgs::NetAddress;
use lightning::ln::{PaymentHash, PaymentSecret};
-use lightning::routing::network_graph::NetGraphMsgHandler;
+use lightning::routing::network_graph::{NetGraphMsgHandler, NetworkGraph};
use lightning::routing::router;
use lightning::routing::router::RouteHint;
use lightning::util::config::{ChannelConfig, ChannelHandshakeLimits, UserConfig};
pub(crate) async fn poll_for_user_input(
peer_manager: Arc<PeerManager>, channel_manager: Arc<ChannelManager>,
keys_manager: Arc<KeysManager>,
- router: Arc<NetGraphMsgHandler<Arc<dyn chain::Access + Send + Sync>, Arc<FilesystemLogger>>>,
+ router: Arc<
+ NetGraphMsgHandler<
+ Arc<NetworkGraph>,
+ Arc<dyn chain::Access + Send + Sync>,
+ Arc<FilesystemLogger>,
+ >,
+ >,
inbound_payments: PaymentInfoStorage, outbound_payments: PaymentInfoStorage,
ldk_data_dir: String, logger: Arc<FilesystemLogger>, network: Network,
) {
payee: PublicKey, amt_msat: u64, final_cltv: u32, payment_hash: PaymentHash,
payment_secret: Option<PaymentSecret>, payee_features: Option<InvoiceFeatures>,
route_hints: Vec<&RouteHint>,
- router: Arc<NetGraphMsgHandler<Arc<dyn chain::Access + Send + Sync>, Arc<FilesystemLogger>>>,
+ router: Arc<
+ NetGraphMsgHandler<
+ Arc<NetworkGraph>,
+ Arc<dyn chain::Access + Send + Sync>,
+ Arc<FilesystemLogger>,
+ >,
+ >,
channel_manager: Arc<ChannelManager>, payment_storage: PaymentInfoStorage,
logger: Arc<FilesystemLogger>,
) {
- let network_graph = router.network_graph.read().unwrap();
let first_hops = channel_manager.list_usable_channels();
let payer_pubkey = channel_manager.get_our_node_id();
let route = router::get_route(
&payer_pubkey,
- &network_graph,
+ &router.network_graph,
&payee,
payee_features,
Some(&first_hops.iter().collect::<Vec<_>>()),
fn keysend(
payee: PublicKey, amt_msat: u64,
- router: Arc<NetGraphMsgHandler<Arc<dyn chain::Access + Send + Sync>, Arc<FilesystemLogger>>>,
+ router: Arc<
+ NetGraphMsgHandler<
+ Arc<NetworkGraph>,
+ Arc<dyn chain::Access + Send + Sync>,
+ Arc<FilesystemLogger>,
+ >,
+ >,
channel_manager: Arc<ChannelManager>, payment_storage: PaymentInfoStorage,
logger: Arc<FilesystemLogger>,
) {
- let network_graph = router.network_graph.read().unwrap();
let first_hops = channel_manager.list_usable_channels();
let payer_pubkey = channel_manager.get_our_node_id();
let route = match router::get_keysend_route(
&payer_pubkey,
- &network_graph,
+ &router.network_graph,
&payee,
Some(&first_hops.iter().collect::<Vec<_>>()),
&vec![],
}
}
}
- Event::PaymentFailed { payment_hash, rejected_by_dest } => {
+ Event::PaymentFailed { payment_hash, rejected_by_dest, .. } => {
print!(
"\nEVENT: Failed to send payment to payment hash {:?}: ",
hex_utils::hex_str(&payment_hash.0)
// Step 11: Optional: Initialize the NetGraphMsgHandler
let genesis = genesis_block(args.network).header.block_hash();
let network_graph_path = format!("{}/network_graph", ldk_data_dir.clone());
- let network_graph = disk::read_network(Path::new(&network_graph_path), genesis);
- let router = Arc::new(NetGraphMsgHandler::from_net_graph(
+ let network_graph = Arc::new(disk::read_network(Path::new(&network_graph_path), genesis));
+ let router = Arc::new(NetGraphMsgHandler::new(
+ network_graph.clone(),
None::<Arc<dyn chain::Access + Send + Sync>>,
logger.clone(),
- network_graph,
));
let router_persist = Arc::clone(&router);
tokio::spawn(async move {
let mut interval = tokio::time::interval(Duration::from_secs(600));
loop {
interval.tick().await;
- if disk::persist_network(
- Path::new(&network_graph_path),
- &*router_persist.network_graph.read().unwrap(),
- )
- .is_err()
+ if disk::persist_network(Path::new(&network_graph_path), &*router_persist.network_graph)
+ .is_err()
{
// Persistence errors here are non-fatal as we can just fetch the routing graph
// again later, but they may indicate a disk error which could be fatal elsewhere.
let network = args.network;
let bitcoind_rpc = bitcoind_client.clone();
let handle = tokio::runtime::Handle::current();
- let event_handler = move |event| {
+ let event_handler = move |event: &Event| {
handle.block_on(handle_ldk_events(
channel_manager_event_listener.clone(),
bitcoind_rpc.clone(),
inbound_pmts_for_events.clone(),
outbound_pmts_for_events.clone(),
network,
- event,
+ event.clone(),
))
};
// Step 16: Persist ChannelManager
chain_monitor.clone(),
channel_manager.clone(),
peer_manager.clone(),
+ network_graph.clone(),
logger.clone(),
);