>,
>;
+pub(crate) type GossipVerifier = lightning_block_sync::gossip::GossipVerifier<
+ lightning_block_sync::gossip::TokioSpawner,
+ Arc<lightning_block_sync::rpc::RpcClient>,
+ Arc<FilesystemLogger>,
+ SocketDescriptor,
+ Arc<ChannelManager>,
+ Arc<OnionMessenger>,
+ IgnoringMessageHandler,
+ Arc<KeysManager>,
+>;
+
pub(crate) type PeerManager = SimpleArcPeerManager<
SocketDescriptor,
ChainMonitor,
BitcoindClient,
BitcoindClient,
- Arc<BitcoindClient>,
+ GossipVerifier,
FilesystemLogger,
>;
pub(crate) type NetworkGraph = gossip::NetworkGraph<Arc<FilesystemLogger>>;
-type OnionMessenger = SimpleArcOnionMessenger<FilesystemLogger>;
+type OnionMessenger =
+ SimpleArcOnionMessenger<ChainMonitor, BitcoindClient, BitcoindClient, FilesystemLogger>;
pub(crate) type BumpTxEventHandler = BumpTransactionEventHandler<
Arc<BitcoindClient>,
}
fs_store.write("", "", OUTBOUND_PAYMENTS_FNAME, &outbound.encode()).unwrap();
}
+ Event::InvoiceRequestFailed { payment_id } => {
+ print!("\nEVENT: Failed to request invoice to send payment with id {}", payment_id);
+ print!("> ");
+ io::stdout().flush().unwrap();
+
+ // TODO: mark the payment as failed
+ }
Event::PaymentForwarded {
prev_channel_id,
next_channel_id,
}
// Step 14: Optional: Initialize the P2PGossipSync
- let gossip_sync = Arc::new(P2PGossipSync::new(
- Arc::clone(&network_graph),
- None::<Arc<BitcoindClient>>,
- logger.clone(),
- ));
+ let gossip_sync =
+ Arc::new(P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger)));
// Step 15: Initialize the PeerManager
let channel_manager: Arc<ChannelManager> = Arc::new(channel_manager);
Arc::clone(&keys_manager),
Arc::clone(&logger),
Arc::new(DefaultMessageRouter {}),
- IgnoringMessageHandler {},
+ Arc::clone(&channel_manager),
IgnoringMessageHandler {},
));
let mut ephemeral_bytes = [0; 32];
Arc::clone(&keys_manager),
));
+ // Install a GossipVerifier in in the P2PGossipSync
+ let utxo_lookup = GossipVerifier::new(
+ Arc::clone(&bitcoind_client.bitcoind_rpc_client),
+ lightning_block_sync::gossip::TokioSpawner,
+ Arc::clone(&gossip_sync),
+ Arc::clone(&peer_manager),
+ );
+ gossip_sync.add_utxo_lookup(Some(utxo_lookup));
+
// ## Running LDK
// Step 16: Initialize networking