]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #3060 from TheBlueMatt/2024-05-parallel-async-om-events
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Tue, 4 Jun 2024 19:10:43 +0000 (12:10 -0700)
committerGitHub <noreply@github.com>
Tue, 4 Jun 2024 19:10:43 +0000 (12:10 -0700)
Add a parallel async event handler to OnionMessenger and pass it directly to BackgroundProcessor

1  2 
lightning-background-processor/src/lib.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/onion_message/messenger.rs

index 8b55913728f4fefe46c59228b0f833565881de39,6b7cd5b0567857723d4aeb2692a2b7b4c7f03614..4719d7e5c1aba8a7dd15c1bdf47f1447f872d39a
@@@ -1655,11 -1653,10 +1655,11 @@@ mod tests 
                        _ => panic!("Unexpected event: {:?}", event),
                };
                let persister = Arc::new(Persister::new(data_dir));
-               let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
+               let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), Some(nodes[0].messenger.clone()), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
  
                // Force close the channel and check that the SpendableOutputs event was handled.
 -              nodes[0].node.force_close_broadcasting_latest_txn(&nodes[0].node.list_channels()[0].channel_id, &nodes[1].node.get_our_node_id()).unwrap();
 +              let error_message = "Channel force-closed";
 +              nodes[0].node.force_close_broadcasting_latest_txn(&nodes[0].node.list_channels()[0].channel_id, &nodes[1].node.get_our_node_id(), error_message.to_string()).unwrap();
                let commitment_tx = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().pop().unwrap();
                confirm_transaction_depth(&mut nodes[0], &commitment_tx, BREAKDOWN_TIMEOUT as u32);
  
index 3b52ff0def9881b0af7626615d19255b11266db1,7a6ba09c22c37b6011716c003a06ce9f453f7697..3e0627aac233036361bda62971f704d6ea2718d6
@@@ -52,10 -52,10 +52,10 @@@ use core::fmt::Display
  use crate::io::{self, Cursor, Read};
  use crate::io_extras::read_to_end;
  
- use crate::events::{EventsProvider, MessageSendEventsProvider};
+ use crate::events::MessageSendEventsProvider;
  use crate::crypto::streams::ChaChaPolyReadAdapter;
  use crate::util::logger;
 -use crate::util::ser::{LengthReadable, LengthReadableArgs, Readable, ReadableArgs, Writeable, Writer, WithoutLength, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname, TransactionU16LenLimited, BigSize};
 +use crate::util::ser::{BigSize, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname, LengthRead, LengthReadable, LengthReadableArgs, Readable, ReadableArgs, TransactionU16LenLimited, WithoutLength, Writeable, Writer};
  use crate::util::base32;
  
  use crate::routing::gossip::{NodeAlias, NodeId};
Simple merge