Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1141,7 +1141,7 @@ mod tests {
ext_from_hex("030020", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 03000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 03000000000000000000000000000000",
&mut test,
);

Expand DownExpand Up@@ -1245,7 +1245,7 @@ mod tests {
ext_from_hex("030120", &mut test);
// init message (type 16) with static_remotekey required, no channel_type/anchors/taproot, and other bits optional and mac
ext_from_hex(
"0010 00021aaa 0008aaa20aaa2a0a9aaa 01000000000000000000000000000000",
"0010 00021aaa 0008aaa208aa2a0a9aaa 01000000000000000000000000000000",
&mut test,
);

Expand Down
110 changes: 57 additions & 53 deletions lightning-types/src/features.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,8 @@
//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info).
//! - `Quiescence` - protocol to quiesce a channel by indicating that "SomeThing Fundamental is Underway"
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
//!
//! LDK knows about the following features, but does not support them:
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
Expand DownExpand Up@@ -156,7 +158,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
// Byte 7
Expand All@@ -177,7 +179,7 @@ mod sealed {
// Byte 4
Quiescence | OnionMessages,
// Byte 5
ProvideStorage | ChannelType | SCIDPrivacy,
ProvideStorage | ChannelType | SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf | Keysend,
// Byte 7
Expand DownExpand Up@@ -242,7 +244,7 @@ mod sealed {
// Byte 4
,
// Byte 5
SCIDPrivacy,
SCIDPrivacy | AnchorZeroFeeCommitments,
// Byte 6
ZeroConf,
]);
Expand All@@ -251,7 +253,7 @@ mod sealed {
/// useful for manipulating feature flags.
macro_rules! define_feature {
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident) => {
$required_setter: ident, $clear: ident, $supported_getter: ident) => {
#[doc = $doc]
///
/// See [BOLT #9] for details.
Expand DownExpand Up@@ -354,6 +356,11 @@ mod sealed {
<T as $feature>::set_required_bit(&mut self.flags);
}

/// Unsets this feature.
pub fn $clear(&mut self) {
<T as $feature>::clear_bits(&mut self.flags);
}

/// Checks if this feature is supported.
pub fn $supported_getter(&self) -> bool {
<T as $feature>::supports_feature(&self.flags)
Expand All@@ -377,8 +384,8 @@ mod sealed {
)*
};
($odd_bit: expr, $feature: ident, [$($context: ty),+], $doc: expr, $optional_setter: ident,
$required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $supported_getter);
$required_setter: ident, $clear: ident, $supported_getter: ident, $required_getter: ident) => {
define_feature!($odd_bit, $feature, [$($context),+], $doc, $optional_setter, $required_setter, $clear, $supported_getter);
impl <T: $feature> Features<T> {
/// Checks if this feature is required.
pub fn $required_getter(&self) -> bool {
Expand All@@ -395,6 +402,7 @@ mod sealed {
"Feature flags for `option_data_loss_protect`.",
set_data_loss_protect_optional,
set_data_loss_protect_required,
clear_data_loss_protect,
supports_data_loss_protect,
requires_data_loss_protect
);
Expand All@@ -406,6 +414,7 @@ mod sealed {
"Feature flags for `initial_routing_sync`.",
set_initial_routing_sync_optional,
set_initial_routing_sync_required,
clear_initial_routing_sync,
initial_routing_sync
);
define_feature!(
Expand All@@ -415,6 +424,7 @@ mod sealed {
"Feature flags for `option_upfront_shutdown_script`.",
set_upfront_shutdown_script_optional,
set_upfront_shutdown_script_required,
clear_upfront_shutdown_script,
supports_upfront_shutdown_script,
requires_upfront_shutdown_script
);
Expand All@@ -425,6 +435,7 @@ mod sealed {
"Feature flags for `gossip_queries`.",
set_gossip_queries_optional,
set_gossip_queries_required,
clear_gossip_queries,
supports_gossip_queries,
requires_gossip_queries
);
Expand All@@ -435,6 +446,7 @@ mod sealed {
"Feature flags for `var_onion_optin`.",
set_variable_length_onion_optional,
set_variable_length_onion_required,
clear_variable_length_onion,
supports_variable_length_onion,
requires_variable_length_onion
);
Expand All@@ -445,6 +457,7 @@ mod sealed {
"Feature flags for `option_static_remotekey`.",
set_static_remote_key_optional,
set_static_remote_key_required,
clear_static_remote_key,
supports_static_remote_key,
requires_static_remote_key
);
Expand All@@ -455,6 +468,7 @@ mod sealed {
"Feature flags for `payment_secret`.",
set_payment_secret_optional,
set_payment_secret_required,
clear_payment_secret,
supports_payment_secret,
requires_payment_secret
);
Expand All@@ -465,6 +479,7 @@ mod sealed {
"Feature flags for `basic_mpp`.",
set_basic_mpp_optional,
set_basic_mpp_required,
clear_basic_mpp,
supports_basic_mpp,
requires_basic_mpp
);
Expand All@@ -475,6 +490,7 @@ mod sealed {
"Feature flags for `option_support_large_channel` (aka wumbo channels).",
set_wumbo_optional,
set_wumbo_required,
clear_wumbo,
supports_wumbo,
requires_wumbo
);
Expand All@@ -485,6 +501,7 @@ mod sealed {
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`.",
set_anchors_nonzero_fee_htlc_tx_optional,
set_anchors_nonzero_fee_htlc_tx_required,
clear_anchors_nonzero_fee_htlc_tx,
supports_anchors_nonzero_fee_htlc_tx,
requires_anchors_nonzero_fee_htlc_tx
);
Expand All@@ -495,6 +512,7 @@ mod sealed {
"Feature flags for `option_anchors_zero_fee_htlc_tx`.",
set_anchors_zero_fee_htlc_tx_optional,
set_anchors_zero_fee_htlc_tx_required,
clear_anchors_zero_fee_htlc_tx,
supports_anchors_zero_fee_htlc_tx,
requires_anchors_zero_fee_htlc_tx
);
Expand All@@ -505,6 +523,7 @@ mod sealed {
"Feature flags for `option_route_blinding`.",
set_route_blinding_optional,
set_route_blinding_required,
clear_route_blinding,
supports_route_blinding,
requires_route_blinding
);
Expand All@@ -515,6 +534,7 @@ mod sealed {
"Feature flags for `opt_shutdown_anysegwit`.",
set_shutdown_any_segwit_optional,
set_shutdown_any_segwit_required,
clear_shutdown_anysegwit,
supports_shutdown_anysegwit,
requires_shutdown_anysegwit
);
Expand All@@ -525,6 +545,7 @@ mod sealed {
"Feature flags for `option_dual_fund`.",
set_dual_fund_optional,
set_dual_fund_required,
clear_dual_fund,
supports_dual_fund,
requires_dual_fund
);
Expand All@@ -535,6 +556,7 @@ mod sealed {
"Feature flags for `option_taproot`.",
set_taproot_optional,
set_taproot_required,
clear_taproot,
supports_taproot,
requires_taproot
);
Expand All@@ -545,6 +567,7 @@ mod sealed {
"Feature flags for `option_quiesce`.",
set_quiescence_optional,
set_quiescence_required,
clear_quiescence,
supports_quiescence,
requires_quiescence
);
Expand All@@ -555,16 +578,29 @@ mod sealed {
"Feature flags for `option_onion_messages`.",
set_onion_messages_optional,
set_onion_messages_required,
clear_onion_messages,
supports_onion_messages,
requires_onion_messages
);
define_feature!(
41,
AnchorZeroFeeCommitments,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for `option_zero_fee_commitments`.",
set_anchor_zero_fee_commitments_optional,
set_anchor_zero_fee_commitments_required,
clear_anchor_zero_fee_commitments,
supports_anchor_zero_fee_commitments,
requires_anchor_zero_fee_commitments
);
define_feature!(
43,
ProvideStorage,
[InitContext, NodeContext],
"Feature flags for `option_provide_storage`.",
set_provide_storage_optional,
set_provide_storage_required,
clear_provide_storage,
supports_provide_storage,
requires_provide_storage
);
Expand All@@ -575,19 +611,28 @@ mod sealed {
"Feature flags for `option_channel_type`.",
set_channel_type_optional,
set_channel_type_required,
clear_channel_type,
supports_channel_type,
requires_channel_type
);
define_feature!(47, SCIDPrivacy, [InitContext, NodeContext, ChannelTypeContext],
define_feature!(47,
SCIDPrivacy,
[InitContext, NodeContext, ChannelTypeContext],
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs",
set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy);
set_scid_privacy_optional,
set_scid_privacy_required,
clear_scid_privacy,
supports_scid_privacy,
requires_scid_privacy
);
define_feature!(
49,
PaymentMetadata,
[Bolt11InvoiceContext],
"Feature flags for payment metadata in invoices.",
set_payment_metadata_optional,
set_payment_metadata_required,
clear_payment_metadata,
supports_payment_metadata,
requires_payment_metadata
);
Expand All@@ -601,6 +646,7 @@ mod sealed {
"Feature flags for keysend payments.",
set_keysend_optional,
set_keysend_required,
clear_keysend,
supports_keysend,
requires_keysend
);
Expand All@@ -611,6 +657,7 @@ mod sealed {
"Feature flags for Trampoline routing.",
set_trampoline_routing_optional,
set_trampoline_routing_required,
clear_trampoline_routing,
supports_trampoline_routing,
requires_trampoline_routing
);
Expand All@@ -621,6 +668,7 @@ mod sealed {
"Feature flags for DNS resolving.",
set_dns_resolution_optional,
set_dns_resolution_required,
clear_dns_resolution,
supports_dns_resolution,
requires_dns_resolution
);
Expand All@@ -643,6 +691,7 @@ mod sealed {
"Feature flags for an unknown feature used in testing.",
set_unknown_feature_optional,
set_unknown_feature_required,
clear_unknown_feature,
supports_unknown_test_feature,
requires_unknown_test_feature
);
Expand DownExpand Up@@ -1038,51 +1087,6 @@ impl<T: sealed::Context> Features<T> {
}
}

impl<T: sealed::UpfrontShutdownScript> Features<T> {
/// Unsets the `upfront_shutdown_script` feature
pub fn clear_upfront_shutdown_script(mut self) -> Self {
<T as sealed::UpfrontShutdownScript>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::ShutdownAnySegwit> Features<T> {
/// Unsets the `shutdown_anysegwit` feature
pub fn clear_shutdown_anysegwit(mut self) -> Self {
<T as sealed::ShutdownAnySegwit>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::Wumbo> Features<T> {
/// Unsets the `wumbo` feature
pub fn clear_wumbo(mut self) -> Self {
<T as sealed::Wumbo>::clear_bits(&mut self.flags);
self
}
}

impl<T: sealed::SCIDPrivacy> Features<T> {
/// Unsets the `scid_privacy` feature
pub fn clear_scid_privacy(&mut self) {
<T as sealed::SCIDPrivacy>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::AnchorsZeroFeeHtlcTx> Features<T> {
/// Unsets the `anchors_zero_fee_htlc_tx` feature
pub fn clear_anchors_zero_fee_htlc_tx(&mut self) {
<T as sealed::AnchorsZeroFeeHtlcTx>::clear_bits(&mut self.flags);
}
}

impl<T: sealed::RouteBlinding> Features<T> {
/// Unsets the `route_blinding` feature
pub fn clear_route_blinding(&mut self) {
<T as sealed::RouteBlinding>::clear_bits(&mut self.flags);
}
}

#[cfg(any(test, feature = "_test_utils"))]
impl<T: sealed::UnknownFeature> Features<T> {
/// Sets an unknown feature for testing
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
{
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
counterparty_payment_script =
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
}

let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/onchaintx.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {

// We'll locate an anchor output we can spend within the commitment transaction.
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
// An anchor output was found, so we should yield a funding event externally.
Some((idx, _)) => {
// TODO: Use a lower confirmation target when both our and the
Expand Down
Loading