* wallet_stmt2channel - Helper to populate a wallet_channel from a `db_stmt` */
| 1872 | * wallet_stmt2channel - Helper to populate a wallet_channel from a `db_stmt` |
| 1873 | */ |
| 1874 | static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stmt) |
| 1875 | { |
| 1876 | bool ok = true; |
| 1877 | struct channel_info channel_info; |
| 1878 | struct fee_states *fee_states; |
| 1879 | struct height_states *height_states; |
| 1880 | struct short_channel_id *scid, alias_local, *alias_remote, *old_scids; |
| 1881 | struct channel_id cid; |
| 1882 | struct channel *chan; |
| 1883 | u64 peer_dbid; |
| 1884 | struct peer *peer; |
| 1885 | struct wallet_shachain wshachain; |
| 1886 | struct channel_config our_config; |
| 1887 | struct bitcoin_outpoint funding; |
| 1888 | struct bitcoin_outpoint *shutdown_wrong_funding; |
| 1889 | struct bitcoin_signature *last_sig; |
| 1890 | struct bitcoin_tx *last_tx; |
| 1891 | u8 *remote_shutdown_scriptpubkey; |
| 1892 | u8 *local_shutdown_scriptpubkey; |
| 1893 | struct changed_htlc *last_sent_commit; |
| 1894 | s64 final_key_idx, channel_config_id; |
| 1895 | struct basepoints local_basepoints; |
| 1896 | struct pubkey local_funding_pubkey; |
| 1897 | bool has_future_per_commitment_point; |
| 1898 | struct amount_sat funding_sat, our_funding_sat; |
| 1899 | struct amount_msat push_msat, our_msat, msat_to_us_min, msat_to_us_max, htlc_minimum_msat, htlc_maximum_msat; |
| 1900 | struct channel_type *type; |
| 1901 | secp256k1_ecdsa_signature *lease_commit_sig; |
| 1902 | u32 lease_chan_max_msat; |
| 1903 | u16 lease_chan_max_ppt; |
| 1904 | bool ignore_fee_limits; |
| 1905 | struct peer_update *remote_update; |
| 1906 | struct channel_stats stats; |
| 1907 | struct channel_state_change **state_changes; |
| 1908 | struct wally_psbt *funding_psbt; |
| 1909 | |
| 1910 | peer_dbid = db_col_u64(stmt, "peer_id"); |
| 1911 | peer = find_peer_by_dbid(w->ld, peer_dbid); |
| 1912 | if (!peer) { |
| 1913 | peer = wallet_peer_load(w, peer_dbid); |
| 1914 | if (!peer) { |
| 1915 | return NULL; |
| 1916 | } |
| 1917 | } |
| 1918 | |
| 1919 | scid = db_col_optional_scid(tmpctx, stmt, "scid"); |
| 1920 | old_scids = db_col_short_channel_id_arr(tmpctx, stmt, "old_scids"); |
| 1921 | alias_local = db_col_short_channel_id(stmt, "alias_local"); |
| 1922 | alias_remote = db_col_optional_scid(tmpctx, stmt, "alias_remote"); |
| 1923 | |
| 1924 | ok &= wallet_shachain_load(w, db_col_u64(stmt, "shachain_remote_id"), |
| 1925 | &wshachain); |
| 1926 | |
| 1927 | remote_shutdown_scriptpubkey = db_col_arr(tmpctx, stmt, |
| 1928 | "shutdown_scriptpubkey_remote", u8); |
| 1929 | local_shutdown_scriptpubkey = db_col_arr(tmpctx, stmt, |
| 1930 | "shutdown_scriptpubkey_local", u8); |
| 1931 |
no test coverage detected