Skip to content

Commit 3a0356f

Browse files
authored
Merge pull request #851 from TheBlueMatt/2021-03-holding-cell-clear-msg-get
Clean up and more liberally free holding cell HTLCs (without re-entrancy)
2 parents c7e198e + 34fcd99 commit 3a0356f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+912
-335
lines changed

fuzz/ci-fuzz.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
set -x
34

45
pushd src/msg_targets
56
rm msg_*.rs

fuzz/src/bin/chanmon_consistency_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/chanmon_deser_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/full_stack_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_accept_channel_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_announcement_signatures_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_channel_announcement_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_channel_reestablish_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_channel_update_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_closing_signed_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_commitment_signed_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_decoded_onion_error_packet_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_error_message_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_funding_created_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_funding_locked_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_funding_signed_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_gossip_timestamp_filter_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_init_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

fuzz/src/bin/msg_node_announcement_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ fn run_test_cases() {
9393
}
9494
}
9595
}
96+
let mut failed_outputs = Vec::new();
9697
for (test, thread) in threads.drain(..) {
9798
if let Some(output) = thread.join().unwrap() {
98-
println!("Output of {}:\n{}", test, output);
99-
panic!();
99+
println!("\nOutput of {}:\n{}\n", test, output);
100+
failed_outputs.push(test);
100101
}
101102
}
103+
if !failed_outputs.is_empty() {
104+
println!("Test cases which failed: ");
105+
for case in failed_outputs {
106+
println!("{}", case);
107+
}
108+
panic!();
109+
}
102110
}

0 commit comments

Comments
 (0)