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

Function failure_is_blockheight_disagreement

plugins/libplugin-pay.c:1245–1270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243}
1244
1245static bool
1246failure_is_blockheight_disagreement(const struct payment *p,
1247 u32 *blockheight)
1248{
1249 struct amount_msat unused;
1250
1251 assert(p && p->result);
1252
1253 if (p->result->failcode == 17 /* Former final_expiry_too_soon */)
1254 *blockheight = p->start_block + 1;
1255 else if (!fromwire_incorrect_or_unknown_payment_details(
1256 p->result->raw_message,
1257 &unused, blockheight))
1258 /* If it's incorrect_or_unknown_payment_details, that tells us
1259 * what height they're at */
1260 return false;
1261
1262 /* If we are already at the desired blockheight there is no point in
1263 * waiting, and it is likely just some other error. Notice that
1264 * start_block gets set by the initial getinfo call for each
1265 * attempt.*/
1266 if (*blockheight <= p->start_block)
1267 return false;
1268
1269 return true;
1270}
1271
1272static char *describe_failcode(const tal_t *ctx, enum onion_wire failcode)
1273{

Callers 1

handle_final_failureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected