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
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ jobs:
if [ "${{ matrix.msrv }}" = "true" ]; then rustup component add clippy; fi
- name: Check formatting
if: matrix.check-fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
run: |
rustup component add rustfmt
cargo fmt --all -- --check
# e2e-tests is excluded from the workspace and must be checked separately
cargo fmt --manifest-path e2e-tests/Cargo.toml --all -- --check
- name: Pin packages to allow for MSRV
if: matrix.msrv
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron-weekly-rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
components: rustfmt
- name: Run Nightly rustfmt
# Run the formatter and manually remove trailing whitespace.
run: cargo +nightly fmt && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//'
run: cargo +nightly fmt && cargo +nightly fmt --manifest-path e2e-tests/Cargo.toml && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//'
- name: Get the current date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create Pull Request
Expand Down
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for build commands, testing, code style,
## Development Rules

- Always ensure tests pass and lints are fixed before committing
- Run `cargo fmt --all` after every code change
- Run `cargo fmt --all` and `cargo fmt --manifest-path e2e-tests/Cargo.toml --all` after every code change.
The `e2e-tests` crate is excluded from the workspace, so it must be formatted separately.
- Never add new dependencies unless explicitly requested
- Please always disclose the use of any AI tools in commit messages and PR descriptions
12 changes: 7 additions & 5 deletions e2e-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ pub enum ChainSource {
rpc_password: String,
rest_address: Option<String>,
},
Electrum { server_url: String },
Esplora { server_url: String },
Electrum {
server_url: String,
},
Esplora {
server_url: String,
},
}

impl ChainSource {
Expand Down Expand Up @@ -793,9 +797,7 @@ pub async fn setup_funded_channel(
.open_channel(OpenChannelRequest {
node_pubkey: server_b.node_id().to_string(),
address: format!("127.0.0.1:{}", server_b.p2p_port),
amount: Some(open_channel_request::Amount::ChannelAmountSats(
channel_amount_sats,
)),
amount: Some(open_channel_request::Amount::ChannelAmountSats(channel_amount_sats)),
push_to_counterparty_msat: None,
channel_config: None,
announce_channel: true,
Expand Down
40 changes: 15 additions & 25 deletions e2e-tests/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,7 @@ async fn open_channel_via_cli(channel_amount: &str) {
let addr = format!("127.0.0.1:{}", server_b.p2p_port);
let output = run_cli(
&server_a,
&[
"open-channel",
server_b.node_id(),
&addr,
channel_amount,
"--announce-channel",
],
&["open-channel", server_b.node_id(), &addr, channel_amount, "--announce-channel"],
);
assert!(!output["user_channel_id"].as_str().unwrap().is_empty());
}
Expand Down Expand Up @@ -544,9 +538,7 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_closed() {
.open_channel(OpenChannelRequest {
node_pubkey: server_b.node_id().to_string(),
address: format!("127.0.0.1:{}", server_b.p2p_port),
amount: Some(open_channel_request::Amount::ChannelAmountSats(
100_000,
)),
amount: Some(open_channel_request::Amount::ChannelAmountSats(100_000)),
push_to_counterparty_msat: None,
channel_config: None,
announce_channel: true,
Expand Down Expand Up @@ -574,7 +566,10 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_closed() {
assert!(pending_a.reason.is_none());
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));
assert_ne!(
pending_a.former_temporary_channel_id.as_deref(),
Some(pending_a.channel_id.as_str())
);

let pending_b = wait_for_event(&mut events_b, |e| {
matches!(
Expand Down Expand Up @@ -712,9 +707,7 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_force_close
.open_channel(OpenChannelRequest {
node_pubkey: server_b.node_id().to_string(),
address: format!("127.0.0.1:{}", server_b.p2p_port),
amount: Some(open_channel_request::Amount::ChannelAmountSats(
100_000,
)),
amount: Some(open_channel_request::Amount::ChannelAmountSats(100_000)),
push_to_counterparty_msat: None,
channel_config: None,
announce_channel: true,
Expand Down Expand Up @@ -742,7 +735,10 @@ async fn test_subscribe_events_channel_state_lifecycle_pending_ready_force_close
assert!(pending_a.reason.is_none());
assert_eq!(pending_a.closure_initiator, ChannelClosureInitiator::Unspecified as i32);
assert!(pending_a.former_temporary_channel_id.as_deref().is_some_and(|id| !id.is_empty()));
assert_ne!(pending_a.former_temporary_channel_id.as_deref(), Some(pending_a.channel_id.as_str()));
assert_ne!(
pending_a.former_temporary_channel_id.as_deref(),
Some(pending_a.channel_id.as_str())
);

let pending_b = wait_for_event(&mut events_b, |e| {
matches!(
Expand Down Expand Up @@ -1335,14 +1331,11 @@ async fn splice_in_via_cli(splice_amount: &str) {

let mut events_a = server_a.client().subscribe_events().await.unwrap();

let output = run_cli(
&server_a,
&["splice-in", &user_channel_id, server_b.node_id(), splice_amount],
);
let output =
run_cli(&server_a, &["splice-in", &user_channel_id, server_b.node_id(), splice_amount]);
assert!(output.is_object());

let event_a =
wait_for_event(&mut events_a, |e| matches!(e, Event::SpliceNegotiated(_))).await;
let event_a = wait_for_event(&mut events_a, |e| matches!(e, Event::SpliceNegotiated(_))).await;
match &event_a.event {
Some(Event::SpliceNegotiated(splice_negotiated)) => {
assert_eq!(splice_negotiated.user_channel_id, user_channel_id);
Expand Down Expand Up @@ -1884,10 +1877,7 @@ async fn test_hodl_invoice_fail() {
panic!("expected PaymentFailed");
};
assert!(!failed.payment.as_ref().unwrap().payment_id.is_empty());
assert_eq!(
failed.reason,
Some(PaymentFailureReason::RecipientRejected as i32)
);
assert_eq!(failed.reason, Some(PaymentFailureReason::RecipientRejected as i32));
}

#[tokio::test]
Expand Down
Loading