From 1c3a15343c47955ada56c4f507d6ea1b3242325b Mon Sep 17 00:00:00 2001 From: AdamISZ Date: Fri, 25 Jan 2019 18:12:39 +0100 Subject: [PATCH] graceful sender-side timeout of PayJoin if fails --- scripts/sendpayment.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index 62b1f9d..cef413e 100644 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -232,8 +232,15 @@ def main(): # to remove noise, and mostly communicate to the user with the fn # log.info (directly or via default taker_info_callback). set_logging_level("INFO") + # in the case where the payment just hangs for a long period, allow + # it to fail gracefully with an information message; this is triggered + # only by the stallMonitor, which gives up after 20*maker_timeout_sec: + def p2ep_on_finished_callback(res, fromtx=False, waittime=0.0, + txdetails=None): + log.error("PayJoin payment was NOT made, timed out.") + reactor.stop() taker = P2EPTaker(options.p2ep, wallet, schedule, - callbacks=(None, None, None)) + callbacks=(None, None, p2ep_on_finished_callback)) else: taker = Taker(wallet, schedule,