| 2658 | } |
| 2659 | |
| 2660 | void wallet_channel_save(struct wallet *w, struct channel *chan) |
| 2661 | { |
| 2662 | struct db_stmt *stmt; |
| 2663 | u8 *last_sent_commit; |
| 2664 | const struct peer_update *peer_update; |
| 2665 | assert(chan->first_blocknum); |
| 2666 | |
| 2667 | wallet_channel_config_save(w, &chan->our_config); |
| 2668 | |
| 2669 | stmt = db_prepare_v2(w->db, SQL("UPDATE channels SET" |
| 2670 | " shachain_remote_id=?," |
| 2671 | " scid=?," |
| 2672 | " old_scids=?," |
| 2673 | " full_channel_id=?," |
| 2674 | " state=?," |
| 2675 | " funder=?," |
| 2676 | " channel_flags=?," |
| 2677 | " minimum_depth=?," |
| 2678 | " next_index_local=?," |
| 2679 | " next_index_remote=?," |
| 2680 | " next_htlc_id=?," |
| 2681 | " funding_tx_id=?," |
| 2682 | " funding_tx_outnum=?," |
| 2683 | " funding_satoshi=?," |
| 2684 | " our_funding_satoshi=?," |
| 2685 | " funding_locked_remote=?," |
| 2686 | " push_msatoshi=?," |
| 2687 | " msatoshi_local=?," |
| 2688 | " shutdown_scriptpubkey_remote=?," |
| 2689 | " shutdown_keyidx_local=?," |
| 2690 | " channel_config_local=?," |
| 2691 | " last_tx=?, last_sig=?," |
| 2692 | " last_was_revoke=?," |
| 2693 | " min_possible_feerate=?," |
| 2694 | " max_possible_feerate=?," |
| 2695 | " msatoshi_to_us_min=?," |
| 2696 | " msatoshi_to_us_max=?," |
| 2697 | " feerate_base=?," |
| 2698 | " feerate_ppm=?," |
| 2699 | " remote_upfront_shutdown_script=?," |
| 2700 | " local_static_remotekey_start=?," |
| 2701 | " remote_static_remotekey_start=?," |
| 2702 | " channel_type=?," |
| 2703 | " shutdown_scriptpubkey_local=?," |
| 2704 | " closer=?," |
| 2705 | " state_change_reason=?," |
| 2706 | " shutdown_wrong_txid=?," |
| 2707 | " shutdown_wrong_outnum=?," |
| 2708 | " lease_expiry=?," |
| 2709 | " lease_commit_sig=?," |
| 2710 | " lease_chan_max_msat=?," |
| 2711 | " lease_chan_max_ppt=?," |
| 2712 | " htlc_minimum_msat=?," |
| 2713 | " htlc_maximum_msat=?," |
| 2714 | " alias_local=?," |
| 2715 | " alias_remote=?," |
| 2716 | " ignore_fee_limits=?," |
| 2717 | " remote_feerate_base=?," |