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

Function convert_failcode

lightningd/peer_htlcs.c:824–850  ·  view source on GitHub ↗

We only handle the simplest cases here */

Source from the content-addressed store, hash-verified

822
823/* We only handle the simplest cases here */
824static u8 *convert_failcode(const tal_t *ctx,
825 struct lightningd *ld,
826 unsigned int failure_code)
827{
828 switch (failure_code) {
829 case WIRE_INVALID_REALM:
830 return towire_invalid_realm(ctx);
831 case WIRE_TEMPORARY_NODE_FAILURE:
832 return towire_temporary_node_failure(ctx);
833 case WIRE_PERMANENT_NODE_FAILURE:
834 return towire_permanent_node_failure(ctx);
835 case WIRE_REQUIRED_NODE_FEATURE_MISSING:
836 return towire_required_node_feature_missing(ctx);
837 case WIRE_PERMANENT_CHANNEL_FAILURE:
838 return towire_permanent_channel_failure(ctx);
839 case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:
840 return towire_required_channel_feature_missing(ctx);
841 case WIRE_UNKNOWN_NEXT_PEER:
842 return towire_unknown_next_peer(ctx);
843 default:
844 log_broken(ld->log,
845 "htlc_accepted_hook plugin returned failure_code %u,"
846 " turning to WIRE_TEMPORARY_NODE_FAILURE",
847 failure_code);
848 return towire_temporary_node_failure(ctx);
849 }
850}
851
852static void
853htlc_accepted_hook_try_resolve(struct htlc_accepted_hook_payload *request,

Callers 1

Tested by

no test coverage detected