Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
107de27
Introduce `MessageQueueNotifierGuard` type
tnull Jan 8, 2025
309591a
Simplify message handling logic
tnull Aug 1, 2025
a18b2c9
Correct post-update action comment on claims from closed chans
TheBlueMatt Aug 2, 2025
d2c7c66
Get rid of TimeProvider on LSPS5/client.
martinsaposnic Jul 28, 2025
e01663a
Merge pull request #3981 from tnull/2025-08-message-queue-notifier
TheBlueMatt Aug 4, 2025
9ab2d27
Use VecDeque on LSPS5/Client to limit amount of pending requests
martinsaposnic Jul 28, 2025
cf23e91
Remove peerState if there are no pending requests with that peer
martinsaposnic Jul 28, 2025
89962a1
LSPS5: Correct notification cooldown & reset logic
martinsaposnic Jul 30, 2025
bae3224
introduce SLOW_DOWN error so we don't silently fail to send an LSPS5/…
martinsaposnic Aug 5, 2025
d704eb8
Merge pull request #3969 from martinsaposnic/simplify-lsps5-client-pe…
tnull Aug 5, 2025
7c5491d
Merge pull request #3975 from martinsaposnic/fix-lsps5-notification-c…
tnull Aug 5, 2025
42243e8
Change abs_diff to duration_since, so it returns a Duration
martinsaposnic Aug 4, 2025
dc335e9
Merge pull request #3985 from TheBlueMatt/2025-08-fix-comment
valentinewallace Aug 5, 2025
583a9a3
Ensure partial MPP claims continue to blocks channels on restart
TheBlueMatt Jul 14, 2025
48a0862
Enter FundingNegotiated state after constructing funding tx
jkczyz Jul 9, 2025
29081e7
Return an Option from ChannelContext::get_initial_commitment_signed
jkczyz Jul 9, 2025
c51b6ff
Use consistent initial commitment_signed naming
jkczyz Jul 11, 2025
63604cb
Remove some #[rustfmt::skip] from channel.rs
jkczyz Aug 4, 2025
869866f
Merge pull request #3928 from TheBlueMatt/2024-09-future-async-tests
TheBlueMatt Aug 5, 2025
7c39480
Detect and fail-back monitor-blocked un-forwarded HTLCs at close
TheBlueMatt Aug 5, 2025
9350c57
Merge pull request #3982 from jkczyz/2025-08-get-initial-commitment-s…
wpaulino Aug 5, 2025
ad99d9a
Detect channel alternative funding transaction confirmation
wpaulino Jul 16, 2025
89ce01d
Broadcast holder commitment for currently confirmed funding
wpaulino Jul 16, 2025
0a23664
Merge pull request #3989 from TheBlueMatt/2023-10-pending-htlcs-lost-…
TheBlueMatt Aug 6, 2025
de2005a
Merge pull request #3939 from wpaulino/splice-funding-commitment-broa…
TheBlueMatt Aug 6, 2025
f624047
Marginally simplify types for req'd `counterparty_node_id` in claim
TheBlueMatt Aug 4, 2025
7c735d9
Add a `counterparty_node_id` to `ClaimedHTLC` in claimed events
TheBlueMatt Aug 4, 2025
10df89d
Stop using RAA-unblocking post event action chan funding outpoints
TheBlueMatt Aug 4, 2025
552d8e4
Make LSPSDateTime Copy rather than explicitely _clone_ing
martinsaposnic Aug 4, 2025
a80c855
Block RAA `ChannelMonitorUpdate`s on `PaymentClaimed` events
TheBlueMatt Aug 4, 2025
e1edbde
Use rust-lld linker for windows to fix link.exe error
martinsaposnic Aug 7, 2025
c8450bf
Merge pull request #3987 from martinsaposnic/lsps5-and-more-follow-ups
tnull Aug 7, 2025
ed1f304
Merge pull request #3988 from TheBlueMatt/2025-08-durable-claims
wpaulino Aug 7, 2025
381416a
Merge pull request #3995 from martinsaposnic/fix-3990
TheBlueMatt Aug 7, 2025
10b0ddb
Bump `electrum-client` to v0.24.0
tnull Aug 7, 2025
9d66258
Fix clippy::mismatched-lifetime-syntaxes
dunxen Aug 8, 2025
42ea2e9
Allow unused imports for traits used in macros
dunxen Aug 8, 2025
e2ff3da
Allow dead_code for `Keys` struct
dunxen Aug 8, 2025
3e4b54c
Fix useless concat
dunxen Aug 8, 2025
b104f3a
Fix cloned_ref_to_slice_refs
dunxen Aug 8, 2025
91a0680
Merge pull request #3997 from dunxen/2025-08-fixmismatched-lifetime-s…
TheBlueMatt Aug 8, 2025
29dfc1f
feat: add validation for leading whitespace in BOLT 12 bech32 strings
erickcestari Aug 8, 2025
6638c13
Introduce `FundingTransactionReadyForSignatures` event
dunxen Apr 14, 2025
c2b293c
Add `prev_ouput` to `NegotiatedTxInput` for SIGHASH_ALL & key-spend c…
dunxen Jul 16, 2025
9cd4091
Verify the holder provided valid witnesses and uses SIGHASH_ALL
dunxen Jul 16, 2025
192618b
Merge pull request #3998 from erickcestari/encoded-offer-with-leading…
TheBlueMatt Aug 8, 2025
d99e59b
Always emit bump events, even when fees are sufficient
wvanlint Aug 8, 2025
c5763db
Add note for alternative_funding_confirmed assertion in promote_funding
wpaulino Aug 6, 2025
5d7a3f2
Make splice-funding confirmation assertions non-debug
wpaulino Aug 6, 2025
746bbea
Broadcast holder commitment immediately on alternative funding reorg
wpaulino Aug 6, 2025
3840ff6
Gate channel.rs `Keys` test util on the right cfg flag
TheBlueMatt Aug 8, 2025
cc70a7d
Revert "Allow unused imports for traits used in macros"
TheBlueMatt Aug 8, 2025
7fba8fc
Allow rustc's unused_imports while its broken
TheBlueMatt Aug 8, 2025
c475db5
Merge pull request #4000 from TheBlueMatt/2025-08-3997-followups
TheBlueMatt Aug 11, 2025
6d47f0a
Merge pull request #3889 from dunxen/2025-06-readyforsigningevent
wpaulino Aug 11, 2025
1d8b3db
Consider currently confirmed FundingScope when claiming commitments
wpaulino Jul 30, 2025
08892b5
Make `channel_parameters` explicit to `build_counterparty_commitment_tx`
wpaulino Aug 7, 2025
775f3d9
Use `FundingScope` spent when signing watchtower justice transactions
wpaulino Aug 7, 2025
83da6c3
Merge pull request #3991 from tnull/2025-08-bump-electrum-client
valentinewallace Aug 11, 2025
3b939c0
Merge pull request #4001 from wvanlint/wvanlint/always_emit_bump_event
TheBlueMatt Aug 11, 2025
15fb61e
Remove APIs to create static invoice/async offers
valentinewallace Aug 1, 2025
e787740
Expose async offer cache API to OffersMessageFlow users
valentinewallace Aug 1, 2025
3691e8f
Update API for writeable async offer cache to be bytes
valentinewallace Aug 11, 2025
7833e53
Static invoice server: fix incorrect comment
valentinewallace Aug 1, 2025
5eb8a0f
De-dedup paths between flow and async offer cache
valentinewallace Aug 1, 2025
7878a00
check_refresh_static_invoices: remove duration param
valentinewallace Aug 1, 2025
2d478dc
Refresh async offers on set_inv_server_paths
valentinewallace Aug 1, 2025
0506fab
Replace unused async offers based on creation time
valentinewallace Aug 7, 2025
37ab3d3
Async recipient: track static invoice creation time
valentinewallace Aug 7, 2025
be591c1
Async receive: update static invoices when stale
valentinewallace Aug 8, 2025
3772c47
Update static inv server OM TLVs to not conflict
valentinewallace Aug 8, 2025
c0b8a44
Remove async payments cfg flag
valentinewallace Aug 8, 2025
6a4169d
Merge pull request #3980 from wpaulino/splice-commitment-claims
TheBlueMatt Aug 11, 2025
c7694f4
[LSPS5] Change notification cooldown time to 1 minute, also update docs.
martinsaposnic Aug 7, 2025
0854152
Add fuzzing for `StaticInvoice`
elnosh Aug 11, 2025
efb8d58
Merge pull request #3994 from martinsaposnic/lsps5-cooldown-time-fix
tnull Aug 13, 2025
3b16c77
Merge pull request #3999 from valentinewallace/2025-08-3618-followups
tnull Aug 13, 2025
dc67685
Prefactor: Introduce `PaymentQueueEntry`
tnull Jan 13, 2025
e6ca208
Prefactor: Rename `StoredWebhook` to `Webhook`
tnull Aug 4, 2025
b39d32c
Merge pull request #4005 from elnosh/fuzz-static-invoice
TheBlueMatt Aug 13, 2025
874b9c7
Log payment hash of the HTLC that causes a force closure
yellowred Aug 11, 2025
e77c83d
Add the blamed HTLC payment hash to `ClosureReason::HTLCsTimedOut`
yellowred Aug 11, 2025
df9232b
Merge pull request #4003 from yellowred/add_htlc_payment_hash_log
TheBlueMatt Aug 13, 2025
f0551f7
Follow-ups from removing async_payments cfg flag
valentinewallace Aug 13, 2025
8230ff7
Stop reading fee estimates directly in `full_stack_target`
TheBlueMatt Aug 12, 2025
dadac03
Stop counting for RNG output in `full_stack_target`
TheBlueMatt Aug 12, 2025
ee06a90
Update comments in `full_stack_target` test for reduced breakage
TheBlueMatt Aug 12, 2025
ac8f897
Merge pull request #4006 from TheBlueMatt/2025-08-robust-fst
valentinewallace Aug 14, 2025
183c0be
Use struct for HolderCommitmentPoint
jkczyz Aug 14, 2025
68cd71c
Detect commitment transaction confirmation in ChannelMonitor instead
wpaulino Aug 12, 2025
633cb49
Merge pull request #4013 from wpaulino/commitment-tx-confirmed-from-m…
TheBlueMatt Aug 17, 2025
bf91c4e
Prefactor: Simplify `last_notification_sent` tracking
tnull Aug 12, 2025
b3e9bc6
Also reset notification cooldown on peer disconnection
tnull Aug 12, 2025
ce89e6b
Refactor `LSPS5ServiceHandler` to hold a `PeerState`
tnull Aug 12, 2025
9065f31
Only prune on `peer_{dis}connected`
tnull Aug 12, 2025
f95ba69
Add missing license headers
tnull Aug 13, 2025
5314ebb
offer: fix path validation to only require non-empty paths when issue…
erickcestari Aug 18, 2025
4b3ad40
Move `channel_acceptance_tests.rs` to `channel_open_tests.rs`
TheBlueMatt Aug 16, 2025
399e6e7
Move additional channel opening tests to `channel_open_tests.rs`
TheBlueMatt Aug 18, 2025
e298854
Fix panic when calling `batch_funding_transaction_generated` early
TheBlueMatt Aug 16, 2025
c1fefcf
Allow funding errors in `full_stack_target` fuzzer
TheBlueMatt Aug 16, 2025
66a4932
Merge pull request #4018 from erickcestari/fix-require-path
TheBlueMatt Aug 18, 2025
e1a31e1
Merge pull request #4008 from tnull/2025-08-liquidity-persistence-pre…
TheBlueMatt Aug 18, 2025
82ce98a
Write structs to serialise-deserialise Channels inside Peer-storage
adi2011 Jun 28, 2025
d7901a1
Remove #[rustfmt::skip] from fn write
adi2011 Jul 16, 2025
61bc1e0
Serialise ChannelMonitors and send them over inside Peer Storage
adi2011 Jul 16, 2025
33d466a
Determine if we have lost data
adi2011 Jun 28, 2025
51c475e
test: Modify test_peer_storage to check latest changes
adi2011 Jun 28, 2025
e51028c
Remove #[rustfmt] from test_peer_storage
adi2011 Aug 18, 2025
8c48293
Rename HolderCommitmentPoint::next_point
jkczyz Aug 18, 2025
27138eb
Rename HolderCommitmentPoint::point
jkczyz Aug 18, 2025
a7ba4dd
Store current_point in HolderCommitmentPoint
jkczyz Aug 18, 2025
c8af714
Check correct commitment number/point in initial commitment_signed
jkczyz Aug 14, 2025
87db06a
Use correct commitment number/point in initial commitment_signed
jkczyz Aug 1, 2025
13c81a1
Drop outdated async signing comment
jkczyz Aug 15, 2025
9066f62
Allow building Invoice from Bolt11InvoiceDescriptionRef
benthecarman Aug 14, 2025
72fd628
Merge pull request #4014 from jkczyz/2025-08-splice-initial-commitmen…
TheBlueMatt Aug 19, 2025
7bb1652
Merge pull request #3897 from adi2011/peer-storage/serialise-deserialise
TheBlueMatt Aug 19, 2025
8d86558
Revert fuzz changes in 61bc1e06e75113238501e7ce29e793aa3ba43778
TheBlueMatt Aug 19, 2025
9d9cfe6
Add debug assertions on revoked counterparty tx number fetching
TheBlueMatt Aug 19, 2025
2ce5479
Correct comments and flow in `test_peer_storage`
TheBlueMatt Aug 19, 2025
c6103e6
Move `test_peer_storage` to `reload_tests`
TheBlueMatt Aug 19, 2025
0a598a3
Update `test_peer_storage` style to match newer tests
TheBlueMatt Aug 19, 2025
dd02498
Stop skipping the line in quiescence if our peer speaks first
TheBlueMatt Aug 12, 2025
e15c2f5
Add a `QuiescentAction` to track why we're going quiescent
TheBlueMatt Aug 10, 2025
c7e4887
Allow quiescence-init while disconnected from peers
TheBlueMatt Aug 18, 2025
96f9242
Merge pull request #4012 from benthecarman/desc-ref-to-desc
TheBlueMatt Aug 19, 2025
c2d9b97
Merge pull request #4022 from TheBlueMatt/2025-08-3897-followups
tnull Aug 20, 2025
9d2d368
Re-phrase splice_channel error message
jkczyz Aug 20, 2025
8ef76e9
Use WarnAndDisconnect to fail a splice
jkczyz Aug 20, 2025
fa9cb2e
Fix comment regarding holder commitment point
jkczyz Aug 20, 2025
7a5a2a9
Set HolderCommitmentPoint::current_point on read
jkczyz Aug 20, 2025
9724d19
Merge pull request #4007 from TheBlueMatt/2025-08-splice-quiescent
wpaulino Aug 20, 2025
3ae8c4a
Fetch HolderCommitmentPoint::current_point on read
jkczyz Aug 20, 2025
9bd2144
Check splice contributions against SignedAmount::MAX_MONEY
jkczyz Jul 28, 2025
c9ddcbf
Remove their_funding_contribution_satoshis from FundingNegotiationCon…
jkczyz Jul 30, 2025
70929ae
Remove TransactionU16LenLimited
jkczyz Jul 31, 2025
3327382
Include witness weights in FundingNegotiationContext
jkczyz Aug 6, 2025
f889222
Merge pull request #4015 from TheBlueMatt/2025-08-fst-funding
tnull Aug 21, 2025
33291b6
Include invoice_slot in OfferPathsRequest message
valentinewallace Aug 13, 2025
75b7e80
Account for shared input EMPTY_SCRIPT_SIG_WEIGHT
jkczyz Aug 21, 2025
ed0bf36
Cache pending offer in specific invoice slot
valentinewallace Aug 18, 2025
748c04a
Track invoice_slot in ServeStaticInvoice context
valentinewallace Aug 13, 2025
06f2019
Remove now-unused ServeStaticInv::inv_slot from OM
valentinewallace Aug 13, 2025
f53325b
Replace StaticInvoiceReq::invoice_id with ::inv_slot
valentinewallace Aug 13, 2025
e159ae4
Remove now-unused ServeStaticInvoice::invoice_id
valentinewallace Aug 13, 2025
1f4bd17
Merge pull request #4009 from valentinewallace/2025-08-simplify-stati…
valentinewallace Aug 21, 2025
0a75f92
Add `TxBuilder::get_next_commitment_stats`
tankyleo Jul 31, 2025
3a3e7eb
Adjust dust exposure due to excess fees for clarity
tankyleo Aug 6, 2025
06ed9cb
Add `ChannelContext::get_next_{local, remote}_commitment_stats`
tankyleo Jul 31, 2025
48b412a
Improve prediction of commitment stats in `validate_update_add_htlc`
tankyleo Jul 31, 2025
3218db1
Improve prediction of commitment stats in `can_accept_incoming_htlc`
tankyleo Jul 31, 2025
d36fdab
Improve prediction of commitment stats in `validate_update_fee`
tankyleo Jul 31, 2025
124bd42
Improve prediction of commitment stats in `can_send_update_fee`
tankyleo Jul 31, 2025
8a1c9d9
Add validation of the fees predicted by `next_commitment_stats`
tankyleo Jul 31, 2025
f75812f
Delete dead `next_{local, remote}_commitment_tx_fee_info_cached`
tankyleo Jul 31, 2025
1f8a7d7
Return ChannelError instead of calling expect
jkczyz Aug 20, 2025
6f78d57
Merge pull request #4023 from jkczyz/splice-initial-commitment-signed…
TheBlueMatt Aug 22, 2025
9d7ec5f
Rename ChannelContext::cur_counterparty_commitment_transaction_number
jkczyz Aug 22, 2025
a6cef30
Rename ChannelContext::counterparty_cur_commitment_point
jkczyz Aug 22, 2025
6bde10c
Rename ChannelContext::counterparty_prev_commitment_point
jkczyz Aug 22, 2025
bdb8d5d
Replace funding input tuple with struct
jkczyz Aug 21, 2025
ae58a4f
Use a SpliceContribution enum for passing splice-in params
jkczyz Aug 6, 2025
3245ebf
Add splice-out support
jkczyz Jul 31, 2025
ce203f2
Support accepting splice-out
jkczyz Aug 8, 2025
5f73b70
Merge pull request #3979 from jkczyz/2025-07-splice-out
wpaulino Aug 25, 2025
9fa6e3c
Fix debug_assert on our_funding_contribution
jkczyz Aug 25, 2025
8213f65
Include fees in SpliceContribution docs
jkczyz Aug 25, 2025
de65412
Add clarifying comment to signer_maybe_unblocked
jkczyz Aug 25, 2025
4f96b35
Merge pull request #3921 from tankyleo/dust-limit
TheBlueMatt Aug 26, 2025
a18f362
Merge pull request #4028 from jkczyz/2025-08-splice-out-fixups
jkczyz Aug 26, 2025
1c36624
Merge pull request #4025 from jkczyz/2025-08-current-next-counterpart…
wpaulino Aug 26, 2025
ebf378c
Compute trampoline session_priv from outer session_priv
valentinewallace Aug 25, 2025
69f8a65
Simplify test_trampoline_unblinded_receive
valentinewallace Aug 25, 2025
3daab67
Simplify test_trampoline_single_hop_receive
valentinewallace Aug 25, 2025
b6febbc
Test trampoline fwd payload encoded as receive
valentinewallace Aug 26, 2025
35a0eb5
f: fix failing test from 3daab676b0be582b8b8624ebd3567e4ab4eb685b
a-mpch Aug 27, 2025
e0b0d25
Add trampoline `LocalHTLCFailureReason` variants per spec
a-mpch Aug 14, 2025
cfbade2
Enforce Trampoline constraints
a-mpch Aug 14, 2025
30e81a9
f: fix edge case only when trampoline is also receiver
a-mpch Sep 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
- name: Use rust-lld linker on Windows
if: matrix.platform == 'windows-latest'
shell: bash
run: echo "RUSTFLAGS=-C linker=rust-lld" >> "$GITHUB_ENV"
- name: Install no-std-check dependencies for ARM Embedded
if: "matrix.platform == 'self-hosted'"
run: |
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ check-cfg = [
"cfg(taproot)",
"cfg(require_route_graph_test)",
"cfg(splicing)",
"cfg(async_payments)",
"cfg(simple_close)",
"cfg(peer_storage)",
]
2 changes: 2 additions & 0 deletions ci/check-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -x
CLIPPY() {
# shellcheck disable=SC2086
RUSTFLAGS='-D warnings' cargo clippy $1 -- $2 \
`# https://github.com/rust-lang/rust-clippy/issues/15442` \
-A unused_imports \
`# Things clippy defaults to allowing but we should avoid` \
-D clippy::clone_on_ref_ptr \
`# Things where clippy is just wrong` \
Expand Down
2 changes: 2 additions & 0 deletions ci/ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ RUSTFLAGS="--cfg=async_payments" cargo test --verbose --color always -p lightnin
RUSTFLAGS="--cfg=simple_close" cargo test --verbose --color always -p lightning
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
RUSTFLAGS="--cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
RUSTFLAGS="--cfg=peer_storage" cargo test --verbose --color always -p lightning
1 change: 1 addition & 0 deletions fuzz/src/bin/gen_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GEN_TEST invoice_deser
GEN_TEST invoice_request_deser
GEN_TEST offer_deser
GEN_TEST bolt11_deser
GEN_TEST static_invoice_deser
GEN_TEST onion_message
GEN_TEST peer_crypt
GEN_TEST process_network_graph
Expand Down
120 changes: 120 additions & 0 deletions fuzz/src/bin/static_invoice_deser_target.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// This file is Copyright its original authors, visible in version control
// history.
//
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// You may not use this file except in accordance with one or both of these
// licenses.

// This file is auto-generated by gen_target.sh based on target_template.txt
// To modify it, modify target_template.txt and run gen_target.sh instead.

#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
#![cfg_attr(rustfmt, rustfmt_skip)]

#[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");

extern crate lightning_fuzz;
use lightning_fuzz::static_invoice_deser::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
static_invoice_deser_run(data.as_ptr(), data.len());
});
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {
static_invoice_deser_run(data.as_ptr(), data.len());
});
}
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
static_invoice_deser_run(data.as_ptr(), data.len());
});

#[cfg(feature = "stdin_fuzz")]
fn main() {
use std::io::Read;

let mut data = Vec::with_capacity(8192);
std::io::stdin().read_to_end(&mut data).unwrap();
static_invoice_deser_run(data.as_ptr(), data.len());
}

#[test]
fn run_test_cases() {
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
let data: Vec<u8> = vec![0];
static_invoice_deser_run(data.as_ptr(), data.len());
}
let mut threads = Vec::new();
let threads_running = Arc::new(atomic::AtomicUsize::new(0));
if let Ok(tests) = fs::read_dir("test_cases/static_invoice_deser") {
for test in tests {
let mut data: Vec<u8> = Vec::new();
let path = test.unwrap().path();
fs::File::open(&path).unwrap().read_to_end(&mut data).unwrap();
threads_running.fetch_add(1, atomic::Ordering::AcqRel);

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
static_invoice_deser_test(&data, panic_logger);
}).is_err() {
Some(string_logger.into_string())
} else { None };
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
}
}
}
let mut failed_outputs = Vec::new();
for (test, thread) in threads.drain(..) {
if let Some(output) = thread.join().unwrap() {
println!("\nOutput of {}:\n{}\n", test, output);
failed_outputs.push(test);
}
}
if !failed_outputs.is_empty() {
println!("Test cases which failed: ");
for case in failed_outputs {
println!("{}", case);
}
panic!();
}
}
Loading
Loading