(decision: HtlcDecision)
| 201 | } |
| 202 | |
| 203 | fn 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 | |
| 225 | fn json_continue() -> serde_json::Value { |
| 226 | serde_json::json!({"result": "continue"}) |
no test coverage detected