| 76 | } |
| 77 | |
| 78 | static bool htlc_out_update_state(struct channel *channel, |
| 79 | struct htlc_out *hout, |
| 80 | enum htlc_state newstate) |
| 81 | { |
| 82 | if (!state_update_ok(channel, hout->hstate, newstate, hout->key.id, |
| 83 | "out")) |
| 84 | return false; |
| 85 | |
| 86 | bool we_filled = false; |
| 87 | wallet_htlc_update(channel->peer->ld->wallet, hout->dbid, newstate, |
| 88 | hout->preimage, |
| 89 | max_unsigned(channel->next_index[LOCAL], |
| 90 | channel->next_index[REMOTE]), |
| 91 | 0, hout->failonion, |
| 92 | hout->failmsg, &we_filled, |
| 93 | hout->key.id, |
| 94 | hout->key.channel, |
| 95 | LOCAL, |
| 96 | &hout->payment_hash, |
| 97 | hout->cltv_expiry, |
| 98 | hout->msat); |
| 99 | |
| 100 | hout->hstate = newstate; |
| 101 | return true; |
| 102 | } |
| 103 | |
| 104 | static void cstat_accumulate(struct channel *c, |
| 105 | struct amount_msat *val, |
no test coverage detected