projects
/
ldk-sample
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5f6bfd3
)
Print the ultimate payment failure reason on PaymentFailed events
author
Matt Corallo
<git@bluematt.me>
Mon, 24 Apr 2023 15:52:24 +0000
(15:52 +0000)
committer
Matt Corallo
<git@bluematt.me>
Tue, 25 Apr 2023 06:25:42 +0000
(06:25 +0000)
src/main.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index cad7425e2087644aac4e6c6afca33ad7e22b6f9c..cc67700525b5ff5acd2b1592c7319127e4e93fad 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-18,6
+18,7
@@
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget,
use lightning::chain::keysinterface::{EntropySource, InMemorySigner, KeysManager};
use lightning::chain::{chainmonitor, ChannelMonitorUpdateStatus};
use lightning::chain::{Filter, Watch};
use lightning::chain::keysinterface::{EntropySource, InMemorySigner, KeysManager};
use lightning::chain::{chainmonitor, ChannelMonitorUpdateStatus};
use lightning::chain::{Filter, Watch};
+use lightning::events::{Event, PaymentFailureReason, PaymentPurpose};
use lightning::ln::channelmanager;
use lightning::ln::channelmanager::{
ChainParameters, ChannelManagerReadArgs, SimpleArcChannelManager,
use lightning::ln::channelmanager;
use lightning::ln::channelmanager::{
ChainParameters, ChannelManagerReadArgs, SimpleArcChannelManager,
@@
-29,7
+30,6
@@
use lightning::routing::gossip;
use lightning::routing::gossip::{NodeId, P2PGossipSync};
use lightning::routing::router::DefaultRouter;
use lightning::util::config::UserConfig;
use lightning::routing::gossip::{NodeId, P2PGossipSync};
use lightning::routing::router::DefaultRouter;
use lightning::util::config::UserConfig;
-use lightning::events::{Event, PaymentPurpose};
use lightning::util::ser::ReadableArgs;
use lightning_background_processor::{process_events_async, GossipSync};
use lightning_block_sync::init;
use lightning::util::ser::ReadableArgs;
use lightning_background_processor::{process_events_async, GossipSync};
use lightning_block_sync::init;
@@
-243,10
+243,11
@@
async fn handle_ldk_events(
Event::PaymentPathFailed { .. } => {}
Event::ProbeSuccessful { .. } => {}
Event::ProbeFailed { .. } => {}
Event::PaymentPathFailed { .. } => {}
Event::ProbeSuccessful { .. } => {}
Event::ProbeFailed { .. } => {}
- Event::PaymentFailed { payment_hash, .. } => {
+ Event::PaymentFailed { payment_hash,
reason,
.. } => {
print!(
print!(
- "\nEVENT: Failed to send payment to payment hash {:?}: exhausted payment retry attempts",
- hex_utils::hex_str(&payment_hash.0)
+ "\nEVENT: Failed to send payment to payment hash {:?}: {:?}",
+ hex_utils::hex_str(&payment_hash.0),
+ if let Some(r) = reason { r } else { PaymentFailureReason::RetriesExhausted }
);
print!("> ");
io::stdout().flush().unwrap();
);
print!("> ");
io::stdout().flush().unwrap();