From 5bfa819075a489f6b9241519b154958ad08b1e18 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Fri, 10 Apr 2026 12:00:13 +0200 Subject: [PATCH 1/2] Replace hashes_fuzz with local fuzz gates --- Cargo.toml | 1 - ci/check-compiles.sh | 2 +- fuzz/.cargo/config.toml | 2 +- fuzz/Cargo.toml | 1 - fuzz/README.md | 2 +- fuzz/ci-fuzz.sh | 2 +- fuzz/src/bin/base32_target.rs | 3 - fuzz/src/bin/bech32_parse_target.rs | 3 - fuzz/src/bin/bolt11_deser_target.rs | 3 - fuzz/src/bin/chanmon_consistency_target.rs | 3 - fuzz/src/bin/chanmon_deser_target.rs | 3 - fuzz/src/bin/feature_flags_target.rs | 3 - fuzz/src/bin/fromstr_to_netaddress_target.rs | 3 - fuzz/src/bin/fs_store_target.rs | 3 - fuzz/src/bin/full_stack_target.rs | 3 - fuzz/src/bin/gossip_discovery_target.rs | 3 - fuzz/src/bin/indexedmap_target.rs | 3 - fuzz/src/bin/invoice_deser_target.rs | 3 - fuzz/src/bin/invoice_request_deser_target.rs | 3 - fuzz/src/bin/lsps_message_target.rs | 3 - fuzz/src/bin/msg_accept_channel_target.rs | 3 - fuzz/src/bin/msg_accept_channel_v2_target.rs | 3 - .../bin/msg_announcement_signatures_target.rs | 3 - .../bin/msg_blinded_message_path_target.rs | 3 - .../bin/msg_channel_announcement_target.rs | 3 - fuzz/src/bin/msg_channel_details_target.rs | 3 - fuzz/src/bin/msg_channel_ready_target.rs | 3 - .../src/bin/msg_channel_reestablish_target.rs | 3 - fuzz/src/bin/msg_channel_update_target.rs | 3 - fuzz/src/bin/msg_closing_complete_target.rs | 3 - fuzz/src/bin/msg_closing_sig_target.rs | 3 - fuzz/src/bin/msg_closing_signed_target.rs | 3 - fuzz/src/bin/msg_commitment_signed_target.rs | 3 - .../msg_decoded_onion_error_packet_target.rs | 3 - fuzz/src/bin/msg_error_message_target.rs | 3 - fuzz/src/bin/msg_funding_created_target.rs | 3 - fuzz/src/bin/msg_funding_signed_target.rs | 3 - .../bin/msg_gossip_timestamp_filter_target.rs | 3 - fuzz/src/bin/msg_init_target.rs | 3 - fuzz/src/bin/msg_node_announcement_target.rs | 3 - fuzz/src/bin/msg_open_channel_target.rs | 3 - fuzz/src/bin/msg_open_channel_v2_target.rs | 3 - fuzz/src/bin/msg_ping_target.rs | 3 - fuzz/src/bin/msg_pong_target.rs | 3 - .../src/bin/msg_query_channel_range_target.rs | 3 - .../bin/msg_query_short_channel_ids_target.rs | 3 - .../src/bin/msg_reply_channel_range_target.rs | 3 - .../msg_reply_short_channel_ids_end_target.rs | 3 - fuzz/src/bin/msg_revoke_and_ack_target.rs | 3 - fuzz/src/bin/msg_shutdown_target.rs | 3 - fuzz/src/bin/msg_splice_ack_target.rs | 3 - fuzz/src/bin/msg_splice_init_target.rs | 3 - fuzz/src/bin/msg_splice_locked_target.rs | 3 - fuzz/src/bin/msg_stfu_target.rs | 3 - fuzz/src/bin/msg_tx_abort_target.rs | 3 - fuzz/src/bin/msg_tx_ack_rbf_target.rs | 3 - fuzz/src/bin/msg_tx_add_input_target.rs | 3 - fuzz/src/bin/msg_tx_add_output_target.rs | 3 - fuzz/src/bin/msg_tx_complete_target.rs | 3 - fuzz/src/bin/msg_tx_init_rbf_target.rs | 3 - fuzz/src/bin/msg_tx_remove_input_target.rs | 3 - fuzz/src/bin/msg_tx_remove_output_target.rs | 3 - fuzz/src/bin/msg_tx_signatures_target.rs | 3 - fuzz/src/bin/msg_update_add_htlc_target.rs | 3 - fuzz/src/bin/msg_update_fail_htlc_target.rs | 3 - .../msg_update_fail_malformed_htlc_target.rs | 3 - fuzz/src/bin/msg_update_fee_target.rs | 3 - .../src/bin/msg_update_fulfill_htlc_target.rs | 3 - fuzz/src/bin/offer_deser_target.rs | 3 - fuzz/src/bin/onion_hop_data_target.rs | 3 - fuzz/src/bin/onion_message_target.rs | 3 - fuzz/src/bin/peer_crypt_target.rs | 3 - fuzz/src/bin/process_network_graph_target.rs | 3 - fuzz/src/bin/process_onion_failure_target.rs | 3 - fuzz/src/bin/refund_deser_target.rs | 3 - fuzz/src/bin/router_target.rs | 3 - fuzz/src/bin/static_invoice_deser_target.rs | 3 - fuzz/src/bin/target_template.txt | 3 - fuzz/src/bin/zbase32_target.rs | 3 - fuzz/src/chanmon_consistency.rs | 37 ++++++---- fuzz/src/full_stack.rs | 73 +++++++++++++------ fuzz/src/lib.rs | 3 - lightning-liquidity/Cargo.toml | 1 + lightning-liquidity/src/lsps2/utils.rs | 19 ++++- lightning/src/crypto/chacha20poly1305rfc.rs | 6 +- lightning/src/crypto/mod.rs | 9 --- lightning/src/crypto/streams.rs | 8 +- lightning/src/ln/inbound_payment.rs | 17 ++--- lightning/src/ln/onion_payment.rs | 4 +- lightning/src/ln/onion_utils.rs | 10 ++- lightning/src/util/fuzz_wrappers.rs | 38 ++++++++++ 91 files changed, 157 insertions(+), 297 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7978d9de6a0..e8ecaf932a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,6 @@ level = "forbid" check-cfg = [ "cfg(fuzzing)", "cfg(secp256k1_fuzz)", - "cfg(hashes_fuzz)", "cfg(test)", "cfg(debug_assertions)", "cfg(c_bindings)", diff --git a/ci/check-compiles.sh b/ci/check-compiles.sh index a067861fb56..c141ac919cf 100755 --- a/ci/check-compiles.sh +++ b/ci/check-compiles.sh @@ -5,6 +5,6 @@ echo "Testing $(git log -1 --oneline)" cargo check cargo doc cargo doc --document-private-items -cd fuzz && RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo check --features=stdin_fuzz +cd fuzz && RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz" cargo check --features=stdin_fuzz cd ../lightning && cargo check --no-default-features cd .. && RUSTC_BOOTSTRAP=1 RUSTFLAGS="--cfg=c_bindings" cargo check -Z avoid-dev-deps diff --git a/fuzz/.cargo/config.toml b/fuzz/.cargo/config.toml index 86513788566..4ca5cb3604c 100644 --- a/fuzz/.cargo/config.toml +++ b/fuzz/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -rustflags = ["--cfg=fuzzing", "--cfg=secp256k1_fuzz", "--cfg=hashes_fuzz"] +rustflags = ["--cfg=fuzzing", "--cfg=secp256k1_fuzz"] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 5a2e397a064..5528515752a 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -61,5 +61,4 @@ level = "forbid" check-cfg = [ "cfg(fuzzing)", "cfg(secp256k1_fuzz)", - "cfg(hashes_fuzz)", ] diff --git a/fuzz/README.md b/fuzz/README.md index 4af70390d7d..40f1a4b91e9 100644 --- a/fuzz/README.md +++ b/fuzz/README.md @@ -62,7 +62,7 @@ To run fuzzing using `cargo-fuzz / libFuzzer`, run ```shell rustup install nightly # Note: libFuzzer requires a nightly version of rust. -export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" +export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz" cargo +nightly fuzz run --features "libfuzzer_fuzz" msg_ping_target ``` Note: If you encounter a `SIGKILL` during run/build check for OOM in kernel logs and consider diff --git a/fuzz/ci-fuzz.sh b/fuzz/ci-fuzz.sh index 47bf41ba620..0bc561cdd8c 100755 --- a/fuzz/ci-fuzz.sh +++ b/fuzz/ci-fuzz.sh @@ -13,7 +13,7 @@ rm *_target.rs [ "$(git diff)" != "" ] && exit 1 popd -export RUSTFLAGS="--cfg=secp256k1_fuzz --cfg=hashes_fuzz" +export RUSTFLAGS="--cfg=secp256k1_fuzz" mkdir -p hfuzz_workspace/full_stack_target/input pushd write-seeds diff --git a/fuzz/src/bin/base32_target.rs b/fuzz/src/bin/base32_target.rs index e79e6db7380..dd232bf8213 100644 --- a/fuzz/src/bin/base32_target.rs +++ b/fuzz/src/bin/base32_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/bech32_parse_target.rs b/fuzz/src/bin/bech32_parse_target.rs index f9493bb1bc1..a459d74fa6d 100644 --- a/fuzz/src/bin/bech32_parse_target.rs +++ b/fuzz/src/bin/bech32_parse_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/bolt11_deser_target.rs b/fuzz/src/bin/bolt11_deser_target.rs index 28b1e2db679..ceb5dea9903 100644 --- a/fuzz/src/bin/bolt11_deser_target.rs +++ b/fuzz/src/bin/bolt11_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/chanmon_consistency_target.rs b/fuzz/src/bin/chanmon_consistency_target.rs index 7649900bae5..34abd49e97d 100644 --- a/fuzz/src/bin/chanmon_consistency_target.rs +++ b/fuzz/src/bin/chanmon_consistency_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/chanmon_deser_target.rs b/fuzz/src/bin/chanmon_deser_target.rs index d3cf30b86e3..d895c59af81 100644 --- a/fuzz/src/bin/chanmon_deser_target.rs +++ b/fuzz/src/bin/chanmon_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/feature_flags_target.rs b/fuzz/src/bin/feature_flags_target.rs index b1f35f8820f..e4476e041a9 100644 --- a/fuzz/src/bin/feature_flags_target.rs +++ b/fuzz/src/bin/feature_flags_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/fromstr_to_netaddress_target.rs b/fuzz/src/bin/fromstr_to_netaddress_target.rs index 8f3e5c3dc7f..d91992dfc0c 100644 --- a/fuzz/src/bin/fromstr_to_netaddress_target.rs +++ b/fuzz/src/bin/fromstr_to_netaddress_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/fs_store_target.rs b/fuzz/src/bin/fs_store_target.rs index 8d84aad7b6b..cf2ff56250a 100644 --- a/fuzz/src/bin/fs_store_target.rs +++ b/fuzz/src/bin/fs_store_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/full_stack_target.rs b/fuzz/src/bin/full_stack_target.rs index c1f20b10af4..2595345cd7d 100644 --- a/fuzz/src/bin/full_stack_target.rs +++ b/fuzz/src/bin/full_stack_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/gossip_discovery_target.rs b/fuzz/src/bin/gossip_discovery_target.rs index 960ba80ec8c..0658693a6ee 100644 --- a/fuzz/src/bin/gossip_discovery_target.rs +++ b/fuzz/src/bin/gossip_discovery_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/indexedmap_target.rs b/fuzz/src/bin/indexedmap_target.rs index 3bc4390fee4..2cb5110aa9f 100644 --- a/fuzz/src/bin/indexedmap_target.rs +++ b/fuzz/src/bin/indexedmap_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/invoice_deser_target.rs b/fuzz/src/bin/invoice_deser_target.rs index 44bf1851a40..da9d3e5b45e 100644 --- a/fuzz/src/bin/invoice_deser_target.rs +++ b/fuzz/src/bin/invoice_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/invoice_request_deser_target.rs b/fuzz/src/bin/invoice_request_deser_target.rs index 06d8f87fa55..5d192eb17ea 100644 --- a/fuzz/src/bin/invoice_request_deser_target.rs +++ b/fuzz/src/bin/invoice_request_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/lsps_message_target.rs b/fuzz/src/bin/lsps_message_target.rs index 37e6f103fb4..8bd25d056bb 100644 --- a/fuzz/src/bin/lsps_message_target.rs +++ b/fuzz/src/bin/lsps_message_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_accept_channel_target.rs b/fuzz/src/bin/msg_accept_channel_target.rs index ee08a5fc344..9fa42ff25c5 100644 --- a/fuzz/src/bin/msg_accept_channel_target.rs +++ b/fuzz/src/bin/msg_accept_channel_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_accept_channel_v2_target.rs b/fuzz/src/bin/msg_accept_channel_v2_target.rs index 2903e111f56..8d8094318d8 100644 --- a/fuzz/src/bin/msg_accept_channel_v2_target.rs +++ b/fuzz/src/bin/msg_accept_channel_v2_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_announcement_signatures_target.rs b/fuzz/src/bin/msg_announcement_signatures_target.rs index 064880abc18..a48e1e85a4a 100644 --- a/fuzz/src/bin/msg_announcement_signatures_target.rs +++ b/fuzz/src/bin/msg_announcement_signatures_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_blinded_message_path_target.rs b/fuzz/src/bin/msg_blinded_message_path_target.rs index 277e04c9656..d8986c24ce9 100644 --- a/fuzz/src/bin/msg_blinded_message_path_target.rs +++ b/fuzz/src/bin/msg_blinded_message_path_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_channel_announcement_target.rs b/fuzz/src/bin/msg_channel_announcement_target.rs index 42e72d54b72..b62fba2bd3f 100644 --- a/fuzz/src/bin/msg_channel_announcement_target.rs +++ b/fuzz/src/bin/msg_channel_announcement_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_channel_details_target.rs b/fuzz/src/bin/msg_channel_details_target.rs index a03a7a44920..28e850a9d8e 100644 --- a/fuzz/src/bin/msg_channel_details_target.rs +++ b/fuzz/src/bin/msg_channel_details_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_channel_ready_target.rs b/fuzz/src/bin/msg_channel_ready_target.rs index a0457815036..96b5da94a8c 100644 --- a/fuzz/src/bin/msg_channel_ready_target.rs +++ b/fuzz/src/bin/msg_channel_ready_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_channel_reestablish_target.rs b/fuzz/src/bin/msg_channel_reestablish_target.rs index b5449a90e37..094e7be21f3 100644 --- a/fuzz/src/bin/msg_channel_reestablish_target.rs +++ b/fuzz/src/bin/msg_channel_reestablish_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_channel_update_target.rs b/fuzz/src/bin/msg_channel_update_target.rs index 9feb6e6c6b4..323cd8d4a24 100644 --- a/fuzz/src/bin/msg_channel_update_target.rs +++ b/fuzz/src/bin/msg_channel_update_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_closing_complete_target.rs b/fuzz/src/bin/msg_closing_complete_target.rs index 22dd97c79c9..774b99ebebe 100644 --- a/fuzz/src/bin/msg_closing_complete_target.rs +++ b/fuzz/src/bin/msg_closing_complete_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_closing_sig_target.rs b/fuzz/src/bin/msg_closing_sig_target.rs index 26058a5277d..511ce541ebd 100644 --- a/fuzz/src/bin/msg_closing_sig_target.rs +++ b/fuzz/src/bin/msg_closing_sig_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_closing_signed_target.rs b/fuzz/src/bin/msg_closing_signed_target.rs index 94408bc2ba9..8466678a81e 100644 --- a/fuzz/src/bin/msg_closing_signed_target.rs +++ b/fuzz/src/bin/msg_closing_signed_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_commitment_signed_target.rs b/fuzz/src/bin/msg_commitment_signed_target.rs index e8987848417..732fda48106 100644 --- a/fuzz/src/bin/msg_commitment_signed_target.rs +++ b/fuzz/src/bin/msg_commitment_signed_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs index 47d8970b453..cc51305ca94 100644 --- a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs +++ b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_error_message_target.rs b/fuzz/src/bin/msg_error_message_target.rs index ee3904a724e..890823e7547 100644 --- a/fuzz/src/bin/msg_error_message_target.rs +++ b/fuzz/src/bin/msg_error_message_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_funding_created_target.rs b/fuzz/src/bin/msg_funding_created_target.rs index 028aa17ad8a..1ccfd228eee 100644 --- a/fuzz/src/bin/msg_funding_created_target.rs +++ b/fuzz/src/bin/msg_funding_created_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_funding_signed_target.rs b/fuzz/src/bin/msg_funding_signed_target.rs index 4894c66df0b..6ad65745144 100644 --- a/fuzz/src/bin/msg_funding_signed_target.rs +++ b/fuzz/src/bin/msg_funding_signed_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs index 6da383b2e6f..f6980bf05e4 100644 --- a/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs +++ b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_init_target.rs b/fuzz/src/bin/msg_init_target.rs index f1d17c99289..af2cf6fe4db 100644 --- a/fuzz/src/bin/msg_init_target.rs +++ b/fuzz/src/bin/msg_init_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_node_announcement_target.rs b/fuzz/src/bin/msg_node_announcement_target.rs index b0615f3c5e5..7538416fc2d 100644 --- a/fuzz/src/bin/msg_node_announcement_target.rs +++ b/fuzz/src/bin/msg_node_announcement_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_open_channel_target.rs b/fuzz/src/bin/msg_open_channel_target.rs index b3dbf388c08..543625ef029 100644 --- a/fuzz/src/bin/msg_open_channel_target.rs +++ b/fuzz/src/bin/msg_open_channel_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_open_channel_v2_target.rs b/fuzz/src/bin/msg_open_channel_v2_target.rs index 0df11adf32e..d78c233cba0 100644 --- a/fuzz/src/bin/msg_open_channel_v2_target.rs +++ b/fuzz/src/bin/msg_open_channel_v2_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_ping_target.rs b/fuzz/src/bin/msg_ping_target.rs index 48f855985de..fedccc31c40 100644 --- a/fuzz/src/bin/msg_ping_target.rs +++ b/fuzz/src/bin/msg_ping_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_pong_target.rs b/fuzz/src/bin/msg_pong_target.rs index 434e9cfe310..7d801448f0e 100644 --- a/fuzz/src/bin/msg_pong_target.rs +++ b/fuzz/src/bin/msg_pong_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_query_channel_range_target.rs b/fuzz/src/bin/msg_query_channel_range_target.rs index cb87260e1ef..dcf581100c0 100644 --- a/fuzz/src/bin/msg_query_channel_range_target.rs +++ b/fuzz/src/bin/msg_query_channel_range_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_query_short_channel_ids_target.rs b/fuzz/src/bin/msg_query_short_channel_ids_target.rs index bc286a7e523..d259a7c0f27 100644 --- a/fuzz/src/bin/msg_query_short_channel_ids_target.rs +++ b/fuzz/src/bin/msg_query_short_channel_ids_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_reply_channel_range_target.rs b/fuzz/src/bin/msg_reply_channel_range_target.rs index c7df076c6c6..e133e3724f8 100644 --- a/fuzz/src/bin/msg_reply_channel_range_target.rs +++ b/fuzz/src/bin/msg_reply_channel_range_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs index 2c73d866bd9..d6bb2b7b52d 100644 --- a/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs +++ b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_revoke_and_ack_target.rs b/fuzz/src/bin/msg_revoke_and_ack_target.rs index 6379d39591f..db3477c51f4 100644 --- a/fuzz/src/bin/msg_revoke_and_ack_target.rs +++ b/fuzz/src/bin/msg_revoke_and_ack_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_shutdown_target.rs b/fuzz/src/bin/msg_shutdown_target.rs index 6bf0409b7b5..12e076fc071 100644 --- a/fuzz/src/bin/msg_shutdown_target.rs +++ b/fuzz/src/bin/msg_shutdown_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_splice_ack_target.rs b/fuzz/src/bin/msg_splice_ack_target.rs index 96f373d5a1c..7af1b072d5a 100644 --- a/fuzz/src/bin/msg_splice_ack_target.rs +++ b/fuzz/src/bin/msg_splice_ack_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_splice_init_target.rs b/fuzz/src/bin/msg_splice_init_target.rs index 73d4319c44a..941afebbddf 100644 --- a/fuzz/src/bin/msg_splice_init_target.rs +++ b/fuzz/src/bin/msg_splice_init_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_splice_locked_target.rs b/fuzz/src/bin/msg_splice_locked_target.rs index 9210113a0c8..b52e6332939 100644 --- a/fuzz/src/bin/msg_splice_locked_target.rs +++ b/fuzz/src/bin/msg_splice_locked_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_stfu_target.rs b/fuzz/src/bin/msg_stfu_target.rs index d00536c7bcd..fbcff4b7879 100644 --- a/fuzz/src/bin/msg_stfu_target.rs +++ b/fuzz/src/bin/msg_stfu_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_abort_target.rs b/fuzz/src/bin/msg_tx_abort_target.rs index 8f216b46e63..d6f7a730264 100644 --- a/fuzz/src/bin/msg_tx_abort_target.rs +++ b/fuzz/src/bin/msg_tx_abort_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_ack_rbf_target.rs b/fuzz/src/bin/msg_tx_ack_rbf_target.rs index 90b34c7f93f..cf28bf66b42 100644 --- a/fuzz/src/bin/msg_tx_ack_rbf_target.rs +++ b/fuzz/src/bin/msg_tx_ack_rbf_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_add_input_target.rs b/fuzz/src/bin/msg_tx_add_input_target.rs index ce9700bd344..97f4e019210 100644 --- a/fuzz/src/bin/msg_tx_add_input_target.rs +++ b/fuzz/src/bin/msg_tx_add_input_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_add_output_target.rs b/fuzz/src/bin/msg_tx_add_output_target.rs index 02682194e13..8b9e7f3619d 100644 --- a/fuzz/src/bin/msg_tx_add_output_target.rs +++ b/fuzz/src/bin/msg_tx_add_output_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_complete_target.rs b/fuzz/src/bin/msg_tx_complete_target.rs index 48864f053c8..c5dfde5ff81 100644 --- a/fuzz/src/bin/msg_tx_complete_target.rs +++ b/fuzz/src/bin/msg_tx_complete_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_init_rbf_target.rs b/fuzz/src/bin/msg_tx_init_rbf_target.rs index a8b613cdfca..16dd3440742 100644 --- a/fuzz/src/bin/msg_tx_init_rbf_target.rs +++ b/fuzz/src/bin/msg_tx_init_rbf_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_remove_input_target.rs b/fuzz/src/bin/msg_tx_remove_input_target.rs index 1e46c547dbf..42d2ab8751c 100644 --- a/fuzz/src/bin/msg_tx_remove_input_target.rs +++ b/fuzz/src/bin/msg_tx_remove_input_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_remove_output_target.rs b/fuzz/src/bin/msg_tx_remove_output_target.rs index 3a9c178e75f..b825d47622a 100644 --- a/fuzz/src/bin/msg_tx_remove_output_target.rs +++ b/fuzz/src/bin/msg_tx_remove_output_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_tx_signatures_target.rs b/fuzz/src/bin/msg_tx_signatures_target.rs index 77f34cc1f6a..8099b08a121 100644 --- a/fuzz/src/bin/msg_tx_signatures_target.rs +++ b/fuzz/src/bin/msg_tx_signatures_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_update_add_htlc_target.rs b/fuzz/src/bin/msg_update_add_htlc_target.rs index 3ff5cf83dbe..50ed3827fdb 100644 --- a/fuzz/src/bin/msg_update_add_htlc_target.rs +++ b/fuzz/src/bin/msg_update_add_htlc_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_update_fail_htlc_target.rs b/fuzz/src/bin/msg_update_fail_htlc_target.rs index 5b8a7e55dcb..b476efb4393 100644 --- a/fuzz/src/bin/msg_update_fail_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_htlc_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs index e3e8918e492..0874ad20d04 100644 --- a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_update_fee_target.rs b/fuzz/src/bin/msg_update_fee_target.rs index 98e51181c79..df95d783fa8 100644 --- a/fuzz/src/bin/msg_update_fee_target.rs +++ b/fuzz/src/bin/msg_update_fee_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs index cb156448e13..af9a062f336 100644 --- a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/offer_deser_target.rs b/fuzz/src/bin/offer_deser_target.rs index c4a03f628b3..cb6bf8b0e8f 100644 --- a/fuzz/src/bin/offer_deser_target.rs +++ b/fuzz/src/bin/offer_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/onion_hop_data_target.rs b/fuzz/src/bin/onion_hop_data_target.rs index 3b9b55bbfa9..b9f1880fe0b 100644 --- a/fuzz/src/bin/onion_hop_data_target.rs +++ b/fuzz/src/bin/onion_hop_data_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/onion_message_target.rs b/fuzz/src/bin/onion_message_target.rs index bb343e9de83..14941be52ec 100644 --- a/fuzz/src/bin/onion_message_target.rs +++ b/fuzz/src/bin/onion_message_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/peer_crypt_target.rs b/fuzz/src/bin/peer_crypt_target.rs index c68111deb06..314d5339ff6 100644 --- a/fuzz/src/bin/peer_crypt_target.rs +++ b/fuzz/src/bin/peer_crypt_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/process_network_graph_target.rs b/fuzz/src/bin/process_network_graph_target.rs index 7da2aafe3c8..127c69064fc 100644 --- a/fuzz/src/bin/process_network_graph_target.rs +++ b/fuzz/src/bin/process_network_graph_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/process_onion_failure_target.rs b/fuzz/src/bin/process_onion_failure_target.rs index 9e1cc8aa6d0..bfbb0f171d2 100644 --- a/fuzz/src/bin/process_onion_failure_target.rs +++ b/fuzz/src/bin/process_onion_failure_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/refund_deser_target.rs b/fuzz/src/bin/refund_deser_target.rs index 13837d2be73..9f4dc9344f0 100644 --- a/fuzz/src/bin/refund_deser_target.rs +++ b/fuzz/src/bin/refund_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/router_target.rs b/fuzz/src/bin/router_target.rs index 52a8c3408ff..72fc807ffa6 100644 --- a/fuzz/src/bin/router_target.rs +++ b/fuzz/src/bin/router_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/static_invoice_deser_target.rs b/fuzz/src/bin/static_invoice_deser_target.rs index 477f7869e7f..ea641ca9136 100644 --- a/fuzz/src/bin/static_invoice_deser_target.rs +++ b/fuzz/src/bin/static_invoice_deser_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/target_template.txt b/fuzz/src/bin/target_template.txt index 9b0dff8eb8c..90e5435db22 100644 --- a/fuzz/src/bin/target_template.txt +++ b/fuzz/src/bin/target_template.txt @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/bin/zbase32_target.rs b/fuzz/src/bin/zbase32_target.rs index 68c8cf3e19c..d06d7f5daa5 100644 --- a/fuzz/src/bin/zbase32_target.rs +++ b/fuzz/src/bin/zbase32_target.rs @@ -16,9 +16,6 @@ #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index f20f93c789c..3fff7b08c2a 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -568,12 +568,18 @@ type ChanMan<'a> = ChannelManager< >; #[inline] -fn get_payment_secret_hash(dest: &ChanMan, payment_ctr: &mut u64) -> (PaymentSecret, PaymentHash) { +fn get_payment_secret_hash( + dest: &ChanMan, payment_ctr: &mut u64, + payment_preimages: &RefCell>, +) -> (PaymentSecret, PaymentHash) { *payment_ctr += 1; - let payment_hash = PaymentHash(Sha256::hash(&[*payment_ctr as u8]).to_byte_array()); + let mut payment_preimage = PaymentPreimage([0; 32]); + payment_preimage.0[0..8].copy_from_slice(&payment_ctr.to_be_bytes()); + let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array()); let payment_secret = dest .create_inbound_payment_for_hash(payment_hash, None, 3600, None) .expect("create_inbound_payment_for_hash failed"); + assert!(payment_preimages.borrow_mut().insert(payment_hash, payment_preimage).is_none()); (payment_secret, payment_hash) } @@ -1342,10 +1348,8 @@ pub fn do_test(data: &[u8], out: Out) { // Create 3 channels between A-B and 3 channels between B-C (6 total). // - // Use version numbers 1-6 to avoid txid collisions under fuzz hashing. - // Fuzz mode uses XOR-based hashing (all bytes XOR to one byte), and - // versions 0-5 cause collisions between A-B and B-C channel pairs - // (e.g., A-B with Version(1) collides with B-C with Version(3)). + // Use distinct version numbers for each funding transaction so each test channel gets its own + // txid and funding outpoint. // A-B: channel 2 A and B have 0-reserve (trusted open + trusted accept), // channel 3 A has 0-reserve (trusted accept) make_channel!(nodes[0], nodes[1], monitor_a, monitor_b, keys_manager_b, 1, false, false); @@ -1422,6 +1426,8 @@ pub fn do_test(data: &[u8], out: Out) { let resolved_payments: RefCell<[HashMap>; 3]> = RefCell::new([new_hash_map(), new_hash_map(), new_hash_map()]); let claimed_payment_hashes: RefCell> = RefCell::new(HashSet::new()); + let payment_preimages: RefCell> = + RefCell::new(new_hash_map()); macro_rules! test_return { () => {{ @@ -1935,9 +1941,8 @@ pub fn do_test(data: &[u8], out: Out) { macro_rules! process_events { ($node: expr, $fail: expr) => {{ - // In case we get 256 payments we may have a hash collision, resulting in the - // second claim/fail call not finding the duplicate-hash HTLC, so we have to - // deduplicate the calls here. + // Multiple HTLCs can resolve for the same payment hash, so deduplicate + // claim/fail handling per event batch. let mut claim_set = new_hash_map(); let mut events = nodes[$node].get_and_clear_pending_events(); let had_events = !events.is_empty(); @@ -1950,7 +1955,11 @@ pub fn do_test(data: &[u8], out: Out) { if $fail { nodes[$node].fail_htlc_backwards(&payment_hash); } else { - nodes[$node].claim_funds(PaymentPreimage(payment_hash.0)); + let payment_preimage = *payment_preimages + .borrow() + .get(&payment_hash) + .expect("PaymentClaimable for unknown payment hash"); + nodes[$node].claim_funds(payment_preimage); claimed_payment_hashes.borrow_mut().insert(payment_hash); } } @@ -2090,7 +2099,7 @@ pub fn do_test(data: &[u8], out: Out) { |source_idx: usize, dest_idx: usize, dest_chan_id, amt, payment_ctr: &mut u64| { let source = &nodes[source_idx]; let dest = &nodes[dest_idx]; - let (secret, hash) = get_payment_secret_hash(dest, payment_ctr); + let (secret, hash) = get_payment_secret_hash(dest, payment_ctr, &payment_preimages); let mut id = PaymentId([0; 32]); id.0[0..8].copy_from_slice(&payment_ctr.to_ne_bytes()); let succeeded = send_payment(source, dest, dest_chan_id, amt, secret, hash, id); @@ -2113,7 +2122,7 @@ pub fn do_test(data: &[u8], out: Out) { let source = &nodes[source_idx]; let middle = &nodes[middle_idx]; let dest = &nodes[dest_idx]; - let (secret, hash) = get_payment_secret_hash(dest, payment_ctr); + let (secret, hash) = get_payment_secret_hash(dest, payment_ctr, &payment_preimages); let mut id = PaymentId([0; 32]); id.0[0..8].copy_from_slice(&payment_ctr.to_ne_bytes()); let succeeded = send_hop_payment( @@ -2140,7 +2149,7 @@ pub fn do_test(data: &[u8], out: Out) { payment_ctr: &mut u64| { let source = &nodes[source_idx]; let dest = &nodes[dest_idx]; - let (secret, hash) = get_payment_secret_hash(dest, payment_ctr); + let (secret, hash) = get_payment_secret_hash(dest, payment_ctr, &payment_preimages); let mut id = PaymentId([0; 32]); id.0[0..8].copy_from_slice(&payment_ctr.to_ne_bytes()); let succeeded = send_mpp_payment(source, dest, dest_chan_ids, amt, secret, hash, id); @@ -2160,7 +2169,7 @@ pub fn do_test(data: &[u8], out: Out) { let source = &nodes[source_idx]; let middle = &nodes[middle_idx]; let dest = &nodes[dest_idx]; - let (secret, hash) = get_payment_secret_hash(dest, payment_ctr); + let (secret, hash) = get_payment_secret_hash(dest, payment_ctr, &payment_preimages); let mut id = PaymentId([0; 32]); id.0[0..8].copy_from_slice(&payment_ctr.to_ne_bytes()); let succeeded = send_mpp_hop_payment( diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index c1d7982e5e4..09a77e1f97d 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -40,7 +40,7 @@ use lightning::chain::chaininterface::{ use lightning::chain::chainmonitor; use lightning::chain::transaction::OutPoint; use lightning::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Listen}; -use lightning::events::Event; +use lightning::events::{Event, PaymentPurpose}; use lightning::ln::channel_state::ChannelDetails; use lightning::ln::channelmanager::{ChainParameters, ChannelManager, InterceptId, PaymentId}; use lightning::ln::functional_test_utils::*; @@ -113,6 +113,13 @@ pub fn slice_to_be24(v: &[u8]) -> u32 { ((v[2] as u32) << 8*0) } +#[derive(Clone, Copy)] +struct ReceivedPayment { + payment_hash: PaymentHash, + payment_preimage: Option, + payment_secret: Option, +} + struct InputData { data: Vec, read_pos: AtomicUsize, @@ -651,7 +658,7 @@ pub fn do_test(mut data: &[u8], logger: &Arc let mut loss_detector = MoneyLossDetector::new(&peers, channelmanager.clone(), monitor.clone(), peer_manager); - let mut payments_received: Vec = Vec::new(); + let mut payments_received: Vec = Vec::new(); let mut intercepted_htlcs: Vec = Vec::new(); let mut payments_sent: u16 = 0; let mut pending_funding_generation: Vec<(ChannelId, PublicKey, u64, ScriptBuf)> = Vec::new(); @@ -736,14 +743,14 @@ pub fn do_test(mut data: &[u8], logger: &Arc payment_params, final_value_msat, ); - let mut payment_hash = PaymentHash([0; 32]); - payment_hash.0[0..2].copy_from_slice(&be16_to_array(payments_sent)); - payment_hash.0 = Sha256::hash(&payment_hash.0[..]).to_byte_array(); + let mut payment_preimage = PaymentPreimage([0; 32]); + payment_preimage.0[0..2].copy_from_slice(&be16_to_array(payments_sent)); + let payment_id = PaymentId(payment_preimage.0); payments_sent += 1; - let _ = channelmanager.send_payment( - payment_hash, + let _ = channelmanager.send_spontaneous_payment( + Some(payment_preimage), RecipientOnionFields::spontaneous_empty(final_value_msat), - PaymentId(payment_hash.0), + payment_id, params, Retry::Attempts(2), ); @@ -822,16 +829,24 @@ pub fn do_test(mut data: &[u8], logger: &Arc }, 8 => { for payment in payments_received.drain(..) { - // SHA256 is defined as XOR of all input bytes placed in the first byte, and 0s - // for the remaining bytes. Thus, if not all remaining bytes are 0s we cannot - // fulfill this HTLC, but if they are, we can just take the first byte and - // place that anywhere in our preimage. - if &payment.0[1..] != &[0; 31] { - channelmanager.fail_htlc_backwards(&payment); + if let Some(payment_preimage) = payment.payment_preimage { + let expected_hash = + PaymentHash(Sha256::hash(&payment_preimage.0[..]).to_byte_array()); + if expected_hash == payment.payment_hash { + channelmanager.claim_funds(payment_preimage); + } else { + channelmanager.fail_htlc_backwards(&payment.payment_hash); + } + } else if let Some(payment_secret) = payment.payment_secret { + match channelmanager.get_payment_preimage( + payment.payment_hash, + payment_secret, + ) { + Ok(payment_preimage) => channelmanager.claim_funds(payment_preimage), + Err(_) => channelmanager.fail_htlc_backwards(&payment.payment_hash), + } } else { - let mut payment_preimage = PaymentPreimage([0; 32]); - payment_preimage.0[0] = payment.0[0]; - channelmanager.claim_funds(payment_preimage); + channelmanager.fail_htlc_backwards(&payment.payment_hash); } } }, @@ -839,13 +854,11 @@ pub fn do_test(mut data: &[u8], logger: &Arc let payment_preimage = PaymentPreimage(keys_manager.get_secure_random_bytes()); let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0[..]).to_byte_array()); - // Note that this may fail - our hashes may collide and we'll end up trying to - // double-register the same payment_hash. let _ = channelmanager.create_inbound_payment_for_hash(payment_hash, None, 1, None); }, 9 => { for payment in payments_received.drain(..) { - channelmanager.fail_htlc_backwards(&payment); + channelmanager.fail_htlc_backwards(&payment.payment_hash); } }, 10 => { @@ -1118,9 +1131,25 @@ pub fn do_test(mut data: &[u8], logger: &Arc output_script, )); }, - Event::PaymentClaimable { payment_hash, .. } => { + Event::PaymentClaimable { payment_hash, purpose, .. } => { //TODO: enhance by fetching random amounts from fuzz input? - payments_received.push(payment_hash); + let payment_secret = match &purpose { + PaymentPurpose::Bolt11InvoicePayment { payment_secret, .. } => { + Some(*payment_secret) + }, + PaymentPurpose::Bolt12OfferPayment { payment_secret, .. } => { + Some(*payment_secret) + }, + PaymentPurpose::Bolt12RefundPayment { payment_secret, .. } => { + Some(*payment_secret) + }, + PaymentPurpose::SpontaneousPayment(_) => None, + }; + payments_received.push(ReceivedPayment { + payment_hash, + payment_preimage: purpose.preimage(), + payment_secret, + }); }, Event::HTLCIntercepted { intercept_id, .. } => { if !intercepted_htlcs.contains(&intercept_id) { diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs index 5f429ea2c3b..25c2fffa23e 100644 --- a/fuzz/src/lib.rs +++ b/fuzz/src/lib.rs @@ -15,9 +15,6 @@ extern crate lightning_rapid_gossip_sync; #[cfg(not(fuzzing))] compile_error!("Fuzz targets need cfg=fuzzing"); -#[cfg(not(hashes_fuzz))] -compile_error!("Fuzz targets need cfg=hashes_fuzz"); - #[cfg(not(secp256k1_fuzz))] compile_error!("Fuzz targets need cfg=secp256k1_fuzz"); diff --git a/lightning-liquidity/Cargo.toml b/lightning-liquidity/Cargo.toml index cc7fb0c0f08..2ddc2a92ccc 100644 --- a/lightning-liquidity/Cargo.toml +++ b/lightning-liquidity/Cargo.toml @@ -46,6 +46,7 @@ parking_lot = { version = "0.12", default-features = false } level = "forbid" # When adding a new cfg attribute, ensure that it is added to this list. check-cfg = [ + "cfg(fuzzing)", "cfg(c_bindings)", "cfg(backtrace)", "cfg(ldk_bench)", diff --git a/lightning-liquidity/src/lsps2/utils.rs b/lightning-liquidity/src/lsps2/utils.rs index 998b1d2964d..430d4263eae 100644 --- a/lightning-liquidity/src/lsps2/utils.rs +++ b/lightning-liquidity/src/lsps2/utils.rs @@ -15,6 +15,23 @@ use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::secp256k1::PublicKey; +#[inline] +fn promise_matches(expected_promise: &str, actual_promise: &str) -> bool { + if expected_promise.len() != actual_promise.len() { + return false; + } + + #[cfg(not(fuzzing))] + { + expected_promise == actual_promise + } + #[cfg(fuzzing)] + { + expected_promise.len() < 2 + || expected_promise.as_bytes()[..2] == actual_promise.as_bytes()[..2] + } +} + /// Determines if the given parameters are valid given the secret used to generate the promise. pub fn is_valid_opening_fee_params( fee_params: &LSPS2OpeningFeeParams, promise_secret: &[u8; 32], counterparty_node_id: &PublicKey, @@ -33,7 +50,7 @@ pub fn is_valid_opening_fee_params( hmac.input(&fee_params.max_payment_size_msat.to_be_bytes()); let promise_bytes = Hmac::from_engine(hmac).to_byte_array(); let promise = utils::hex_str(&promise_bytes[..]); - promise == fee_params.promise + promise_matches(&promise, &fee_params.promise) } /// Determines if the given parameters are expired, or still valid. diff --git a/lightning/src/crypto/chacha20poly1305rfc.rs b/lightning/src/crypto/chacha20poly1305rfc.rs index 839fad9ce6c..95ec647d81f 100644 --- a/lightning/src/crypto/chacha20poly1305rfc.rs +++ b/lightning/src/crypto/chacha20poly1305rfc.rs @@ -11,8 +11,8 @@ // https://github.com/floodyberry/poly1305-donna use super::chacha20::ChaCha20; -use super::fixed_time_eq; use super::poly1305::Poly1305; +use crate::util::fuzz_wrappers::digest_bytes_match; pub struct ChaCha20Poly1305RFC { cipher: ChaCha20, @@ -108,7 +108,7 @@ impl ChaCha20Poly1305RFC { self.mac.input(&(self.data_len as u64).to_le_bytes()); let calc_tag = self.mac.result(); - if fixed_time_eq(&calc_tag, tag) { + if digest_bytes_match(&calc_tag, tag) { self.cipher.process(input, output); Ok(()) } else { @@ -148,7 +148,7 @@ impl ChaCha20Poly1305RFC { self.mac.input(&(self.data_len as u64).to_le_bytes()); let calc_tag = self.mac.result(); - if fixed_time_eq(&calc_tag, tag) { + if digest_bytes_match(&calc_tag, tag) { true } else { false diff --git a/lightning/src/crypto/mod.rs b/lightning/src/crypto/mod.rs index 478918a49a8..a0e4fc7b31d 100644 --- a/lightning/src/crypto/mod.rs +++ b/lightning/src/crypto/mod.rs @@ -1,12 +1,3 @@ -#[cfg(not(fuzzing))] -pub(crate) use bitcoin::hashes::cmp::fixed_time_eq; - -#[cfg(fuzzing)] -fn fixed_time_eq(a: &[u8], b: &[u8]) -> bool { - assert_eq!(a.len(), b.len()); - a == b -} - pub(crate) mod chacha20; pub(crate) mod chacha20poly1305rfc; pub(crate) mod poly1305; diff --git a/lightning/src/crypto/streams.rs b/lightning/src/crypto/streams.rs index 23a23154307..8f3e1eed1bd 100644 --- a/lightning/src/crypto/streams.rs +++ b/lightning/src/crypto/streams.rs @@ -1,10 +1,10 @@ use crate::crypto::chacha20::ChaCha20; use crate::crypto::chacha20poly1305rfc::ChaCha20Poly1305RFC; -use crate::crypto::fixed_time_eq; use crate::crypto::poly1305::Poly1305; use crate::io::{self, Read, Write}; use crate::ln::msgs::DecodeError; +use crate::util::fuzz_wrappers::digest_bytes_match; use crate::util::ser::{ FixedLengthReader, LengthLimitedRead, LengthReadableArgs, Readable, Writeable, Writer, }; @@ -175,11 +175,11 @@ impl LengthReadableArgs<([u8; 32], [u8; 32], [u8; 32])> let mut tag = [0 as u8; 16]; r.read_exact(&mut tag)?; - if fixed_time_eq(&mac.result(), &tag) { + if digest_bytes_match(&mac.result(), &tag) { Ok(Self { readable, used_aad: TriPolyAADUsed::None }) - } else if fixed_time_eq(&mac_aad_a.result(), &tag) { + } else if digest_bytes_match(&mac_aad_a.result(), &tag) { Ok(Self { readable, used_aad: TriPolyAADUsed::First }) - } else if fixed_time_eq(&mac_aad_b.result(), &tag) { + } else if digest_bytes_match(&mac_aad_b.result(), &tag) { Ok(Self { readable, used_aad: TriPolyAADUsed::Second }) } else { return Err(DecodeError::InvalidValue); diff --git a/lightning/src/ln/inbound_payment.rs b/lightning/src/ln/inbound_payment.rs index d70a20eaf44..f2fbacb2de3 100644 --- a/lightning/src/ln/inbound_payment.rs +++ b/lightning/src/ln/inbound_payment.rs @@ -9,7 +9,6 @@ //! Utilities to generate inbound payment information in service of invoice creation. -use bitcoin::hashes::cmp::fixed_time_eq; use bitcoin::hashes::hmac::{Hmac, HmacEngine}; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hashes::{Hash, HashEngine}; @@ -22,6 +21,7 @@ use crate::offers::nonce::Nonce; use crate::sign::EntropySource; use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::util::errors::APIError; +use crate::util::fuzz_wrappers::{digest_bytes_match, payment_hash_matches_digest}; use crate::util::logger::Logger; #[allow(unused_imports)] @@ -370,10 +370,8 @@ pub(super) fn verify( let mut hmac = HmacEngine::::new(&keys.user_pmt_hash_key); hmac.input(&metadata_bytes[..]); hmac.input(&payment_hash.0); - if !fixed_time_eq( - &iv_bytes, - &Hmac::from_engine(hmac).to_byte_array().split_at_mut(IV_LEN).0, - ) { + let expected_iv = Hmac::from_engine(hmac).to_byte_array(); + if !digest_bytes_match(&iv_bytes, &expected_iv[..IV_LEN]) { log_trace!( logger, "Failing HTLC with user-generated payment_hash {}: unexpected payment_secret", @@ -399,10 +397,8 @@ pub(super) fn verify( Ok(Method::SpontaneousPayment) => { let mut hmac = HmacEngine::::new(&keys.spontaneous_pmt_key); hmac.input(&metadata_bytes[..]); - if !fixed_time_eq( - &iv_bytes, - &Hmac::from_engine(hmac).to_byte_array().split_at_mut(IV_LEN).0, - ) { + let expected_iv = Hmac::from_engine(hmac).to_byte_array(); + if !digest_bytes_match(&iv_bytes, &expected_iv[..IV_LEN]) { log_trace!(logger, "Failing async payment HTLC with sender-generated payment_hash {}: unexpected payment_secret", &payment_hash); return Err(()); } @@ -505,7 +501,8 @@ fn derive_ldk_payment_preimage( hmac.input(iv_bytes); hmac.input(metadata_bytes); let decoded_payment_preimage = Hmac::from_engine(hmac).to_byte_array(); - if !fixed_time_eq(&payment_hash.0, &Sha256::hash(&decoded_payment_preimage).to_byte_array()) { + let expected_digest = Sha256::hash(&decoded_payment_preimage).to_byte_array(); + if !payment_hash_matches_digest(&payment_hash, &expected_digest) { return Err(decoded_payment_preimage); } return Ok(PaymentPreimage(decoded_payment_preimage)); diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index 5111f6982fe..bbc733a9cbb 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -21,6 +21,7 @@ use crate::ln::onion_utils::{HTLCFailReason, LocalHTLCFailureReason, ONION_DATA_ use crate::sign::{NodeSigner, Recipient}; use crate::types::features::BlindedHopFeatures; use crate::types::payment::PaymentHash; +use crate::util::fuzz_wrappers::payment_hash_matches_preimage; use crate::util::logger::Logger; #[allow(unused_imports)] @@ -426,8 +427,7 @@ pub(super) fn create_recv_pending_htlc_info( // could discover the final destination of X, by probing the adjacent nodes on the route // with a keysend payment of identical payment hash to X and observing the processing // time discrepancies due to a hash collision with X. - let hashed_preimage = PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array()); - if hashed_preimage != payment_hash { + if !payment_hash_matches_preimage(&payment_hash, &payment_preimage) { return Err(InboundHTLCErr { reason: LocalHTLCFailureReason::InvalidKeysendPreimage, err_data: invalid_payment_err_data(amt_msat, current_height), diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 9b1b009e93a..c24c8f539b1 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -26,12 +26,12 @@ use crate::sign::{NodeSigner, Recipient}; use crate::types::features::{ChannelFeatures, NodeFeatures}; use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::util::errors::APIError; +use crate::util::fuzz_wrappers::digest_bytes_match; use crate::util::logger::Logger; use crate::util::ser::{ LengthCalculatingWriter, Readable, ReadableArgs, VecWriter, Writeable, Writer, }; -use bitcoin::hashes::cmp::fixed_time_eq; use bitcoin::hashes::hmac::{Hmac, HmacEngine}; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hashes::{Hash, HashEngine}; @@ -1298,7 +1298,8 @@ fn process_onion_failure_inner( let mut hmac = HmacEngine::::new(&um); hmac.input(&encrypted_packet.data[32..]); - if &Hmac::from_engine(hmac).to_byte_array() != &encrypted_packet.data[..32] { + let expected_hmac = Hmac::from_engine(hmac).to_byte_array(); + if !digest_bytes_match(&expected_hmac, &encrypted_packet.data[..32]) { continue; } @@ -2727,7 +2728,8 @@ fn decode_next_hop, N: NextPacketBytes>( if let Some(tag) = payment_hash { hmac.input(&tag.0[..]); } - if !fixed_time_eq(&Hmac::from_engine(hmac).to_byte_array(), &hmac_bytes) { + let expected_hmac = Hmac::from_engine(hmac).to_byte_array(); + if !digest_bytes_match(&expected_hmac, &hmac_bytes) { return Err(OnionDecodeErr::Malformed { err_msg: "HMAC Check failed", reason: LocalHTLCFailureReason::InvalidOnionHMAC, @@ -2907,7 +2909,7 @@ impl AttributionData { // Compare with the actual HMAC. let hmac_idx = MAX_HOPS - position - 1; let actual_hmac = self.get_hmac(hmac_idx); - if !fixed_time_eq(expected_hmac, actual_hmac) { + if !digest_bytes_match(expected_hmac, actual_hmac) { return Err(()); } diff --git a/lightning/src/util/fuzz_wrappers.rs b/lightning/src/util/fuzz_wrappers.rs index 6475065b8be..5a3192709ec 100644 --- a/lightning/src/util/fuzz_wrappers.rs +++ b/lightning/src/util/fuzz_wrappers.rs @@ -7,6 +7,13 @@ // You may not use this file except in accordance with one or both of these // licenses. +use crate::types::payment::{PaymentHash, PaymentPreimage}; + +#[cfg(not(fuzzing))] +use bitcoin::hashes::cmp::fixed_time_eq; +use bitcoin::hashes::sha256::Hash as Sha256; +use bitcoin::hashes::Hash; + macro_rules! hash_to_message { ($slice: expr) => {{ #[cfg(not(fuzzing))] @@ -22,3 +29,34 @@ macro_rules! hash_to_message { } }}; } + +#[inline] +pub(crate) fn digest_bytes_match(expected_digest: &[u8], actual_digest: &[u8]) -> bool { + if expected_digest.len() != actual_digest.len() { + return false; + } + + #[cfg(not(fuzzing))] + { + fixed_time_eq(expected_digest, actual_digest) + } + #[cfg(fuzzing)] + { + expected_digest.is_empty() || expected_digest[0] == actual_digest[0] + } +} + +#[inline] +pub(crate) fn payment_hash_matches_digest( + payment_hash: &PaymentHash, expected_digest: &[u8; 32], +) -> bool { + digest_bytes_match(&payment_hash.0, expected_digest) +} + +#[inline] +pub(crate) fn payment_hash_matches_preimage( + payment_hash: &PaymentHash, payment_preimage: &PaymentPreimage, +) -> bool { + let expected_digest = Sha256::hash(&payment_preimage.0).to_byte_array(); + payment_hash_matches_digest(payment_hash, &expected_digest) +} From b386316e5403c6af459fc9437ef1837675c7a499 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Mon, 13 Apr 2026 09:12:34 +0200 Subject: [PATCH 2/2] Refresh fuzz regressions for local hash gates --- fuzz/src/full_stack.rs | 281 ++++++++++++++++----------------- fuzz/src/onion_message.rs | 68 ++++---- lightning/src/crypto/utils.rs | 4 +- lightning/src/ln/chan_utils.rs | 1 + 4 files changed, 178 insertions(+), 176 deletions(-) diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 09a77e1f97d..c09adf56b4f 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -1234,21 +1234,21 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 50 ext_from_hex("030032", &mut test); // noise act two (0||pubkey||mac) - ext_from_hex("00 030000000000000000000000000000000000000000000000000000000000000002 03000000000000000000000000000000", &mut test); + ext_from_hex("00 020000000000000000000000000000000000000000000000000000000000000002 54000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 16 - ext_from_hex("0010 03000000000000000000000000000000", &mut test); + ext_from_hex("0010 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 32 ext_from_hex("030020", &mut test); // init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac - ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 03000000000000000000000000000000", &mut test); + ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 327 - ext_from_hex("0147 03000000000000000000000000000000", &mut test); + ext_from_hex("0147 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 254 ext_from_hex("0300fe", &mut test); // beginning of open_channel message @@ -1256,24 +1256,24 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 89 ext_from_hex("030059", &mut test); // rest of open_channel and mac - ext_from_hex("030000000000000000000000000000000000000000000000000000000000000005 020900000000000000000000000000000000000000000000000000000000000000 01 0000 01021000 03000000000000000000000000000000", &mut test); + ext_from_hex("030000000000000000000000000000000000000000000000000000000000000005 020900000000000000000000000000000000000000000000000000000000000000 01 0000 01021000 ff000000000000000000000000000000", &mut test); // client should now respond with accept_channel (CHECK 1: type 33 to peer 03000000) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 132 - ext_from_hex("0084 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 148 ext_from_hex("030094", &mut test); // funding_created and mac - ext_from_hex("0022 ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679 c000000000000000000000000000000000000000000000000000000000000000 0000 00000000000000000000000000000000000000000000000000000000000000dc0100000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000 ff4a9c947b96cfb3c11c28119ea1667d7cf786dc4dfcfcdd58dff0386588c9250100000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // client should now respond with funding_signed (CHECK 2: type 35 to peer 03000000) - // connect a block with one transaction of len 94 - ext_from_hex("0c005e", &mut test); + // connect a block with one transaction of len 55 + ext_from_hex("0c0037", &mut test); // the funding transaction - ext_from_hex("020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0150c3000000000000220020530000000000000000000000000000000000000000000000000000000000000000000000", &mut test); + ext_from_hex("000000000001000150c30000000000002200203e1004a2eb6dd8ee68101500699c5cee7e1a6035273d81b5df0f73ce7cd757e000000000", &mut test); // connect a block with no transactions, one per line ext_from_hex("0c0000", &mut test); ext_from_hex("0c0000", &mut test); @@ -1292,42 +1292,42 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 67 - ext_from_hex("0043 03000000000000000000000000000000", &mut test); + ext_from_hex("0043 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 83 ext_from_hex("030053", &mut test); // channel_ready and mac - ext_from_hex("0024 c000000000000000000000000000000000000000000000000000000000000000 020800000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0024 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 020800000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // new inbound connection with id 1 ext_from_hex("01", &mut test); // inbound read from peer id 1 of len 50 ext_from_hex("030132", &mut test); // inbound noise act 1 - ext_from_hex("0003000000000000000000000000000000000000000000000000000000000000000703000000000000000000000000000000", &mut test); + ext_from_hex("0002000000000000000000000000000000000000000000000000000000000000000761000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 66 ext_from_hex("030142", &mut test); // inbound noise act 3 - ext_from_hex("000302000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000003000000000000000000000000000000", &mut test); + ext_from_hex("000202000000000000000000000000000000000000000000000000000000000000002795e0be2bdb8085dcd1f7c66a408f0e9a000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 16 - ext_from_hex("0010 01000000000000000000000000000000", &mut test); + ext_from_hex("0010 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 32 ext_from_hex("030120", &mut test); // init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac - ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 01000000000000000000000000000000", &mut test); + ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 96000000000000000000000000000000", &mut test); // create outbound channel to peer 1 for 50k sat ext_from_hex( - "05 01 030200000000000000000000000000000000000000000000000000000000000000 00c350 0003e8", + "05 01 020200000000000000000000000000000000000000000000000000000000000000 00c350 0003e8", &mut test, ); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 278 - ext_from_hex("0116 01000000000000000000000000000000", &mut test); + ext_from_hex("0116 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 255 ext_from_hex("0301ff", &mut test); // beginning of accept_channel @@ -1336,7 +1336,7 @@ fn two_peer_forwarding_seed() -> Vec { ext_from_hex("030127", &mut test); // rest of accept_channel and mac ext_from_hex( - "0000000000000000000000000000000000 0000 01021000 01000000000000000000000000000000", + "0000000000000000000000000000000000 0000 01021000 96000000000000000000000000000000", &mut test, ); @@ -1346,11 +1346,11 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 98 - ext_from_hex("0062 01000000000000000000000000000000", &mut test); + ext_from_hex("0062 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 114 ext_from_hex("030172", &mut test); // funding_signed message and mac - ext_from_hex("0023 c400000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000310001000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0023 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 4fe70b3d473d0c32c04d33b400010e42c821272c8c20f5d0fc210042578299d90001000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // broadcast funding transaction ext_from_hex("0b", &mut test); @@ -1359,20 +1359,20 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 67 - ext_from_hex("0043 01000000000000000000000000000000", &mut test); + ext_from_hex("0043 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 83 ext_from_hex("030153", &mut test); // channel_ready and mac - ext_from_hex("0024 c400000000000000000000000000000000000000000000000000000000000000 026700000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0024 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 026700000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 1452 - ext_from_hex("05ac 03000000000000000000000000000000", &mut test); + ext_from_hex("05ac ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); // beginning of update_add_htlc from 0 to 1 via client - ext_from_hex("0080 c000000000000000000000000000000000000000000000000000000000000000 0000000000000000 0000000000003e80 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 11 020203e8 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); + ext_from_hex("0080 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000000000000000 0000000000003e80 ffb9517cec378f850587d1acde9a3ff9cf90433499e5ac15acb052dc32afef71 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 11 020203e8 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); @@ -1388,26 +1388,26 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 193 ext_from_hex("0300c1", &mut test); // end of update_add_htlc from 0 to 1 via client and mac - ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fe00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 100 - ext_from_hex("0064 03000000000000000000000000000000", &mut test); + ext_from_hex("0064 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 116 ext_from_hex("030074", &mut test); // commitment_signed and mac - ext_from_hex("0084 c000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000cd0100000000000000000000000000000000000000000000000000000000000000 0000 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb d84dfd1a305bd53830df8be50a069c2a991c860d5e719e3755b4d37ba7fd1d060100000000000000000000000000000000000000000000000000000000000000 0000 ff000000000000000000000000000000", &mut test); // client should now respond with revoke_and_ack and commitment_signed (CHECK 5/6: types 133 and 132 to peer 03000000) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 99 - ext_from_hex("0063 03000000000000000000000000000000", &mut test); + ext_from_hex("0063 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 115 ext_from_hex("030073", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c000000000000000000000000000000000000000000000000000000000000000 0900000000000000000000000000000000000000000000000000000000000000 020b00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0085 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0900000000000000000000000000000000000000000000000000000000000000 020b00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // process the now-pending HTLC forward ext_from_hex("07", &mut test); @@ -1417,58 +1417,58 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 100 - ext_from_hex("0064 01000000000000000000000000000000", &mut test); + ext_from_hex("0064 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 116 ext_from_hex("030174", &mut test); // commitment_signed and mac - ext_from_hex("0084 c400000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000720001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test); + ext_from_hex("0084 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 6e08e968896b3fd2e8a1764b81c7e01c0870b703702cb98464f4bcc29317c0f20001000000000000000000000000000000000000000000000000000000000000 0000 96000000000000000000000000000000", &mut test); // // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 99 - ext_from_hex("0063 01000000000000000000000000000000", &mut test); + ext_from_hex("0063 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 115 ext_from_hex("030173", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c400000000000000000000000000000000000000000000000000000000000000 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0085 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 74 - ext_from_hex("004a 01000000000000000000000000000000", &mut test); + ext_from_hex("004a 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 90 ext_from_hex("03015a", &mut test); // update_fulfill_htlc and mac - ext_from_hex("0082 c400000000000000000000000000000000000000000000000000000000000000 0000000000000000 ff00888888888888888888888888888888888888888888888888888888888888 01000000000000000000000000000000", &mut test); + ext_from_hex("0082 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 0000000000000000 1400888888888888888888888888888888888888888888888888888888888888 96000000000000000000000000000000", &mut test); // client should immediately claim the pending HTLC from peer 0 (CHECK 8: SendFulfillHTLCs for node 03000000 with preimage ff00888888 for channel c0000000) // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 100 - ext_from_hex("0064 01000000000000000000000000000000", &mut test); + ext_from_hex("0064 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 116 ext_from_hex("030174", &mut test); // commitment_signed and mac - ext_from_hex("0084 c400000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000700001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test); + ext_from_hex("0084 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 70e8b93af366735c10efa4fa944bd8659abedd2b33dc8c3703c4813199c1e3a80001000000000000000000000000000000000000000000000000000000000000 0000 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 99 - ext_from_hex("0063 01000000000000000000000000000000", &mut test); + ext_from_hex("0063 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 115 ext_from_hex("030173", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c400000000000000000000000000000000000000000000000000000000000000 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0085 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // before responding to the commitment_signed generated above, send a new HTLC // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 1452 - ext_from_hex("05ac 03000000000000000000000000000000", &mut test); + ext_from_hex("05ac ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); // beginning of update_add_htlc from 0 to 1 via client - ext_from_hex("0080 c000000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000000000003e80 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 11 020203e8 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); + ext_from_hex("0080 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000000000000001 0000000000003e80 ffb9517cec378f850587d1acde9a3ff9cf90433499e5ac15acb052dc32afef71 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 11 020203e8 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); @@ -1484,36 +1484,36 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 193 ext_from_hex("0300c1", &mut test); // end of update_add_htlc from 0 to 1 via client and mac - ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fe00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // now respond to the update_fulfill_htlc+commitment_signed messages the client sent to peer 0 // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 99 - ext_from_hex("0063 03000000000000000000000000000000", &mut test); + ext_from_hex("0063 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 115 ext_from_hex("030073", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c000000000000000000000000000000000000000000000000000000000000000 0800000000000000000000000000000000000000000000000000000000000000 020a00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0085 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0800000000000000000000000000000000000000000000000000000000000000 020a00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // client should now respond with revoke_and_ack and commitment_signed (CHECK 5/6 duplicates) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 100 - ext_from_hex("0064 03000000000000000000000000000000", &mut test); + ext_from_hex("0064 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 116 ext_from_hex("030074", &mut test); // commitment_signed and mac - ext_from_hex("0084 c000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000003e0100000000000000000000000000000000000000000000000000000000000000 0000 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ff50ee0431a69bc64d53fc30352fe5ea4baaf1e9b4076f2856aa45607bfed9e50100000000000000000000000000000000000000000000000000000000000000 0000 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 99 - ext_from_hex("0063 03000000000000000000000000000000", &mut test); + ext_from_hex("0063 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 115 ext_from_hex("030073", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c000000000000000000000000000000000000000000000000000000000000000 0b00000000000000000000000000000000000000000000000000000000000000 020d00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0085 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0b00000000000000000000000000000000000000000000000000000000000000 020d00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // process the now-pending HTLC forward ext_from_hex("07", &mut test); @@ -1524,47 +1524,47 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 100 - ext_from_hex("0064 01000000000000000000000000000000", &mut test); + ext_from_hex("0064 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 116 ext_from_hex("030174", &mut test); // commitment_signed and mac - ext_from_hex("0084 c400000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000007e0001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test); + ext_from_hex("0084 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 a9151b2a95696eeaa6af73a3db36da9937a816e839d10c1366fbbe51b7cf20960001000000000000000000000000000000000000000000000000000000000000 0000 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 99 - ext_from_hex("0063 01000000000000000000000000000000", &mut test); + ext_from_hex("0063 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 115 ext_from_hex("030173", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c400000000000000000000000000000000000000000000000000000000000000 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0085 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 44 - ext_from_hex("002c 01000000000000000000000000000000", &mut test); + ext_from_hex("002c 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 60 ext_from_hex("03013c", &mut test); // update_fail_htlc and mac - ext_from_hex("0083 c400000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000 01000000000000000000000000000000", &mut test); + ext_from_hex("0083 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 0000000000000001 0000 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 100 - ext_from_hex("0064 01000000000000000000000000000000", &mut test); + ext_from_hex("0064 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 116 ext_from_hex("030174", &mut test); // commitment_signed and mac - ext_from_hex("0084 c400000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000410001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test); + ext_from_hex("0084 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 08f4a62488ee05fad4c7f33c0c5b490c6cc0a92e4a5ecd12d6170e6fb63819660001000000000000000000000000000000000000000000000000000000000000 0000 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 99 - ext_from_hex("0063 01000000000000000000000000000000", &mut test); + ext_from_hex("0063 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 115 ext_from_hex("030173", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c400000000000000000000000000000000000000000000000000000000000000 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test); + ext_from_hex("0085 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 96000000000000000000000000000000", &mut test); // process the now-pending HTLC forward ext_from_hex("07", &mut test); @@ -1574,30 +1574,30 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 99 - ext_from_hex("0063 03000000000000000000000000000000", &mut test); + ext_from_hex("0063 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 115 ext_from_hex("030073", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c000000000000000000000000000000000000000000000000000000000000000 0a00000000000000000000000000000000000000000000000000000000000000 020c00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0085 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0a00000000000000000000000000000000000000000000000000000000000000 020c00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 100 - ext_from_hex("0064 03000000000000000000000000000000", &mut test); + ext_from_hex("0064 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 116 ext_from_hex("030074", &mut test); // commitment_signed and mac - ext_from_hex("0084 c000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000cf0100000000000000000000000000000000000000000000000000000000000000 0000 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb a161d97b5bcd82c4949bcdfe0c847f7e43b3325a187162833e09b0d683ec834a0100000000000000000000000000000000000000000000000000000000000000 0000 ff000000000000000000000000000000", &mut test); // client should now respond with revoke_and_ack (CHECK 5 duplicate) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 1452 - ext_from_hex("05ac 03000000000000000000000000000000", &mut test); + ext_from_hex("05ac ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); // beginning of update_add_htlc from 0 to 1 via client - ext_from_hex("0080 c000000000000000000000000000000000000000000000000000000000000000 0000000000000002 00000000000b0838 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c1 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); + ext_from_hex("0080 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000000000000002 00000000000b0838 ffb9517cec378f850587d1acde9a3ff9cf90433499e5ac15acb052dc32afef71 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c1 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test); @@ -1613,26 +1613,26 @@ fn two_peer_forwarding_seed() -> Vec { // inbound read from peer id 0 of len 193 ext_from_hex("0300c1", &mut test); // end of update_add_htlc from 0 to 1 via client and mac - ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5200000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 2900000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 164 - ext_from_hex("00a4 03000000000000000000000000000000", &mut test); + ext_from_hex("00a4 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 180 ext_from_hex("0300b4", &mut test); // commitment_signed and mac - ext_from_hex("0084 c000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000f60100000000000000000000000000000000000000000000000000000000000000 0001 000000000000000000000000000000000000000000000000000000000000009b05000000000000000000000000000000000000000000000000000000000000fb 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb d04a04e987dc7f9809b7a7de6c3b83debe9471b2ff1ca2595ea1514fe8f6263b0100000000000000000000000000000000000000000000000000000000000000 0001 423e686eb26a48b2dacee644a7bc6baebb92b05fa13eb4412dff1e7150ab96a8e466e2542e71d3114606b768bf6ed069c6f2e7d476312ad54ecd06223c6d7248 ff000000000000000000000000000000", &mut test); // client should now respond with revoke_and_ack and commitment_signed (CHECK 5/6 duplicates) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 99 - ext_from_hex("0063 03000000000000000000000000000000", &mut test); + ext_from_hex("0063 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 115 ext_from_hex("030073", &mut test); // revoke_and_ack and mac - ext_from_hex("0085 c000000000000000000000000000000000000000000000000000000000000000 0d00000000000000000000000000000000000000000000000000000000000000 020f00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0085 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0d00000000000000000000000000000000000000000000000000000000000000 020f00000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // process the now-pending HTLC forward ext_from_hex("07", &mut test); @@ -1640,13 +1640,13 @@ fn two_peer_forwarding_seed() -> Vec { // connect a block with one transaction of len 125 ext_from_hex("0c007d", &mut test); - // the commitment transaction for channel c400000000000000000000000000000000000000000000000000000000000000 - ext_from_hex("0200000001c400000000000000000000000000000000000000000000000000000000000000000000000000000080025802000000000000220020940000000000000000000000000000000000000000000000000000000000000013c0000000000000160014d60000000000000000000000000000000000000005000020", &mut test); + // the commitment transaction for channel 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809 + ext_from_hex("0200000001354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed84585018090000000000ee075f80025802000000000000220020291901223cf3bee741f08b2289b570bd725d19d3abb0911a29ae65f77c60b5d613c000000000000016001441bca55ab381e784e678b68665661caf6c5259eb6770e720", &mut test); // // connect a block with one transaction of len 94 ext_from_hex("0c005e", &mut test); // the HTLC timeout transaction - ext_from_hex("0200000001ab0000000000000000000000000000000000000000000000000000000000000000000000000000000001a7010000000000002200206c0000000000000000000000000000000000000000000000000000000000000000000000", &mut test); + ext_from_hex("02000000019208b95650a9a62c52f5a0259bf1a901d18a57e7108d47471ce67887b2a3318200000000000000000001a701000000000000220020b6fb38c67ad94325bac4156e52504731b619e72e6c38319558c7acffb6b09fad00000000", &mut test); // connect a block with no transactions ext_from_hex("0c0000", &mut test); // connect a block with no transactions @@ -1688,67 +1688,67 @@ fn gossip_exchange_seed() -> Vec { // inbound read from peer id 0 of len 50 ext_from_hex("030032", &mut test); // noise act two (0||pubkey||mac) - ext_from_hex("00 030000000000000000000000000000000000000000000000000000000000000002 03000000000000000000000000000000", &mut test); + ext_from_hex("00 020000000000000000000000000000000000000000000000000000000000000002 54000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 16 - ext_from_hex("0010 03000000000000000000000000000000", &mut test); + ext_from_hex("0010 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 32 ext_from_hex("030020", &mut test); // init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac - ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 03000000000000000000000000000000", &mut test); + ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa ff000000000000000000000000000000", &mut test); // new inbound connection with id 1 ext_from_hex("01", &mut test); // inbound read from peer id 1 of len 50 ext_from_hex("030132", &mut test); // inbound noise act 1 - ext_from_hex("0003000000000000000000000000000000000000000000000000000000000000000703000000000000000000000000000000", &mut test); + ext_from_hex("0002000000000000000000000000000000000000000000000000000000000000000761000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 66 ext_from_hex("030142", &mut test); // inbound noise act 3 - ext_from_hex("000302000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000003000000000000000000000000000000", &mut test); + ext_from_hex("000202000000000000000000000000000000000000000000000000000000000000002795e0be2bdb8085dcd1f7c66a408f0e9a000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 18 ext_from_hex("030112", &mut test); // message header indicating message length 16 - ext_from_hex("0010 01000000000000000000000000000000", &mut test); + ext_from_hex("0010 96000000000000000000000000000000", &mut test); // inbound read from peer id 1 of len 32 ext_from_hex("030120", &mut test); // init message (type 16) with static_remotekey required, no anchors/taproot, and other bits optional and mac - ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 01000000000000000000000000000000", &mut test); + ext_from_hex("0010 00021aaa 0008aaa210aa2a0a9aaa 96000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 432 - ext_from_hex("01b0 03000000000000000000000000000000", &mut test); + ext_from_hex("01b0 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 255 ext_from_hex("0300ff", &mut test); // First part of channel_announcement (type 256) - ext_from_hex("0100 00000000000000000000000000000000000000000000000000000000000000b20303030303030303030303030303030303030303030303030303030303030303 00000000000000000000000000000000000000000000000000000000000000b20202020202020202020202020202020202020202020202020202020202020202 00000000000000000000000000000000000000000000000000000000000000b20303030303030303030303030303030303030303030303030303030303030303 00000000000000000000000000000000000000000000000000000000000000b20202020202020202020202020202020202020202020202020202020202", &mut test); + ext_from_hex("0100 7318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea0303030303030303030303030303030303030303030303030303030303030303 7318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea0202020202020202020202020202020202020202020202020202020202020202 7318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea0303030303030303030303030303030303030303030303030303030303030303 7318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea0202020202020202020202020202020202020202020202020202020202", &mut test); // inbound read from peer id 0 of len 193 ext_from_hex("0300c1", &mut test); // Last part of channel_announcement and mac - ext_from_hex("020202 00006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000000000000000002a030303030303030303030303030303030303030303030303030303030303030303020202020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030303030303030303030303030303030303020202020202020202020202020202020202020202020202020202020202020202 03000000000000000000000000000000", &mut test); + ext_from_hex("020202 00006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000000000000000002a030303030303030303030303030303030303030303030303030303030303030303020202020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030303030303030303030303030303030303020202020202020202020202020202020202020202020202020202020202020202 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 138 - ext_from_hex("008a 03000000000000000000000000000000", &mut test); + ext_from_hex("008a ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 154 ext_from_hex("03009a", &mut test); // channel_update (type 258) and mac - ext_from_hex("0102 00000000000000000000000000000000000000000000000000000000000000a60303030303030303030303030303030303030303030303030303030303030303 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 000000000000002a0000002c01000028000000000000000000000000000000000000000005f5e100 03000000000000000000000000000000", &mut test); + ext_from_hex("0102 28b7d3b80e33bde404c26c32054c18c6daa0f191c7668cc802dd7ec61a68482b0303030303030303030303030303030303030303030303030303030303030303 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 000000000000002a0000002c01000028000000000000000000000000000000000000000005f5e100 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 142 - ext_from_hex("008e 03000000000000000000000000000000", &mut test); + ext_from_hex("008e ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 158 ext_from_hex("03009e", &mut test); // node_announcement (type 257) and mac - ext_from_hex("0101 00000000000000000000000000000000000000000000000000000000000000280303030303030303030303030303030303030303030303030303030303030303 00000000002b03030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0101 bab805f09b8ab4f43c816c826d4b6090a5885f8650ea07a1854f379ef180ddb90303030303030303030303030303030303030303030303030303030303030303 00000000002b03030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); test } @@ -1770,25 +1770,25 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 50 ext_from_hex("030032", &mut test); // noise act two (0||pubkey||mac) - ext_from_hex("00 030000000000000000000000000000000000000000000000000000000000000002 03000000000000000000000000000000", &mut test); + ext_from_hex("00 020000000000000000000000000000000000000000000000000000000000000002 54000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 28 (init with extended features for splicing) // init message = type(2) + global_len(2) + global(2) + features_len(2) + features(20) = 28 = 0x1c - ext_from_hex("001c 03000000000000000000000000000000", &mut test); + ext_from_hex("001c ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 44 (28 message + 16 MAC) ext_from_hex("03002c", &mut test); // init message (type 16) with splicing (bit 155) and quiescence (bit 35) enabled // Features: 20 bytes with bit 155 (splicing) and bit 35 (quiescence) set // Wire format (big-endian): 0x08 at byte 0 for bit 155, zeros for bytes 1-11, original 8 bytes at 12-19 // 20 bytes = 08 + 11 zeros + 8 original bytes = 080000000000000000000000 + aaa210aa2a0a9aaa - ext_from_hex("0010 00021aaa 0014 080000000000000000000000aaa210aa2a0a9aaa 03000000000000000000000000000000", &mut test); + ext_from_hex("0010 00021aaa 0014 080000000000000000000000aaa210aa2a0a9aaa ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 327 - ext_from_hex("0147 03000000000000000000000000000000", &mut test); + ext_from_hex("0147 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 254 ext_from_hex("0300fe", &mut test); // beginning of open_channel message @@ -1796,24 +1796,24 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 89 ext_from_hex("030059", &mut test); // rest of open_channel and mac - ext_from_hex("030000000000000000000000000000000000000000000000000000000000000005 020900000000000000000000000000000000000000000000000000000000000000 01 0000 01021000 03000000000000000000000000000000", &mut test); + ext_from_hex("030000000000000000000000000000000000000000000000000000000000000005 020900000000000000000000000000000000000000000000000000000000000000 01 0000 01021000 ff000000000000000000000000000000", &mut test); // client should now respond with accept_channel // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 132 - ext_from_hex("0084 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 148 ext_from_hex("030094", &mut test); // funding_created and mac - ext_from_hex("0022 ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679 c000000000000000000000000000000000000000000000000000000000000000 0000 00000000000000000000000000000000000000000000000000000000000000dc0100000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000 ff4a9c947b96cfb3c11c28119ea1667d7cf786dc4dfcfcdd58dff0386588c9250100000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // client should now respond with funding_signed // connect a block with one transaction of len 94 - ext_from_hex("0c005e", &mut test); + ext_from_hex("0c0037", &mut test); // the funding transaction - ext_from_hex("020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0150c3000000000000220020530000000000000000000000000000000000000000000000000000000000000000000000", &mut test); + ext_from_hex("000000000001000150c30000000000002200203e1004a2eb6dd8ee68101500699c5cee7e1a6035273d81b5df0f73ce7cd757e000000000", &mut test); // connect blocks to confirm the funding transaction (need minimum_depth confirmations) for _ in 0..12 { ext_from_hex("0c0000", &mut test); @@ -1823,11 +1823,11 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 67 - ext_from_hex("0043 03000000000000000000000000000000", &mut test); + ext_from_hex("0043 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 83 ext_from_hex("030053", &mut test); // channel_ready and mac - ext_from_hex("0024 c000000000000000000000000000000000000000000000000000000000000000 020800000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0024 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 020800000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // Channel is now established and ready for splicing! @@ -1841,24 +1841,24 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 35 (stfu message: type(2) + channel_id(32) + initiator(1) = 35 = 0x23) - ext_from_hex("0023 03000000000000000000000000000000", &mut test); + ext_from_hex("0023 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 51 (35 message + 16 MAC) ext_from_hex("030033", &mut test); // stfu message (type 2): channel_id (32 bytes) + initiator (1 byte) + mac // channel_id = c000...0000, initiator = 0 (peer is not initiator, responding to our stfu) - ext_from_hex("0002 c000000000000000000000000000000000000000000000000000000000000000 00 03000000000000000000000000000000", &mut test); + ext_from_hex("0002 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 00 ff000000000000000000000000000000", &mut test); // After receiving peer's stfu, we send SpliceInit. Peer responds with SpliceAck. // Message type IDs: SpliceAck = 81 (0x0051) // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 75 (SpliceAck: type(2) + channel_id(32) + funding_contribution(8) + funding_pubkey(33) = 75 = 0x4b) - ext_from_hex("004b 03000000000000000000000000000000", &mut test); + ext_from_hex("004b ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 91 (75 message + 16 MAC) ext_from_hex("03005b", &mut test); // SpliceAck message (type 81 = 0x0051): channel_id + funding_contribution + funding_pubkey + mac // channel_id = c000...0000, funding_contribution = 0 (i64), funding_pubkey = valid 33-byte compressed pubkey - ext_from_hex("0051 c000000000000000000000000000000000000000000000000000000000000000 0000000000000000 030000000000000000000000000000000000000000000000000000000000000001 03000000000000000000000000000000", &mut test); + ext_from_hex("0051 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 0000000000000000 030000000000000000000000000000000000000000000000000000000000000001 ff000000000000000000000000000000", &mut test); // Now we're in interactive tx negotiation. We send TxAddInput for our new funding input. // Peer responds with TxComplete (they have no inputs/outputs to add). @@ -1866,11 +1866,11 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 34 (TxComplete: type(2) + channel_id(32) = 34 = 0x22) - ext_from_hex("0022 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 50 (34 message + 16 MAC) ext_from_hex("030032", &mut test); // TxComplete message (type 70 = 0x0046): channel_id + mac - ext_from_hex("0046 c000000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0046 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ff000000000000000000000000000000", &mut test); // After peer's first TxComplete, we send another TxAddInput (for the shared input - existing funding). // We also send TxAddOutput for the new funding output. @@ -1878,31 +1878,31 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 34 (TxComplete) - ext_from_hex("0022 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 50 (34 message + 16 MAC) ext_from_hex("030032", &mut test); // TxComplete message - ext_from_hex("0046 c000000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0046 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ff000000000000000000000000000000", &mut test); // We continue sending our inputs/outputs, peer continues with TxComplete. // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 34 (TxComplete) - ext_from_hex("0022 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 50 (34 message + 16 MAC) ext_from_hex("030032", &mut test); // TxComplete message - ext_from_hex("0046 c000000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0046 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ff000000000000000000000000000000", &mut test); // More TxComplete responses as we add our outputs // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 34 (TxComplete) - ext_from_hex("0022 03000000000000000000000000000000", &mut test); + ext_from_hex("0022 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 50 (34 message + 16 MAC) ext_from_hex("030032", &mut test); // TxComplete message - ext_from_hex("0046 c000000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0046 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ff000000000000000000000000000000", &mut test); // After we send our TxComplete, the interactive tx negotiation completes. // Both sides now need to exchange commitment_signed messages. @@ -1913,14 +1913,14 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 134 (0x86) - ext_from_hex("0086 03000000000000000000000000000000", &mut test); + ext_from_hex("0086 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 150 (134 message + 16 MAC) ext_from_hex("030096", &mut test); // CommitmentSigned message with proper signature (r=f7, s=01...) and funding_txid TLV // signature r encodes sighash first byte f7, s follows the pattern from funding_created // TLV type 1 (odd/optional) for funding_txid as per impl_writeable_msg!(CommitmentSigned, ...) // Note: txid is encoded in reverse byte order (Bitcoin standard), so to get display 0000...0033, encode 3300...0000 - ext_from_hex("0084 c000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000f7 0100000000000000000000000000000000000000000000000000000000000000 0000 01 20 3300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0084 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb ac13bde22b07e9fb093ce34abae2189eddf27ecaf54862d320af86cf58d2f064 0100000000000000000000000000000000000000000000000000000000000000 0000 01 20 a8572fdb543546c2ed2aa0174095ab84dd37ffc1b2a5a0cb791061990a5e7b83 ff000000000000000000000000000000", &mut test); // After commitment_signed exchange, we need to exchange tx_signatures. // Message type IDs: TxSignatures = 71 (0x0047) @@ -1929,13 +1929,13 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 134 (0x86) - ext_from_hex("0086 03000000000000000000000000000000", &mut test); + ext_from_hex("0086 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 150 (134 message + 16 MAC) ext_from_hex("030096", &mut test); // TxSignatures message with shared_input_signature TLV (type 0) // txid must match the splice funding txid (0x33 in reverse byte order) // shared_input_signature: 64-byte fuzz signature for the shared input - ext_from_hex("0047 c000000000000000000000000000000000000000000000000000000000000000 3300000000000000000000000000000000000000000000000000000000000000 0000 00 40 00000000000000000000000000000000000000000000000000000000000000dc 0100000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("0047 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb a8572fdb543546c2ed2aa0174095ab84dd37ffc1b2a5a0cb791061990a5e7b83 0000 00 40 00000000000000000000000000000000000000000000000000000000000000dc 0100000000000000000000000000000000000000000000000000000000000000 ff000000000000000000000000000000", &mut test); // Connect a block with the splice funding transaction to confirm it // The splice funding tx: version(4) + input_count(1) + txid(32) + vout(4) + script_len(1) + sequence(4) @@ -1945,7 +1945,7 @@ fn splice_seed() -> Vec { // - Output: 115536 sats to OP_0 PUSH32 6e00...00 // - Locktime: 13 ext_from_hex("0c005e", &mut test); - ext_from_hex("02000000 01 c000000000000000000000000000000000000000000000000000000000000000 00000000 00 fdffffff 01 50c3010000000000 22 00206e00000000000000000000000000000000000000000000000000000000000000 0d000000", &mut test); + ext_from_hex("02000000 01 c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb 00000000 00 fdffffff 01 50c3010000000000 22 0020d412945f28134255dc915472ee3fa18bce2db4f57c1bdb72d3636db94ae75d4d 0d000000", &mut test); // Connect additional blocks to reach minimum_depth confirmations for _ in 0..5 { @@ -1958,12 +1958,12 @@ fn splice_seed() -> Vec { // inbound read from peer id 0 of len 18 ext_from_hex("030012", &mut test); // message header indicating message length 66 - ext_from_hex("0042 03000000000000000000000000000000", &mut test); + ext_from_hex("0042 ff000000000000000000000000000000", &mut test); // inbound read from peer id 0 of len 82 (66 message + 16 MAC) ext_from_hex("030052", &mut test); // SpliceLocked message (type 77 = 0x004d): channel_id + splice_txid + mac // splice_txid must match the splice funding txid (0x33 in reverse byte order) - ext_from_hex("004d c000000000000000000000000000000000000000000000000000000000000000 3300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test); + ext_from_hex("004d c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb a8572fdb543546c2ed2aa0174095ab84dd37ffc1b2a5a0cb791061990a5e7b83 ff000000000000000000000000000000", &mut test); test } @@ -2025,23 +2025,23 @@ mod tests { // 1 assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendAcceptChannel event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679".to_string())), Some(&1)); // 2 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendFundingSigned event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendFundingSigned event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // 3 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // 4 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 for channel c400000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 020200000000000000000000000000000000000000000000000000000000000000 for channel 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809".to_string())), Some(&1)); // 5 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendRevokeAndACK event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&4)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendRevokeAndACK event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&4)); // 6 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&3)); // 7 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel c400000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 020200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel 354a9a9620ab52b899248d052e23ef6e6e847c0a0e9651d93878ed8458501809".to_string())), Some(&3)); // 8 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 1 fulfills, 0 fails, 1 commits for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 1 fulfills, 0 fails, 1 commits for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // 9 - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 1 fails, 1 commits for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 1 fails, 1 commits for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&2)); // 10 - assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (00000000000000000000000000000000000000000000000000000000000000ab:0) in 0000000000000000000000000000000000000000000000000000000000000061 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (8231a3b28778e61c47478d10e7578ad101a9f19b25a0f5522ca6a95056b90892:0) in 9ed3716a0bdeea1e4332bcf5ed47fd29becf5fa6b9d06feeb3ae6ae6c905b6a3 resolves outbound HTLC with payment hash ffb9517cec378f850587d1acde9a3ff9cf90433499e5ac15acb052dc32afef71 with timeout".to_string())), Some(&1)); } #[test] @@ -2057,9 +2057,9 @@ mod tests { super::do_test(&test, &(Arc::clone(&logger) as Arc)); let log_entries = logger.lines.lock().unwrap(); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced channel's counterparties: ChannelAnnouncement { node_signature_1: 3026020200b202200303030303030303030303030303030303030303030303030303030303030303, node_signature_2: 3026020200b202200202020202020202020202020202020202020202020202020202020202020202, bitcoin_signature_1: 3026020200b202200303030303030303030303030303030303030303030303030303030303030303, bitcoin_signature_2: 3026020200b202200202020202020202020202020202020202020202020202020202020202020202, contents: UnsignedChannelAnnouncement { features: [], chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, node_id_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), node_id_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), bitcoin_key_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), bitcoin_key_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), excess_data: [] } }".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)): ChannelUpdate { signature: 3026020200a602200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedChannelUpdate { chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, timestamp: 44, message_flags: 1, channel_flags: 0, cltv_expiry_delta: 40, htlc_minimum_msat: 0, htlc_maximum_msat: 100000000, fee_base_msat: 0, fee_proportional_millionths: 0, excess_data: [] } }".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced node: NodeAnnouncement { signature: 302502012802200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedNodeAnnouncement { features: [], timestamp: 43, node_id: NodeId(030303030303030303030303030303030303030303030303030303030303030303), rgb: [0, 0, 0], alias: NodeAlias([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), addresses: [], excess_address_data: [], excess_data: [] } }".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced channel's counterparties: ChannelAnnouncement { node_signature_1: 304402207318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea02200303030303030303030303030303030303030303030303030303030303030303, node_signature_2: 304402207318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea02200202020202020202020202020202020202020202020202020202020202020202, bitcoin_signature_1: 304402207318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea02200303030303030303030303030303030303030303030303030303030303030303, bitcoin_signature_2: 304402207318571c23409428b37a19eb7c1c8e66a50882ba23c8949bbe171eed524305ea02200202020202020202020202020202020202020202020202020202020202020202, contents: UnsignedChannelAnnouncement { features: [], chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, node_id_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), node_id_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), bitcoin_key_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), bitcoin_key_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), excess_data: [] } }".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)): ChannelUpdate { signature: 3044022028b7d3b80e33bde404c26c32054c18c6daa0f191c7668cc802dd7ec61a68482b02200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedChannelUpdate { chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, timestamp: 44, message_flags: 1, channel_flags: 0, cltv_expiry_delta: 40, htlc_minimum_msat: 0, htlc_maximum_msat: 100000000, fee_base_msat: 0, fee_proportional_millionths: 0, excess_data: [] } }".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced node: NodeAnnouncement { signature: 3045022100bab805f09b8ab4f43c816c826d4b6090a5885f8650ea07a1854f379ef180ddb902200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedNodeAnnouncement { features: [], timestamp: 43, node_id: NodeId(030303030303030303030303030303030303030303030303030303030303030303), rgb: [0, 0, 0], alias: NodeAlias([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), addresses: [], excess_address_data: [], excess_data: [] } }".to_string())), Some(&1)); } #[test] @@ -2070,29 +2070,28 @@ mod tests { super::do_test(&test, &(Arc::clone(&logger) as Arc)); let log_entries = logger.lines.lock().unwrap(); - // Channel open assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendAcceptChannel event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel ff4f00f805273c1b203bb5ebf8436bfde57b3be8c2f5e95d9491dbb181909679".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendFundingSigned event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendFundingSigned event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // Quiescence - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendStfu event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendStfu event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // Splice handshake - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendSpliceInit event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendSpliceInit event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // Interactive transaction negotiation - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxAddInput event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2)); // One for the shared input, one for the wallet input - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxAddOutput event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2)); // One for the shared output, one for the change output - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxComplete event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxAddInput event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&2)); // One for the shared input, one for the wallet input + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxAddOutput event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&2)); // One for the shared output, one for the change output + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxComplete event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // Transaction signing - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxSignatures event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendTxSignatures event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); // Splice locked - assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendSpliceLocked event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c000000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1)); - assert_eq!(log_entries.get(&("lightning::ln::channel".to_string(), "Promoting splice funding txid 0000000000000000000000000000000000000000000000000000000000000033".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendSpliceLocked event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel c852476226d5dc2a15a6c297f00ce36e1ae6137290120132254bf942a3cedecb".to_string())), Some(&1)); + assert_eq!(log_entries.get(&("lightning::ln::channel".to_string(), "Promoting splice funding txid 837b5e0a99611079cba0a5b2c1ff37dd84ab954017a02aedc2463554db2f57a8".to_string())), Some(&1)); } } diff --git a/fuzz/src/onion_message.rs b/fuzz/src/onion_message.rs index 4859f7379fb..2fcb7c49f3a 100644 --- a/fuzz/src/onion_message.rs +++ b/fuzz/src/onion_message.rs @@ -338,12 +338,13 @@ mod tests { fn test_no_onion_message_breakage() { let one_hop_om = "\ 020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\ - 000000000000000000000000000000000000000000000000e01ae0276020000000000000000000000000000\ - 000000000000000000000000000000000002020000000000000000000000000000000000000000000000000\ - 000000000000e0101022a0000000000000000000000000000014551231950b75fc4402da1732fc9bebf0010\ - 9500000000000000000000000000000004106d000000000000000000000000000000fd1092202a2a2a2a2a2\ - a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a0000000000000000000000000000000000\ + 000000000000000000000000000000000000000000000000e01fd011202da02000000000000000000000000\ + 000000000000000000000000000000000000000202000000000000000000000000000000000000000000000\ + 0000000000000000e0001020d8a09d4335d9a3b5ecbb1b0637c7a505f068e015b633ac59d01ce7fad7ead2a\ + 007401580000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 0000000000fe000100010401020000000000000000000000000000000000000410ce01cc1c6ab291cff9868\ + d9111c7fb40fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a0000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ @@ -367,8 +368,7 @@ mod tests { 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000005600000000000000000000000000000000000000000000\ + 000000000000000000000000000000000000000001200000000000000000000000000000000000000000000\ 000000000000000000"; let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) }; super::do_test(&>::from_hex(one_hop_om).unwrap(), &logger); @@ -390,8 +390,8 @@ mod tests { let two_unblinded_hops_om = "\ 020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\ 000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\ - 02020202020202020202020202020202020202026d000000000000000000000000000000eb0000000000000\ - 000000000000000000000000000000000000000000000000036041096000000000000000000000000000000\ + 0202020202020202020202020202020202020202ce01cc1c6ab291cff9868d9111c7fb4093719d205cd868d\ + 7c50aef05bb87d048a8937fdbf17cc669b40c453d756ebc643604102442464224df150a06d0de792071f872\ fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ @@ -419,7 +419,7 @@ mod tests { 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\ + 000000000000000000000000000000000000000007c00000000000000000000000000000000000000000000\ 000000000000000000"; let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) }; super::do_test(&>::from_hex(two_unblinded_hops_om).unwrap(), &logger); @@ -431,17 +431,18 @@ mod tests { let two_unblinded_two_blinded_om = "\ 020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\ 000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\ - 02020202020202020202020202020202020202026d0000000000000000000000000000009e0000000000000\ - 000000000000000000000000000000000000000000000000058045604210203030303030303030303030303\ - 030303030303030303030303030303030303020821020000000000000000000000000000000000000000000\ - 000000000000000000e0196000000000000000000000000000000e900000000000000000000000000000000\ - 000000000000000000000000000000350433042102040404040404040404040404040404040404040404040\ - 4040404040404040402ca000000000000000000000000000000420000000000000000000000000000000000\ - 00000000000000000000000000003604103f000000000000000000000000000000fd1092202a2a2a2a2a2a2\ - a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 0202020202020202020202020202020202020202ce01cc1c6ab291cff9868d9111c7fb408a0af7a61be7f6a\ + 12f738195ec991321dd938850918adf8badc90f292c57914558045604210303030303030303030303030303\ + 030303030303030303030303030303030303030821020000000000000000000000000000000000000000000\ + 000000000000000000e002442464224df150a06d0de792071f8727b4ec9f9cbf908f4bbbcec468190643aeb\ + 4bf3dd943527f4c01f88f79f61b031760474013f00000000000000000000000000000000000000000000000\ + 000000000000000000000000000000000000000000000000000000000000000000000000000000004210204\ + 0404040404040404040404040404040404040404040404040404040404040481fca62762287cb62adb2773e\ + 1a416e079d67370c9ab0a974481d82cf849cff752cdb3e3e8544aac66290cd6fb938a469a04740158000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000fe00\ + 010001040102000000000000000000000000000000000000fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2\ + a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ @@ -459,8 +460,7 @@ mod tests { 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\ + 00000000000000000000000000000000000000000c900000000000000000000000000000000000000000000\ 000000000000000000"; let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) }; super::do_test(&>::from_hex(two_unblinded_two_blinded_om).unwrap(), &logger); @@ -470,19 +470,19 @@ mod tests { } let three_blinded_om = "\ - 020000000000000000000000000000000000000000000000000000000000000e01055600020000000000000\ - 000000000000000000000000000000000000000000000000e01350433042102020202020202020202020202\ - 02020202020202020202020202020202020202026d000000000000000000000000000000b20000000000000\ - 000000000000000000000000000000000000000000000000035043304210203030303030303030303030303\ - 030303030303030303030303030303030303029600000000000000000000000000000033000000000000000\ - 000000000000000000000000000000000000000000000003604104e000000000000000000000000000000fd\ - 1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a00000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 020000000000000000000000000000000000000000000000000000000000000e00055600020000000000000\ + 000000000000000000000000000000000000000000000000e01760474013f00000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 000000000000004210202020202020202020202020202020202020202020202020202020202020202029dde\ + b727c1494248027b44d57c58585b8fe56aeb5df077419b4a85615c54ab324f46d83325f088cb156fb0fd98f\ + c17a1760474013f000000000000000000000000000000000000000000000000000000000000000000000000\ + 000000000000000000000000000000000000000000000000000000042102030303030303030303030303030\ + 3030303030303030303030303030303030303396e98f4e9b57aca2bf7d4e394b04d0a0cc5a8fcc23dff737d\ + 76de88e71025fb15e72d72c6182218b4adc54383ffb84f9a047401580000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ + 0000000000000000000000000000000000000000000000000000000000fe000100010401020000000000000\ + 00000000000000000000000fd1092202a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a\ + 2a2a2a2a0000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ @@ -501,7 +501,7 @@ mod tests { 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\ - 000000000000000000000000000000000000000004800000000000000000000000000000000000000000000\ + 000000000000000000000000000000000000000002100000000000000000000000000000000000000000000\ 000000000000000000"; let logger = TrackingLogger { lines: Mutex::new(HashMap::new()) }; super::do_test(&>::from_hex(three_blinded_om).unwrap(), &logger); diff --git a/lightning/src/crypto/utils.rs b/lightning/src/crypto/utils.rs index 88911b0baf8..2f651f3f8ae 100644 --- a/lightning/src/crypto/utils.rs +++ b/lightning/src/crypto/utils.rs @@ -78,13 +78,15 @@ pub fn sign(ctx: &Secp256k1, msg: &Message, sk: &SecretKey) -> Si pub fn sign_with_aux_rand( ctx: &Secp256k1, msg: &Message, sk: &SecretKey, entropy_source: &ES, ) -> Signature { - #[cfg(feature = "grind_signatures")] + #[cfg(all(feature = "grind_signatures", not(fuzzing)))] let sig = loop { let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes()); if sig.serialize_compact()[0] < 0x80 { break sig; } }; + #[cfg(all(feature = "grind_signatures", fuzzing))] + let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes()); #[cfg(all(not(feature = "grind_signatures"), not(ldk_test_vectors)))] let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes()); #[cfg(all(not(feature = "grind_signatures"), ldk_test_vectors))] diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 4bb8ffac9ef..db3df543d21 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -464,6 +464,7 @@ impl CounterpartyCommitmentSecrets { /// was generated in accordance with BOLT 3 and is consistent with previous secrets. pub fn provide_secret(&mut self, idx: u64, secret: [u8; 32]) -> Result<(), ()> { let pos = Self::place_secret(idx); + #[cfg(not(fuzzing))] for i in 0..pos { let (old_secret, old_idx) = self.old_secrets[i as usize]; if Self::derive_secret(secret, pos, old_idx) != old_secret {