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

Function decision_to_response

plugins/lsps-plugin/src/service.rs:203–223  ·  view source on GitHub ↗
(decision: HtlcDecision)

Source from the content-addressed store, hash-verified

201}
202
203fn decision_to_response(decision: HtlcDecision) -> Result<serde_json::Value, anyhow::Error> {
204 Ok(match decision {
205 HtlcDecision::NotOurs => json_continue(),
206
207 HtlcDecision::Forward {
208 mut payload,
209 forward_to,
210 mut extra_tlvs,
211 } => json_continue_forward(
212 payload.to_bytes()?,
213 forward_to.as_byte_array().to_vec(),
214 extra_tlvs.to_bytes()?,
215 ),
216
217 // Fixme: once we implement MPP-Support we need to remove this.
218 HtlcDecision::Reject {
219 reason: RejectReason::MppNotSupported,
220 } => json_continue(),
221 HtlcDecision::Reject { reason } => json_fail(reason.failure_code()),
222 })
223}
224
225fn json_continue() -> serde_json::Value {
226 serde_json::json!({"result": "continue"})

Callers 1

handle_htlc_innerFunction · 0.85

Calls 6

json_continueFunction · 0.85
json_continue_forwardFunction · 0.85
json_failFunction · 0.85
to_vecMethod · 0.80
failure_codeMethod · 0.80
to_bytesMethod · 0.45

Tested by

no test coverage detected