| 1846 | } |
| 1847 | |
| 1848 | void wallet_channel_save(struct wallet *w, struct channel *chan) |
| 1849 | { |
| 1850 | struct db_stmt *stmt; |
| 1851 | u8 *last_sent_commit; |
| 1852 | assert(chan->first_blocknum); |
| 1853 | |
| 1854 | wallet_channel_config_save(w, &chan->our_config); |
| 1855 | |
| 1856 | stmt = db_prepare_v2(w->db, SQL("UPDATE channels SET" |
| 1857 | " shachain_remote_id=?," // 0 |
| 1858 | " scid=?," // 1 |
| 1859 | " full_channel_id=?," // 2 |
| 1860 | " state=?," // 3 |
| 1861 | " funder=?," // 4 |
| 1862 | " channel_flags=?," // 5 |
| 1863 | " minimum_depth=?," // 6 |
| 1864 | " next_index_local=?," // 7 |
| 1865 | " next_index_remote=?," // 8 |
| 1866 | " next_htlc_id=?," // 9 |
| 1867 | " funding_tx_id=?," // 10 |
| 1868 | " funding_tx_outnum=?," // 11 |
| 1869 | " funding_satoshi=?," // 12 |
| 1870 | " our_funding_satoshi=?," // 13 |
| 1871 | " funding_locked_remote=?," // 14 |
| 1872 | " push_msatoshi=?," // 15 |
| 1873 | " msatoshi_local=?," // 16 |
| 1874 | " shutdown_scriptpubkey_remote=?," |
| 1875 | " shutdown_keyidx_local=?," // 18 |
| 1876 | " channel_config_local=?," // 19 |
| 1877 | " last_tx=?, last_sig=?," // 20 + 21 |
| 1878 | " last_was_revoke=?," // 22 |
| 1879 | " min_possible_feerate=?," // 23 |
| 1880 | " max_possible_feerate=?," // 24 |
| 1881 | " msatoshi_to_us_min=?," // 25 |
| 1882 | " msatoshi_to_us_max=?," // 26 |
| 1883 | " feerate_base=?," // 27 |
| 1884 | " feerate_ppm=?," // 28 |
| 1885 | " remote_upfront_shutdown_script=?," // 29 |
| 1886 | " local_static_remotekey_start=?," // 30 |
| 1887 | " remote_static_remotekey_start=?," // 31 |
| 1888 | " option_anchor_outputs=?," // 32 |
| 1889 | " shutdown_scriptpubkey_local=?," // 33 |
| 1890 | " closer=?," // 34 |
| 1891 | " state_change_reason=?," // 35 |
| 1892 | " shutdown_wrong_txid=?," // 36 |
| 1893 | " shutdown_wrong_outnum=?," // 37 |
| 1894 | " lease_expiry=?," // 38 |
| 1895 | " lease_commit_sig=?," // 39 |
| 1896 | " lease_chan_max_msat=?," // 40 |
| 1897 | " lease_chan_max_ppt=?," // 41 |
| 1898 | " htlc_minimum_msat=?," // 42 |
| 1899 | " htlc_maximum_msat=?," // 43 |
| 1900 | " alias_local=?," // 44 |
| 1901 | " alias_remote=?" // 45 |
| 1902 | " WHERE id=?")); // 46 |
| 1903 | db_bind_u64(stmt, 0, chan->their_shachain.id); |
| 1904 | if (chan->scid) |
| 1905 | db_bind_scid(stmt, 1, chan->scid); |