Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 24 additions & 44 deletions fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1860,11 +1860,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {

0xa0 => {
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 0).unwrap();
let contribution = SpliceContribution::SpliceIn {
value: Amount::from_sat(10_000),
inputs: vec![input],
change_script: None,
};
let contribution =
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
let funding_feerate_sat_per_kw = fee_est_a.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[0].splice_channel(
&chan_a_id,
Expand All @@ -1882,11 +1879,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
},
0xa1 => {
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 1).unwrap();
let contribution = SpliceContribution::SpliceIn {
value: Amount::from_sat(10_000),
inputs: vec![input],
change_script: None,
};
let contribution =
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
let funding_feerate_sat_per_kw = fee_est_b.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[1].splice_channel(
&chan_a_id,
Expand All @@ -1904,11 +1898,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
},
0xa2 => {
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 0).unwrap();
let contribution = SpliceContribution::SpliceIn {
value: Amount::from_sat(10_000),
inputs: vec![input],
change_script: None,
};
let contribution =
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
let funding_feerate_sat_per_kw = fee_est_b.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[1].splice_channel(
&chan_b_id,
Expand All @@ -1926,11 +1917,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
},
0xa3 => {
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 1).unwrap();
let contribution = SpliceContribution::SpliceIn {
value: Amount::from_sat(10_000),
inputs: vec![input],
change_script: None,
};
let contribution =
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
let funding_feerate_sat_per_kw = fee_est_c.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[2].splice_channel(
&chan_b_id,
Expand Down Expand Up @@ -1958,12 +1946,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
.map(|chan| chan.outbound_capacity_msat)
.unwrap();
if outbound_capacity_msat >= 20_000_000 {
let contribution = SpliceContribution::SpliceOut {
outputs: vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[0].script_pubkey.clone(),
}],
};
let contribution = SpliceContribution::splice_out(vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[0].script_pubkey.clone(),
}]);
let funding_feerate_sat_per_kw =
fee_est_a.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[0].splice_channel(
Expand All @@ -1989,12 +1975,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
.map(|chan| chan.outbound_capacity_msat)
.unwrap();
if outbound_capacity_msat >= 20_000_000 {
let contribution = SpliceContribution::SpliceOut {
outputs: vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
}],
};
let contribution = SpliceContribution::splice_out(vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
}]);
let funding_feerate_sat_per_kw =
fee_est_b.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[1].splice_channel(
Expand All @@ -2020,12 +2004,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
.map(|chan| chan.outbound_capacity_msat)
.unwrap();
if outbound_capacity_msat >= 20_000_000 {
let contribution = SpliceContribution::SpliceOut {
outputs: vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
}],
};
let contribution = SpliceContribution::splice_out(vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
}]);
let funding_feerate_sat_per_kw =
fee_est_b.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[1].splice_channel(
Expand All @@ -2051,12 +2033,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
.map(|chan| chan.outbound_capacity_msat)
.unwrap();
if outbound_capacity_msat >= 20_000_000 {
let contribution = SpliceContribution::SpliceOut {
outputs: vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[2].script_pubkey.clone(),
}],
};
let contribution = SpliceContribution::splice_out(vec![TxOut {
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
script_pubkey: coinbase_tx.output[2].script_pubkey.clone(),
}]);
let funding_feerate_sat_per_kw =
fee_est_c.ret_val.load(atomic::Ordering::Acquire);
if let Err(e) = nodes[2].splice_channel(
Expand Down
10 changes: 4 additions & 6 deletions lightning-tests/src/upgrade_downgrade_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,10 @@ fn do_test_0_1_htlc_forward_after_splice(fail_htlc: bool) {
reconnect_b_c_args.send_announcement_sigs = (true, true);
reconnect_nodes(reconnect_b_c_args);

let contribution = SpliceContribution::SpliceOut {
outputs: vec![TxOut {
value: Amount::from_sat(1_000),
script_pubkey: nodes[0].wallet_source.get_change_script().unwrap(),
}],
};
let contribution = SpliceContribution::splice_out(vec![TxOut {
value: Amount::from_sat(1_000),
script_pubkey: nodes[0].wallet_source.get_change_script().unwrap(),
}]);
let splice_tx = splice_channel(&nodes[0], &nodes[1], ChannelId(chan_id_bytes_a), contribution);
for node in nodes.iter() {
mine_transaction(node, &splice_tx);
Expand Down
28 changes: 28 additions & 0 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::blinded_path::payment::{
use crate::chain::transaction;
use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS;
use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields};
use crate::ln::funding::FundingContribution;
use crate::ln::types::ChannelId;
use crate::ln::{msgs, LocalHTLCFailureReason};
use crate::offers::invoice::Bolt12Invoice;
Expand Down Expand Up @@ -1816,6 +1817,28 @@ pub enum Event {
/// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request
invoice_request: InvoiceRequest,
},
///
FundingNeeded {
/// The `channel_id` of the channel which you'll need to pass back into
/// [`ChannelManager::funding_contributed`].
///
/// [`ChannelManager::funding_contributed`]: crate::ln::channelmanager::ChannelManager::funding_contributed
channel_id: ChannelId,
/// The counterparty's `node_id`, which you'll need to pass back into
/// [`ChannelManager::funding_contributed`].
///
/// [`ChannelManager::funding_contributed`]: crate::ln::channelmanager::ChannelManager::funding_contributed
counterparty_node_id: PublicKey,
/// The `user_channel_id` value passed in for outbound channels, or for inbound channels if
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
/// `user_channel_id` will be randomized for inbound channels.
///
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
user_channel_id: u128,

///
contribution: FundingContribution,
},
/// Indicates that a channel funding transaction constructed interactively is ready to be
/// signed. This event will only be triggered if at least one input was contributed.
///
Expand Down Expand Up @@ -2347,6 +2370,10 @@ impl Writeable for Event {
(13, *contributed_outputs, optional_vec),
});
},
&Event::FundingNeeded { .. } => {
54u8.write(writer)?;
todo!();
},
// Note that, going forward, all new events must only write data inside of
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
// data via `write_tlv_fields`.
Expand Down Expand Up @@ -2978,6 +3005,7 @@ impl MaybeReadable for Event {
};
f()
},
54u8 => todo!(),
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
// reads.
Expand Down
Loading