mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 15:44:21 +01:00
lightningd: remove htlc_set destruction timer once we head to invoice.
Otherwise tests for hold_invoice fail on Travis (they use 180 / 2 as the timeout, and we free it after 70 seconds). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
fb7c67889e
commit
2e97afd1ac
@@ -1,4 +1,3 @@
|
||||
#include <common/memleak.h>
|
||||
#include <common/timeout.h>
|
||||
#include <lightningd/htlc_end.h>
|
||||
#include <lightningd/htlc_set.h>
|
||||
@@ -84,10 +83,12 @@ static struct htlc_set *new_htlc_set(struct lightningd *ld,
|
||||
* - SHOULD wait for at least 60 seconds after the initial
|
||||
* HTLC.
|
||||
*/
|
||||
notleak(new_reltimer(ld->timers, set, time_from_sec(70),
|
||||
timeout_htlc_set, set));
|
||||
set->timeout = new_reltimer(ld->timers, set, time_from_sec(70),
|
||||
timeout_htlc_set, set);
|
||||
htlc_set_map_add(&ld->htlc_sets, set);
|
||||
tal_add_destructor2(set, destroy_htlc_set, &ld->htlc_sets);
|
||||
#else
|
||||
set->timeout = NULL;
|
||||
#endif
|
||||
return set;
|
||||
}
|
||||
@@ -194,6 +195,8 @@ void htlc_set_add(struct lightningd *ld,
|
||||
}
|
||||
|
||||
if (amount_msat_eq(set->so_far, total_msat)) {
|
||||
/* Disable timer now, in case invoice_hook is slow! */
|
||||
tal_free(set->timeout);
|
||||
invoice_try_pay(ld, set, details);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ struct htlc_set {
|
||||
struct amount_msat total_msat, so_far;
|
||||
struct sha256 payment_hash;
|
||||
struct htlc_in **htlcs;
|
||||
struct oneshot *timeout;
|
||||
};
|
||||
|
||||
static inline const struct sha256 *keyof_htlc_set(const struct htlc_set *set)
|
||||
|
||||
Reference in New Issue
Block a user