- htlc.state = HTLCState::Committed;
- to_forward_infos.push(htlc.pending_forward_state.take().unwrap());
+ match htlc.pending_forward_state.take().unwrap() {
+ PendingHTLCStatus::Fail(fail_msg) => {
+ htlc.state = HTLCState::LocalRemoved;
+ require_commitment = true;
+ match fail_msg {
+ HTLCFailureMsg::Relay(msg) => update_fail_htlcs.push(msg),
+ HTLCFailureMsg::Malformed(msg) => update_fail_malformed_htlcs.push(msg),
+ }
+ },
+ PendingHTLCStatus::Forward(forward_info) => {
+ to_forward_infos.push(forward_info);
+ htlc.state = HTLCState::Committed;
+ }
+ }