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

Function failure_is_blockheight_disagreement

plugins/libplugin-pay.c:1092–1117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1090}
1091
1092static bool
1093failure_is_blockheight_disagreement(const struct payment *p,
1094 u32 *blockheight)
1095{
1096 struct amount_msat unused;
1097
1098 assert(p && p->result);
1099
1100 if (p->result->failcode == 17 /* Former final_expiry_too_soon */)
1101 *blockheight = p->start_block + 1;
1102 else if (!fromwire_incorrect_or_unknown_payment_details(
1103 p->result->raw_message,
1104 &unused, blockheight))
1105 /* If it's incorrect_or_unknown_payment_details, that tells us
1106 * what height they're at */
1107 return false;
1108
1109 /* If we are already at the desired blockheight there is no point in
1110 * waiting, and it is likely just some other error. Notice that
1111 * start_block gets set by the initial getinfo call for each
1112 * attempt.*/
1113 if (*blockheight <= p->start_block)
1114 return false;
1115
1116 return true;
1117}
1118
1119static char *describe_failcode(const tal_t *ctx, enum onion_wire failcode)
1120{

Callers 2

handle_final_failureFunction · 0.85
waitblockheight_cbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected