Skip to content

Commit d830a3e

Browse files
Add counterparty_node_id to FundingGenerationReady
1 parent 54cd389 commit d830a3e

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

fuzz/src/full_stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
408408
let mut should_forward = false;
409409
let mut payments_received: Vec<PaymentHash> = Vec::new();
410410
let mut payments_sent = 0;
411-
let mut pending_funding_generation: Vec<([u8; 32], u64, Script)> = Vec::new();
411+
let mut pending_funding_generation: Vec<([u8; 32], PublicKey, u64, Script)> = Vec::new();
412412
let mut pending_funding_signatures = HashMap::new();
413413

414414
loop {
@@ -556,7 +556,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
556556
10 => {
557557
'outer_loop: for funding_generation in pending_funding_generation.drain(..) {
558558
let mut tx = Transaction { version: 0, lock_time: 0, input: Vec::new(), output: vec![TxOut {
559-
value: funding_generation.1, script_pubkey: funding_generation.2,
559+
value: funding_generation.2, script_pubkey: funding_generation.3,
560560
}] };
561561
let funding_output = 'search_loop: loop {
562562
let funding_txid = tx.txid();
@@ -632,8 +632,8 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
632632
loss_detector.handler.process_events();
633633
for event in loss_detector.manager.get_and_clear_pending_events() {
634634
match event {
635-
Event::FundingGenerationReady { temporary_channel_id, channel_value_satoshis, output_script, .. } => {
636-
pending_funding_generation.push((temporary_channel_id, channel_value_satoshis, output_script));
635+
Event::FundingGenerationReady { temporary_channel_id, counterparty_node_id, channel_value_satoshis, output_script, .. } => {
636+
pending_funding_generation.push((temporary_channel_id, counterparty_node_id, channel_value_satoshis, output_script));
637637
},
638638
Event::PaymentReceived { payment_hash, .. } => {
639639
//TODO: enhance by fetching random amounts from fuzz input?

lightning-background-processor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ mod tests {
540540
macro_rules! handle_funding_generation_ready {
541541
($event: expr, $channel_value: expr) => {{
542542
match $event {
543-
&Event::FundingGenerationReady { temporary_channel_id, channel_value_satoshis, ref output_script, user_channel_id } => {
543+
&Event::FundingGenerationReady { temporary_channel_id, channel_value_satoshis, ref output_script, user_channel_id, .. } => {
544544
assert_eq!(channel_value_satoshis, $channel_value);
545545
assert_eq!(user_channel_id, 42);
546546

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,6 +4213,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
42134213
let mut pending_events = self.pending_events.lock().unwrap();
42144214
pending_events.push(events::Event::FundingGenerationReady {
42154215
temporary_channel_id: msg.temporary_channel_id,
4216+
counterparty_node_id: *counterparty_node_id,
42164217
channel_value_satoshis: value,
42174218
output_script,
42184219
user_channel_id: user_id,

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ pub fn create_funding_transaction<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, expected_
559559
let events = node.node.get_and_clear_pending_events();
560560
assert_eq!(events.len(), 1);
561561
match events[0] {
562-
Event::FundingGenerationReady { ref temporary_channel_id, ref channel_value_satoshis, ref output_script, user_channel_id } => {
562+
Event::FundingGenerationReady { ref temporary_channel_id, ref counterparty_node_id, ref channel_value_satoshis, ref output_script, user_channel_id } => {
563563
assert_eq!(*channel_value_satoshis, expected_chan_value);
564564
assert_eq!(user_channel_id, expected_user_chan_id);
565565

lightning/src/util/events.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,15 @@ pub enum Event {
162162
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
163163
FundingGenerationReady {
164164
/// The random channel_id we picked which you'll need to pass into
165-
/// ChannelManager::funding_transaction_generated.
165+
/// [`ChannelManager::funding_transaction_generated`].
166+
///
167+
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
166168
temporary_channel_id: [u8; 32],
169+
/// The counterparty's node_id, which you'll need to pass back into
170+
/// [`ChannelManager::funding_transaction_generated`].
171+
///
172+
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
173+
counterparty_node_id: PublicKey,
167174
/// The value, in satoshis, that the output should have.
168175
channel_value_satoshis: u64,
169176
/// The script which should be used in the transaction output.

0 commit comments

Comments
 (0)