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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
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
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
rustup override set ${{ matrix.toolchain }}
- name: Check formatting on Rust ${{ matrix.toolchain }}
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
[toolchain]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I simply run cargo fmt, isn't that supposed to just work?

~/repo/ldk-node (2025-10-switch-to-nightly-rustfmt ✔) cargo fmt Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 100`, unstable features are only available in nightly channel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried now about IDE support

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you happen to have set an override for LDK Node? I.e., rustup override set XXX? Otherwise it should indeed use what's inteh rust-toolchain.toml.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in your case if you do:

?main ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-stable (1159e78c47 2025-09-14)
?main ~/workspace/ldk-node> git checkout 2025-10-switch-to-nightly-rustfmt
Switched to branch '2025-10-switch-to-nightly-rustfmt'
Your branch is up to date with 'origin/2025-10-switch-to-nightly-rustfmt'.
?2025-10-switch-to-nightly-rustfmt ~/workspace/ldk-node> cargo fmt --version
rustfmt 1.8.0-nightly (f6aa851dba 2025-10-07)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was it indeed. Had been reproducing issues on older rust version with the override. All good then. Farewell to the import nits 😎

channel = "nightly-2025-10-08"
components = [ "rustfmt" ]
profile = "minimal"
21 changes: 13 additions & 8 deletions rustfmt.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,11 +4,16 @@ hard_tabs = true
use_field_init_shorthand = true
max_width = 100
match_block_trailing_comma = true
# UNSTABLE: format_code_in_doc_comments = true
# UNSTABLE: overflow_delimited_expr = true
# UNSTABLE: comment_width = 100
# UNSTABLE: format_macro_matchers = true
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
format_code_in_doc_comments = true
overflow_delimited_expr = true
comment_width = 100
format_macro_matchers = true
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"
normalize_comments = true
normalize_doc_attributes = true
style_edition = "2021"
# TBD: do we want comment and string wrapping?
#wrap_comments = true
#format_strings = true
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -628,10 +628,9 @@ impl NodeBuilder {
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;

let lnurl_auth_xprv = vss_xprv
.derive_priv(
&Secp256k1::new(),
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
)
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
}])
.map_err(|e| {
log_error!(logger, "Failed to derive VSS secret: {}", e);
BuildError::KVStoreSetupFailed
Expand Down
10 changes: 5 additions & 5 deletions src/chain/bitcoind.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,7 +415,7 @@ impl BitcoindChainSource {

pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
macro_rules! get_fee_rate_update {
($estimation_fut:expr) => {{
($estimation_fut:expr) => {{
let update_res = tokio::time::timeout(
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
$estimation_fut,
Expand DownExpand Up@@ -701,10 +701,10 @@ impl BitcoindClient {
let num_blocks_json = serde_json::json!(num_blocks);
let estimation_mode_json = serde_json::json!(estimation_mode);
rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&[num_blocks_json, estimation_mode_json],
)
.call_method::<FeeResponse>("estimatesmartfee", &[
num_blocks_json,
estimation_mode_json,
])
.await
.map(|resp| resp.0)
}
Expand Down
3 changes: 1 addition & 2 deletions src/io/test_utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
use lightning::util::persist::{
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};

use lightning::util::test_utils;
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
use rand::distributions::Alphanumeric;
Expand DownExpand Up@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {

// Helper to make sure the channel is on the expected update ID.
macro_rules! check_persisted_data {
($expected_update_id:expr) => {
($expected_update_id:expr) => {
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
assert_eq!(persisted_chan_data_0.len(), 1);
for (_, mon) in persisted_chan_data_0.iter() {
Expand Down
9 changes: 8 additions & 1 deletion src/io/utils.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
}

macro_rules! impl_read_write_change_set_type {
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
(
$read_name:ident,
$write_name:ident,
$change_set_type:ty,
$primary_namespace:expr,
$secondary_namespace:expr,
$key:expr
) => {
pub(crate) fn $read_name<L: Deref>(
kv_store: Arc<DynStore>, logger: L,
) -> Result<Option<$change_set_type>, std::io::Error>
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,18 +25,21 @@
//! ```no_run
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use ldk_node::Builder;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use std::str::FromStr;
//!
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use ldk_node::lightning::ln::msgs::SocketAddress;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::Builder;
//!
//! fn main() {
//! let mut builder = Builder::new();
//! builder.set_network(Network::Testnet);
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
//! builder.set_gossip_source_rgs(
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
//! );
//!
//! let node = builder.build().unwrap();
//!
Expand DownExpand Up@@ -67,7 +70,6 @@
//! [`stop`]: Node::stop
//! [`open_channel`]: Node::open_channel
//! [`send`]: Bolt11Payment::send
//!
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down
12 changes: 4 additions & 8 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,14 +271,10 @@ mod tests {
}

fn blinded_path() -> BlindedMessagePath {
BlindedMessagePath::from_blinded_path(
pubkey(40),
pubkey(41),
vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
],
)
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
])
}

fn pubkey(byte: u8) -> PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion src/payment/onchain.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
type FeeRate = Arc<bitcoin::FeeRate>;

macro_rules! maybe_map_fee_rate_opt {
($fee_rate_opt:expr) => {{
($fee_rate_opt:expr) => {{
#[cfg(not(feature = "uniffi"))]
{
$fee_rate_opt
Expand Down
2 changes: 1 addition & 1 deletion src/payment/store.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,7 +179,7 @@ impl StorableObject for PaymentDetails {
let mut updated = false;

macro_rules! update_if_necessary {
($val:expr, $update:expr) => {
($val:expr, $update:expr) => {
if $val != $update {
$val = $update;
updated = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -631,7 +631,7 @@ impl Wallet {
script_pubkey: ScriptBuf::new_witness_program(&witness_program),
},
satisfaction_weight: 1 /* empty script_sig */ * WITNESS_SCALE_FACTOR as u64 +
1 /* witness items */ + 1 /* schnorr sig len */ + 64, /* schnorr sig */
1 /* witness items */ + 1 /* schnorr sig len */ + 64, // schnorr sig
};
utxos.push(utxo);
},
Expand Down
14 changes: 7 additions & 7 deletions tests/common/mod.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ use rand::{thread_rng, Rng};
use serde_json::{json, Value};

macro_rules! expect_event {
($node:expr, $event_type:ident) => {{
($node:expr, $event_type:ident) => {{
match $node.wait_next_event() {
ref e @ Event::$event_type { .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -64,7 +64,7 @@ macro_rules! expect_event {
pub(crate) use expect_event;

macro_rules! expect_channel_pending_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelPending { funding_txo, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -82,7 +82,7 @@ macro_rules! expect_channel_pending_event {
pub(crate) use expect_channel_pending_event;

macro_rules! expect_channel_ready_event {
($node:expr, $counterparty_node_id:expr) => {{
($node:expr, $counterparty_node_id:expr) => {{
match $node.wait_next_event() {
ref e @ Event::ChannelReady { user_channel_id, counterparty_node_id, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -100,7 +100,7 @@ macro_rules! expect_channel_ready_event {
pub(crate) use expect_channel_ready_event;

macro_rules! expect_payment_received_event {
($node:expr, $amount_msat:expr) => {{
($node:expr, $amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentReceived { payment_id, amount_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand All@@ -122,7 +122,7 @@ macro_rules! expect_payment_received_event {
pub(crate) use expect_payment_received_event;

macro_rules! expect_payment_claimable_event {
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
($node:expr, $payment_id:expr, $payment_hash:expr, $claimable_amount_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentClaimable {
payment_id,
Expand All@@ -147,7 +147,7 @@ macro_rules! expect_payment_claimable_event {
pub(crate) use expect_payment_claimable_event;

macro_rules! expect_payment_successful_event {
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
($node:expr, $payment_id:expr, $fee_paid_msat:expr) => {{
match $node.wait_next_event() {
ref e @ Event::PaymentSuccessful { payment_id, fee_paid_msat, .. } => {
println!("{} got event {:?}", $node.node_id(), e);
Expand DownExpand Up@@ -269,7 +269,7 @@ pub(crate) struct TestConfig {
}

macro_rules! setup_builder {
($builder:ident, $config:expr) => {
($builder:ident, $config:expr) => {
#[cfg(feature = "uniffi")]
let $builder = Builder::from_config($config.clone());
#[cfg(not(feature = "uniffi"))]
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_tests_rust.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -687,7 +687,7 @@ fn run_rbf_test(is_insert_block: bool) {
let chain_source_esplora = TestChainSource::Esplora(&electrsd);

macro_rules! config_node {
($chain_source:expr, $anchor_channels:expr) => {{
($chain_source:expr, $anchor_channels:expr) => {{
let config_a = random_config($anchor_channels);
let node = setup_node(&$chain_source, config_a, None);
node
Expand DownExpand Up@@ -719,7 +719,7 @@ fn run_rbf_test(is_insert_block: bool) {
};
}
macro_rules! validate_balances {
($expected_balance_sat:expr, $is_spendable:expr) => {
($expected_balance_sat:expr, $is_spendable:expr) => {
let spend_balance = if $is_spendable { $expected_balance_sat } else { 0 };
for node in &nodes {
node.sync_wallets().unwrap();
Expand DownExpand Up@@ -972,8 +972,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand DownExpand Up@@ -1038,8 +1038,8 @@ fn simple_bolt12_send_receive() {
assert_eq!(offer_id, offer.id());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0);
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
hash.unwrap()
},
_ => {
Expand DownExpand Up@@ -1104,8 +1104,8 @@ fn simple_bolt12_send_receive() {
assert!(preimage.is_some());
assert_eq!(&expected_quantity, qty);
assert_eq!(expected_payer_note.unwrap(), note.clone().unwrap().0)
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
//API currently doesn't allow to do that.
},
_ => {
panic!("Unexpected payment kind");
Expand Down
Loading