Skip to content

Commit 43a6ee3

Browse files
committed
Update splice messages according to new spec draft
1 parent 07f3380 commit 43a6ee3

17 files changed

+131
-93
lines changed

fuzz/src/bin/gen_target.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ GEN_TEST msg_tx_abort msg_targets::
7474

7575
GEN_TEST msg_stfu msg_targets::
7676

77-
GEN_TEST msg_splice msg_targets::
77+
GEN_TEST msg_splice_init msg_targets::
7878
GEN_TEST msg_splice_ack msg_targets::
7979
GEN_TEST msg_splice_locked msg_targets::

fuzz/src/bin/msg_splice_target.rs renamed to fuzz/src/bin/msg_splice_init_target.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ compile_error!("Fuzz targets need cfg=hashes_fuzz");
2323
compile_error!("Fuzz targets need cfg=secp256k1_fuzz");
2424

2525
extern crate lightning_fuzz;
26-
use lightning_fuzz::msg_targets::msg_splice::*;
26+
use lightning_fuzz::msg_targets::msg_splice_init::*;
2727

2828
#[cfg(feature = "afl")]
2929
#[macro_use] extern crate afl;
3030
#[cfg(feature = "afl")]
3131
fn main() {
3232
fuzz!(|data| {
33-
msg_splice_run(data.as_ptr(), data.len());
33+
msg_splice_init_run(data.as_ptr(), data.len());
3434
});
3535
}
3636

@@ -40,7 +40,7 @@ fn main() {
4040
fn main() {
4141
loop {
4242
fuzz!(|data| {
43-
msg_splice_run(data.as_ptr(), data.len());
43+
msg_splice_init_run(data.as_ptr(), data.len());
4444
});
4545
}
4646
}
@@ -49,7 +49,7 @@ fn main() {
4949
#[macro_use] extern crate libfuzzer_sys;
5050
#[cfg(feature = "libfuzzer_fuzz")]
5151
fuzz_target!(|data: &[u8]| {
52-
msg_splice_run(data.as_ptr(), data.len());
52+
msg_splice_init_run(data.as_ptr(), data.len());
5353
});
5454

5555
#[cfg(feature = "stdin_fuzz")]
@@ -58,7 +58,7 @@ fn main() {
5858

5959
let mut data = Vec::with_capacity(8192);
6060
std::io::stdin().read_to_end(&mut data).unwrap();
61-
msg_splice_run(data.as_ptr(), data.len());
61+
msg_splice_init_run(data.as_ptr(), data.len());
6262
}
6363

6464
#[test]
@@ -70,11 +70,11 @@ fn run_test_cases() {
7070
use std::sync::{atomic, Arc};
7171
{
7272
let data: Vec<u8> = vec![0];
73-
msg_splice_run(data.as_ptr(), data.len());
73+
msg_splice_init_run(data.as_ptr(), data.len());
7474
}
7575
let mut threads = Vec::new();
7676
let threads_running = Arc::new(atomic::AtomicUsize::new(0));
77-
if let Ok(tests) = fs::read_dir("test_cases/msg_splice") {
77+
if let Ok(tests) = fs::read_dir("test_cases/msg_splice_init") {
7878
for test in tests {
7979
let mut data: Vec<u8> = Vec::new();
8080
let path = test.unwrap().path();
@@ -89,7 +89,7 @@ fn run_test_cases() {
8989

9090
let panic_logger = string_logger.clone();
9191
let res = if ::std::panic::catch_unwind(move || {
92-
msg_splice_test(&data, panic_logger);
92+
msg_splice_init_test(&data, panic_logger);
9393
}).is_err() {
9494
Some(string_logger.into_string())
9595
} else { None };

fuzz/src/msg_targets/gen_target.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ GEN_TEST lightning::ln::msgs::TxAbort test_msg_simple ""
6464

6565
GEN_TEST lightning::ln::msgs::Stfu test_msg_simple ""
6666

67-
GEN_TEST lightning::ln::msgs::Splice test_msg_simple ""
67+
GEN_TEST lightning::ln::msgs::SpliceInit test_msg_simple ""
6868
GEN_TEST lightning::ln::msgs::SpliceAck test_msg_simple ""
6969
GEN_TEST lightning::ln::msgs::SpliceLocked test_msg_simple ""

fuzz/src/msg_targets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ pub mod msg_tx_init_rbf;
4343
pub mod msg_tx_ack_rbf;
4444
pub mod msg_tx_abort;
4545
pub mod msg_stfu;
46-
pub mod msg_splice;
46+
pub mod msg_splice_init;
4747
pub mod msg_splice_ack;
4848
pub mod msg_splice_locked;

fuzz/src/msg_targets/msg_splice.rs renamed to fuzz/src/msg_targets/msg_splice_init.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ use crate::msg_targets::utils::VecWriter;
1616
use crate::utils::test_logger;
1717

1818
#[inline]
19-
pub fn msg_splice_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
20-
test_msg_simple!(lightning::ln::msgs::Splice, data);
19+
pub fn msg_splice_init_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
20+
test_msg_simple!(lightning::ln::msgs::SpliceInit, data);
2121
}
2222

2323
#[no_mangle]
24-
pub extern "C" fn msg_splice_run(data: *const u8, datalen: usize) {
24+
pub extern "C" fn msg_splice_init_run(data: *const u8, datalen: usize) {
2525
let data = unsafe { std::slice::from_raw_parts(data, datalen) };
26-
test_msg_simple!(lightning::ln::msgs::Splice, data);
26+
test_msg_simple!(lightning::ln::msgs::SpliceInit, data);
2727
}

fuzz/targets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ void msg_tx_init_rbf_run(const unsigned char* data, size_t data_len);
5959
void msg_tx_ack_rbf_run(const unsigned char* data, size_t data_len);
6060
void msg_tx_abort_run(const unsigned char* data, size_t data_len);
6161
void msg_stfu_run(const unsigned char* data, size_t data_len);
62-
void msg_splice_run(const unsigned char* data, size_t data_len);
62+
void msg_splice_init_run(const unsigned char* data, size_t data_len);
6363
void msg_splice_ack_run(const unsigned char* data, size_t data_len);
6464
void msg_splice_locked_run(const unsigned char* data, size_t data_len);

lightning-net-tokio/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ mod tests {
625625
fn handle_accept_channel_v2(&self, _their_node_id: &PublicKey, _msg: &AcceptChannelV2) {}
626626
fn handle_stfu(&self, _their_node_id: &PublicKey, _msg: &Stfu) {}
627627
#[cfg(splicing)]
628-
fn handle_splice(&self, _their_node_id: &PublicKey, _msg: &Splice) {}
628+
fn handle_splice_init(&self, _their_node_id: &PublicKey, _msg: &SpliceInit) {}
629629
#[cfg(splicing)]
630630
fn handle_splice_ack(&self, _their_node_id: &PublicKey, _msg: &SpliceAck) {}
631631
#[cfg(splicing)]

lightning/src/events/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,12 +2057,12 @@ pub enum MessageSendEvent {
20572057
/// The message which should be sent.
20582058
msg: msgs::Stfu,
20592059
},
2060-
/// Used to indicate that a splice message should be sent to the peer with the given node id.
2061-
SendSplice {
2060+
/// Used to indicate that a splice_init message should be sent to the peer with the given node id.
2061+
SendSpliceInit {
20622062
/// The node_id of the node which should receive this message
20632063
node_id: PublicKey,
20642064
/// The message which should be sent.
2065-
msg: msgs::Splice,
2065+
msg: msgs::SpliceInit,
20662066
},
20672067
/// Used to indicate that a splice_ack message should be sent to the peer with the given node id.
20682068
SendSpliceAck {

lightning/src/ln/channel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7135,6 +7135,7 @@ impl<SP: Deref> Channel<SP> where
71357135
channel_id: self.context.channel_id,
71367136
signature,
71377137
htlc_signatures,
7138+
batch: None,
71387139
#[cfg(taproot)]
71397140
partial_signature_with_nonce: None,
71407141
}, (counterparty_commitment_txid, commitment_stats.htlcs_included)))

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9652,7 +9652,7 @@ where
96529652
}
96539653

96549654
#[cfg(splicing)]
9655-
fn handle_splice(&self, counterparty_node_id: &PublicKey, msg: &msgs::Splice) {
9655+
fn handle_splice_init(&self, counterparty_node_id: &PublicKey, msg: &msgs::SpliceInit) {
96569656
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
96579657
"Splicing not supported".to_owned(),
96589658
msg.channel_id.clone())), *counterparty_node_id);
@@ -9859,7 +9859,7 @@ where
98599859
// Quiescence
98609860
&events::MessageSendEvent::SendStfu { .. } => false,
98619861
// Splicing
9862-
&events::MessageSendEvent::SendSplice { .. } => false,
9862+
&events::MessageSendEvent::SendSpliceInit { .. } => false,
98639863
&events::MessageSendEvent::SendSpliceAck { .. } => false,
98649864
&events::MessageSendEvent::SendSpliceLocked { .. } => false,
98659865
// Interactive Transaction Construction

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ pub fn remove_first_msg_event_to_node(msg_node_id: &PublicKey, msg_events: &mut
884884
MessageSendEvent::SendStfu { node_id, .. } => {
885885
node_id == msg_node_id
886886
},
887-
MessageSendEvent::SendSplice { node_id, .. } => {
887+
MessageSendEvent::SendSpliceInit { node_id, .. } => {
888888
node_id == msg_node_id
889889
},
890890
MessageSendEvent::SendSpliceAck { node_id, .. } => {

lightning/src/ln/functional_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ fn test_update_fee_that_funder_cannot_afford() {
783783
channel_id: chan.2,
784784
signature: res.0,
785785
htlc_signatures: res.1,
786+
batch: None,
786787
#[cfg(taproot)]
787788
partial_signature_with_nonce: None,
788789
};
@@ -1532,6 +1533,7 @@ fn test_fee_spike_violation_fails_htlc() {
15321533
channel_id: chan.2,
15331534
signature: res.0,
15341535
htlc_signatures: res.1,
1536+
batch: None,
15351537
#[cfg(taproot)]
15361538
partial_signature_with_nonce: None,
15371539
};

lightning/src/ln/interactivetxs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ impl InteractiveTxConstructor {
942942
prevtx,
943943
prevtx_out: input.previous_output.vout,
944944
sequence: input.sequence.to_consensus_u32(),
945+
shared_input_txid: None,
945946
};
946947
do_state_transition!(self, sent_tx_add_input, &msg)?;
947948
Ok(InteractiveTxMessageSend::TxAddInput(msg))

0 commit comments

Comments
 (0)