projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
36bf817
)
Fix BP prune timer and don't panic on persistence notification failure
author
Elias Rohrer
<ero@tnull.de>
Thu, 20 Apr 2023 13:37:11 +0000
(15:37 +0200)
committer
Elias Rohrer
<ero@tnull.de>
Fri, 21 Apr 2023 09:44:36 +0000
(11:44 +0200)
lightning-background-processor/src/lib.rs
patch
|
blob
|
history
diff --git
a/lightning-background-processor/src/lib.rs
b/lightning-background-processor/src/lib.rs
index 7d705bdcc3ae05630c53f1806e30b95d337ac919..9be5127472fe039126356c6ebcd0997a56094ff0 100644
(file)
--- a/
lightning-background-processor/src/lib.rs
+++ b/
lightning-background-processor/src/lib.rs
@@
-342,7
+342,8
@@
macro_rules! define_run_body {
// falling back to our usual hourly prunes. This avoids short-lived clients never
// pruning their network graph. We run once 60 seconds after startup before
// continuing our normal cadence.
// falling back to our usual hourly prunes. This avoids short-lived clients never
// pruning their network graph. We run once 60 seconds after startup before
// continuing our normal cadence.
- if $timer_elapsed(&mut last_prune_call, if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER }) {
+ let prune_timer = if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER };
+ if $timer_elapsed(&mut last_prune_call, prune_timer) {
// The network graph must not be pruned while rapid sync completion is pending
if let Some(network_graph) = $gossip_sync.prunable_network_graph() {
#[cfg(feature = "std")] {
// The network graph must not be pruned while rapid sync completion is pending
if let Some(network_graph) = $gossip_sync.prunable_network_graph() {
#[cfg(feature = "std")] {
@@
-360,7
+361,8
@@
macro_rules! define_run_body {
have_pruned = true;
}
have_pruned = true;
}
- last_prune_call = $get_timer(NETWORK_PRUNE_TIMER);
+ let prune_timer = if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER };
+ last_prune_call = $get_timer(prune_timer);
}
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) {
}
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) {
@@
-867,7
+869,10
@@
mod tests {
if key == "network_graph" {
if let Some(sender) = &self.graph_persistence_notifier {
if key == "network_graph" {
if let Some(sender) = &self.graph_persistence_notifier {
- sender.send(()).unwrap();
+ match sender.send(()) {
+ Ok(()) => {},
+ Err(std::sync::mpsc::SendError(())) => println!("Persister failed to notify as receiver went away."),
+ }
};
if let Some((error, message)) = self.graph_error {
};
if let Some((error, message)) = self.graph_error {