mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
remove flow dependency on payment
This commit is contained in:
parent
451a1465ed
commit
c4cbc10cfa
@ -6,7 +6,6 @@
|
||||
#include <common/type_to_string.h>
|
||||
#include <math.h>
|
||||
#include <plugins/renepay/flow.h>
|
||||
#include <plugins/renepay/pay.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef SUPERVERBOSE
|
||||
@ -192,7 +191,6 @@ void chan_extra_can_send(
|
||||
|
||||
/* Update the knowledge that this (channel,direction) cannot send.*/
|
||||
void chan_extra_cannot_send(
|
||||
struct pay_flow *pf,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
const struct short_channel_id_dir *scidd,
|
||||
struct amount_msat sent)
|
||||
@ -228,15 +226,6 @@ void chan_extra_cannot_send(
|
||||
|
||||
ce->half[scidd->dir].known_max = amount_msat_min(ce->half[scidd->dir].known_max,x);
|
||||
|
||||
payflow_note(pf, LOG_INFORM,
|
||||
"Failure of %s for %s capacity [%s,%s] -> [%s,%s]",
|
||||
fmt_amount_msat(tmpctx, sent),
|
||||
type_to_string(tmpctx,struct short_channel_id_dir,scidd),
|
||||
fmt_amount_msat(tmpctx, oldmin),
|
||||
fmt_amount_msat(tmpctx, oldmax),
|
||||
fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_min),
|
||||
fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_max));
|
||||
|
||||
chan_extra_adjust_half(ce,!scidd->dir);
|
||||
}
|
||||
/* Update the knowledge that this (channel,direction) has liquidity x.*/
|
||||
@ -276,7 +265,6 @@ void chan_extra_set_liquidity(
|
||||
}
|
||||
/* Update the knowledge that this (channel,direction) has sent x msat.*/
|
||||
void chan_extra_sent_success(
|
||||
struct pay_flow *pf,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
const struct short_channel_id_dir *scidd,
|
||||
struct amount_msat x)
|
||||
@ -306,15 +294,6 @@ void chan_extra_sent_success(
|
||||
if(!amount_msat_sub(&new_b,ce->half[scidd->dir].known_max,x))
|
||||
new_b = AMOUNT_MSAT(0);
|
||||
|
||||
payflow_note(pf, LOG_DBG,
|
||||
"Success of %s for %s capacity [%s,%s] -> [%s,%s]",
|
||||
fmt_amount_msat(tmpctx, x),
|
||||
type_to_string(tmpctx,struct short_channel_id_dir,scidd),
|
||||
fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_min),
|
||||
fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_max),
|
||||
fmt_amount_msat(tmpctx, new_a),
|
||||
fmt_amount_msat(tmpctx, new_b));
|
||||
|
||||
ce->half[scidd->dir].known_min = new_a;
|
||||
ce->half[scidd->dir].known_max = new_b;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <ccan/htable/htable_type.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/gossmap.h>
|
||||
#include <plugins/renepay/payment.h>
|
||||
|
||||
|
||||
// TODO(eduardo): a hard coded constant to indicate a limit on any channel
|
||||
// capacity. Channels for which the capacity is unknown (because they are not
|
||||
@ -158,8 +158,7 @@ void chan_extra_can_send(struct chan_extra_map *chan_extra_map,
|
||||
struct amount_msat x);
|
||||
|
||||
/* Update the knowledge that this (channel,direction) cannot send x msat.*/
|
||||
void chan_extra_cannot_send(struct pay_flow* pf,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
void chan_extra_cannot_send(struct chan_extra_map *chan_extra_map,
|
||||
const struct short_channel_id_dir *scidd,
|
||||
struct amount_msat x);
|
||||
|
||||
@ -169,8 +168,7 @@ void chan_extra_set_liquidity(struct chan_extra_map *chan_extra_map,
|
||||
struct amount_msat x);
|
||||
|
||||
/* Update the knowledge that this (channel,direction) has sent x msat.*/
|
||||
void chan_extra_sent_success(struct pay_flow *pf,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
void chan_extra_sent_success(struct chan_extra_map *chan_extra_map,
|
||||
const struct short_channel_id_dir *scidd,
|
||||
struct amount_msat x);
|
||||
|
||||
|
@ -1150,9 +1150,11 @@ static void handle_sendpay_failure_flow(struct pay_flow *pf,
|
||||
if((enum onion_wire)onionerr == WIRE_TEMPORARY_CHANNEL_FAILURE
|
||||
&& erridx < tal_count(pf->path_scidds))
|
||||
{
|
||||
chan_extra_cannot_send(pf,pay_plugin->chan_extra_map,
|
||||
chan_extra_cannot_send(pay_plugin->chan_extra_map,
|
||||
&pf->path_scidds[erridx],
|
||||
pf->amounts[erridx]);
|
||||
// TODO: notify the plugin of the changes to the uncertainty
|
||||
// network
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,9 +193,18 @@ void uncertainty_network_flow_success(
|
||||
for (size_t i = 0; i < tal_count(pf->path_scidds); i++)
|
||||
{
|
||||
chan_extra_sent_success(
|
||||
pf, chan_extra_map,
|
||||
chan_extra_map,
|
||||
&pf->path_scidds[i],
|
||||
pf->amounts[i]);
|
||||
// TODO notify the payflow
|
||||
// payflow_note(pf, LOG_DBG,
|
||||
// "Success of %s for %s capacity [%s,%s] -> [%s,%s]",
|
||||
// fmt_amount_msat(tmpctx, x),
|
||||
// type_to_string(tmpctx,struct short_channel_id_dir,scidd),
|
||||
// fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_min),
|
||||
// fmt_amount_msat(tmpctx, ce->half[scidd->dir].known_max),
|
||||
// fmt_amount_msat(tmpctx, new_a),
|
||||
// fmt_amount_msat(tmpctx, new_b));
|
||||
}
|
||||
}
|
||||
/* All parts up to erridx succeeded, so we know something about min
|
||||
|
Loading…
Reference in New Issue
Block a user