| 2145 | } |
| 2146 | |
| 2147 | static bool peer_save_commitsig_received(struct channel *channel, u64 commitnum, |
| 2148 | struct bitcoin_tx *tx, |
| 2149 | const struct bitcoin_signature *commit_sig) |
| 2150 | { |
| 2151 | if (commitnum != channel->next_index[LOCAL]) { |
| 2152 | channel_internal_error(channel, |
| 2153 | "channel_got_commitsig: expected commitnum %"PRIu64 |
| 2154 | " got %"PRIu64, |
| 2155 | channel->next_index[LOCAL], commitnum); |
| 2156 | return false; |
| 2157 | } |
| 2158 | |
| 2159 | /* Basic sanity check */ |
| 2160 | if (!valid_commitment_tx(channel, tx)) |
| 2161 | return false; |
| 2162 | |
| 2163 | channel->next_index[LOCAL]++; |
| 2164 | |
| 2165 | /* DTODO: Add inflight_commit_sigs to the DB */ |
| 2166 | |
| 2167 | /* Update channel->last_sig and channel->last_tx before saving to db */ |
| 2168 | channel_set_last_tx(channel, tx, commit_sig); |
| 2169 | |
| 2170 | return true; |
| 2171 | } |
| 2172 | |
| 2173 | static bool peer_save_commitsig_sent(struct channel *channel, u64 commitnum) |
| 2174 | { |
no test coverage detected