MCPcopy Create free account
hub / github.com/ElementsProject/lightning / payment_new

Function payment_new

plugins/libplugin-pay.c:78–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78struct payment *payment_new(tal_t *ctx, struct command *cmd,
79 struct payment *parent,
80 struct channel_hint_set *channel_hints,
81 struct payment_modifier **mods)
82{
83 struct payment *p = tal(ctx, struct payment);
84
85 static u64 next_id = 0;
86
87 p->children = tal_arr(p, struct payment *, 0);
88 p->parent = parent;
89 p->modifiers = mods;
90 p->cmd = cmd;
91 p->finished = false;
92 p->start_time = clock_time();
93 p->result = NULL;
94 p->why = NULL;
95 p->getroute = tal(p, struct getroute_request);
96 p->label = NULL;
97 p->failreason = NULL;
98 p->getroute->riskfactorppm = 10000000;
99 p->abort = false;
100 p->invstring_used = false;
101 p->route = NULL;
102 p->temp_exclusion = NULL;
103 p->failroute_retry = false;
104 p->routetxt = NULL;
105 p->max_htlcs = UINT32_MAX;
106 p->aborterror = NULL;
107 p->on_payment_success = NULL;
108 p->on_payment_failure = NULL;
109 p->errorcode = 0;
110
111 /* Copy over the relevant pieces of information. */
112 if (parent != NULL) {
113 assert(cmd == NULL);
114 tal_arr_expand(&parent->children, p);
115 p->route_destination = parent->route_destination;
116 p->pay_destination = parent->pay_destination;
117 p->final_amount = parent->final_amount;
118 p->our_amount = parent->our_amount;
119 p->label = parent->label;
120 p->payment_hash = parent->payment_hash;
121 p->partid = payment_root(p->parent)->next_partid++;
122 p->plugin = parent->plugin;
123
124 /* Re-establish the unmodified constraints for our sub-payment. */
125 p->constraints = *parent->start_constraints;
126 p->deadline = parent->deadline;
127
128 p->min_final_cltv_expiry = parent->min_final_cltv_expiry;
129 p->routes = parent->routes;
130 p->features = parent->features;
131 p->id = parent->id;
132 p->local_id = parent->local_id;
133 p->local_invreq_id = parent->local_invreq_id;
134 p->groupid = parent->groupid;
135 p->invstring = parent->invstring;

Callers 4

json_keysendFunction · 0.70
json_payFunction · 0.70
retry_step_cbFunction · 0.70
adaptive_splitter_cbFunction · 0.70

Calls 2

clock_timeFunction · 0.85
payment_rootFunction · 0.85

Tested by

no test coverage detected