fn get_chain_hashes(&self) -> Option<Vec<ChainHash>> {
Some(vec![ChainHash::using_genesis_block(Network::Testnet)])
}
+ fn message_received(&self) {}
}
impl MessageSendEventsProvider for MsgHandler {
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent> {
"Dual-funded channels not supported".to_owned(),
msg.channel_id.clone())), counterparty_node_id);
}
+
+ fn message_received(&self) {
+ for (payment_id, retryable_invoice_request) in self
+ .pending_outbound_payments
+ .release_invoice_requests_awaiting_invoice()
+ {
+ let RetryableInvoiceRequest { invoice_request, nonce } = retryable_invoice_request;
+ let hmac = payment_id.hmac_for_offer_payment(nonce, &self.inbound_payment_key);
+ let context = OffersContext::OutboundPayment {
+ payment_id,
+ nonce,
+ hmac: Some(hmac)
+ };
+ match self.create_blinded_paths(context) {
+ Ok(reply_paths) => match self.enqueue_invoice_request(invoice_request, reply_paths) {
+ Ok(_) => {}
+ Err(_) => {
+ log_warn!(self.logger,
+ "Retry failed for an invoice request with payment_id: {}",
+ payment_id
+ );
+ }
+ },
+ Err(_) => {
+ log_warn!(self.logger,
+ "Retry failed for an invoice request with payment_id: {}. \
+ Reason: router could not find a blinded path to include as the reply path",
+ payment_id
+ );
+ }
+ }
+ }
+ }
}
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref>
/// If it's `None`, then no particular network chain hash compatibility will be enforced when
/// connecting to peers.
fn get_chain_hashes(&self) -> Option<Vec<ChainHash>>;
+
+ /// Indicates that a message was received from any peer for any handler.
+ /// Called before the message is passed to the appropriate handler.
+ /// Useful for indicating that a network connection is active.
+ ///
+ /// Note: Since this function is called frequently, it should be as
+ /// efficient as possible for its intended purpose.
+ fn message_received(&self);
}
/// A trait to describe an object which can receive routing messages.
fn handle_tx_abort(&self, their_node_id: PublicKey, msg: &msgs::TxAbort) {
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
}
+
+ fn message_received(&self) {}
}
impl Deref for ErroringMessageHandler {
let their_node_id = peer_lock.their_node_id.expect("We know the peer's public key by the time we receive messages").0;
let logger = WithContext::from(&self.logger, Some(their_node_id), None, None);
+ self.message_handler.chan_handler.message_received();
+
let message = match self.do_handle_message_holding_peer_lock(peer_lock, message, their_node_id, &logger)? {
Some(processed_message) => processed_message,
None => return Ok(None),
fn handle_tx_abort(&self, _their_node_id: PublicKey, msg: &msgs::TxAbort) {
self.received_msg(wire::Message::TxAbort(msg.clone()));
}
+
+ fn message_received(&self) {}
}
impl events::MessageSendEventsProvider for TestChannelMessageHandler {