diff --git a/channeld/commit_tx.c b/channeld/commit_tx.c index 9cd6d4592..83ea6b5a7 100644 --- a/channeld/commit_tx.c +++ b/channeld/commit_tx.c @@ -12,7 +12,7 @@ #endif static bool trim(const struct htlc *htlc, - u64 feerate_per_kw, u64 dust_limit_satoshis, + u32 feerate_per_kw, u64 dust_limit_satoshis, enum side side) { u64 htlc_fee; @@ -42,7 +42,7 @@ static bool trim(const struct htlc *htlc, } size_t commit_tx_num_untrimmed(const struct htlc **htlcs, - u64 feerate_per_kw, u64 dust_limit_satoshis, + u32 feerate_per_kw, u64 dust_limit_satoshis, enum side side) { size_t i, n; @@ -92,7 +92,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx, enum side funder, u16 to_self_delay, const struct keyset *keyset, - u64 feerate_per_kw, + u32 feerate_per_kw, u64 dust_limit_satoshis, u64 self_pay_msat, u64 other_pay_msat, diff --git a/channeld/commit_tx.h b/channeld/commit_tx.h index 24ac406cc..9b8fcbac6 100644 --- a/channeld/commit_tx.h +++ b/channeld/commit_tx.h @@ -20,7 +20,7 @@ struct sha256_double; * received HTLCs. */ size_t commit_tx_num_untrimmed(const struct htlc **htlcs, - u64 feerate_per_kw, u64 dust_limit_satoshis, + u32 feerate_per_kw, u64 dust_limit_satoshis, enum side side); /** @@ -49,7 +49,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx, enum side funder, u16 to_self_delay, const struct keyset *keyset, - u64 feerate_per_kw, + u32 feerate_per_kw, u64 dust_limit_satoshis, u64 self_pay_msat, u64 other_pay_msat, diff --git a/channeld/full_channel.c b/channeld/full_channel.c index 99f112dfa..7ba502175 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -398,7 +398,7 @@ static enum channel_add_err add_htlc(struct channel *channel, * `feerate_per_kw` while maintaining its channel reserve. */ if (channel->funder == htlc_owner(htlc)) { - u64 feerate = view->feerate_per_kw; + u32 feerate = view->feerate_per_kw; u64 dust = dust_limit_satoshis(channel, recipient); size_t untrimmed; diff --git a/channeld/full_channel.h b/channeld/full_channel.h index 60b938373..9317fa28a 100644 --- a/channeld/full_channel.h +++ b/channeld/full_channel.h @@ -74,8 +74,8 @@ struct bitcoin_tx **channel_txs(const tal_t *ctx, * This is the fee rate we actually care about, if we're going to check * whether it's actually too low. */ -uint32_t actual_feerate(const struct channel *channel, - const struct signature *theirsig); +u32 actual_feerate(const struct channel *channel, + const struct signature *theirsig); enum channel_add_err { /* All OK! */ @@ -175,14 +175,14 @@ enum channel_remove_err channel_fulfill_htlc(struct channel *channel, * * This is not exact! To check if their offer is valid, use can_afford_feerate. */ -u64 approx_max_feerate(const struct channel *channel); +u32 approx_max_feerate(const struct channel *channel); /** * can_afford_feerate: could the initiator pay for the fee at fee_rate? * @channel: The channel state * @feerate_per_kw: the new fee rate proposed */ -bool can_afford_feerate(const struct channel *channel, u64 feerate_per_kw); +bool can_afford_feerate(const struct channel *channel, u32 feerate_per_kw); /** * adjust_fee: Change fee rate. @@ -190,7 +190,7 @@ bool can_afford_feerate(const struct channel *channel, u64 feerate_per_kw); * @feerate_per_kw: fee in satoshi per 1000 bytes. * @side: which side to adjust. */ -void adjust_fee(struct channel *channel, u64 feerate_per_kw, enum side side); +void adjust_fee(struct channel *channel, u32 feerate_per_kw, enum side side); /** * channel_sending_commit: commit all remote outstanding changes. diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index 74fcaa21d..47f661a3d 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -77,7 +77,7 @@ static struct bitcoin_tx *tx_from_hex(const tal_t *ctx, const char *hex) * ... * local_feerate_per_kw: 9651936 */ -static u64 feerates[] = { +static u32 feerates[] = { 647, 648, 2069, 2070, 2194, 2195, @@ -304,7 +304,8 @@ int main(void) struct sha256_double funding_txid; /* We test from both sides. */ struct channel *lchannel, *rchannel; - u64 funding_amount_satoshi, feerate_per_kw; + u64 funding_amount_satoshi; + u32 feerate_per_kw; unsigned int funding_output_index; struct keyset keyset; struct pubkey local_funding_pubkey, remote_funding_pubkey; diff --git a/common/htlc_tx.c b/common/htlc_tx.c index 666cd4f28..220883430 100644 --- a/common/htlc_tx.c +++ b/common/htlc_tx.c @@ -76,7 +76,7 @@ struct bitcoin_tx *htlc_success_tx(const tal_t *ctx, unsigned int commit_output_number, u64 htlc_msatoshi, u16 to_self_delay, - u64 feerate_per_kw, + u32 feerate_per_kw, const struct keyset *keyset) { /* BOLT #3: @@ -122,7 +122,7 @@ struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx, u64 htlc_msatoshi, u32 cltv_expiry, u16 to_self_delay, - u64 feerate_per_kw, + u32 feerate_per_kw, const struct keyset *keyset) { /* BOLT #3: diff --git a/common/htlc_tx.h b/common/htlc_tx.h index 3ea17a337..18f35c61d 100644 --- a/common/htlc_tx.h +++ b/common/htlc_tx.h @@ -8,7 +8,7 @@ struct preimage; struct pubkey; struct sha256_double; -static inline u64 htlc_timeout_fee(u64 feerate_per_kw) +static inline u64 htlc_timeout_fee(u32 feerate_per_kw) { /* BOLT #3: * @@ -17,10 +17,10 @@ static inline u64 htlc_timeout_fee(u64 feerate_per_kw) * 1. Multiply `feerate_per_kw` by 663 and divide by 1000 (rounding * down). */ - return feerate_per_kw * 663 / 1000; + return feerate_per_kw * 663ULL / 1000; } -static inline u64 htlc_success_fee(u64 feerate_per_kw) +static inline u64 htlc_success_fee(u32 feerate_per_kw) { /* BOLT #3: * @@ -29,7 +29,7 @@ static inline u64 htlc_success_fee(u64 feerate_per_kw) * 1. Multiply `feerate_per_kw` by 703 and divide by 1000 (rounding * down). */ - return feerate_per_kw * 703 / 1000; + return feerate_per_kw * 703ULL / 1000; } /* Create HTLC-success tx to spend a received HTLC commitment tx @@ -39,7 +39,7 @@ struct bitcoin_tx *htlc_success_tx(const tal_t *ctx, unsigned int commit_output_number, u64 htlc_msatoshi, u16 to_self_delay, - u64 feerate_per_kw, + u32 feerate_per_kw, const struct keyset *keyset); /* Fill in the witness for HTLC-success tx produced above. */ @@ -60,7 +60,7 @@ struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx, u64 htlc_msatoshi, u32 cltv_expiry, u16 to_self_delay, - u64 feerate_per_kw, + u32 feerate_per_kw, const struct keyset *keyset); /* Fill in the witness for HTLC-timeout tx produced above. */ diff --git a/common/initial_channel.c b/common/initial_channel.c index 0d0a90415..e1b77eef3 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -105,7 +105,7 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx, static char *fmt_channel_view(const tal_t *ctx, const struct channel_view *view) { - return tal_fmt(ctx, "{ feerate_per_kw=%"PRIu64"," + return tal_fmt(ctx, "{ feerate_per_kw=%"PRIu32"," " owed_local=%"PRIu64"," " owed_remote=%"PRIu64" }", view->feerate_per_kw, diff --git a/common/initial_channel.h b/common/initial_channel.h index 918815647..3e0adff0f 100644 --- a/common/initial_channel.h +++ b/common/initial_channel.h @@ -20,7 +20,7 @@ struct fulfilled_htlc; /* View from each side */ struct channel_view { /* Current feerate in satoshis per 1000 weight. */ - u64 feerate_per_kw; + u32 feerate_per_kw; /* How much is owed to each side (includes pending changes) */ u64 owed_msat[NUM_SIDES]; diff --git a/common/initial_commit_tx.c b/common/initial_commit_tx.c index d4d6ed69b..014ec7669 100644 --- a/common/initial_commit_tx.c +++ b/common/initial_commit_tx.c @@ -61,7 +61,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx, enum side funder, u16 to_self_delay, const struct keyset *keyset, - u64 feerate_per_kw, + u32 feerate_per_kw, u64 dust_limit_satoshis, u64 self_pay_msat, u64 other_pay_msat, diff --git a/common/initial_commit_tx.h b/common/initial_commit_tx.h index 8dde24ea3..4744ac20d 100644 --- a/common/initial_commit_tx.h +++ b/common/initial_commit_tx.h @@ -19,7 +19,7 @@ u64 commit_number_obscurer(const struct pubkey *opener_payment_basepoint, const struct pubkey *accepter_payment_basepoint); /* Helper to calculate the base fee if we have this many htlc outputs */ -static inline u64 commit_tx_base_fee(u64 feerate_per_kw, +static inline u64 commit_tx_base_fee(u32 feerate_per_kw, size_t num_untrimmed_htlcs) { u64 weight; @@ -73,7 +73,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx, enum side funder, u16 to_self_delay, const struct keyset *keyset, - u64 feerate_per_kw, + u32 feerate_per_kw, u64 dust_limit_satoshis, u64 self_pay_msat, u64 other_pay_msat, diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index cf1fe54d3..f33735bfa 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -264,10 +264,10 @@ struct estimatefee { const u32 *blocks; const char **estmode; - void (*cb)(struct bitcoind *bitcoind, const u64 satoshi_per_kw[], + void (*cb)(struct bitcoind *bitcoind, const u32 satoshi_per_kw[], void *); void *arg; - u64 *satoshi_per_kw; + u32 *satoshi_per_kw; }; static void do_one_estimatefee(struct bitcoind *bitcoind, @@ -312,7 +312,7 @@ void bitcoind_estimate_fees_(struct bitcoind *bitcoind, const u32 blocks[], const char *estmode[], size_t num_estimates, void (*cb)(struct bitcoind *bitcoind, - const u64 satoshi_per_kw[], void *), + const u32 satoshi_per_kw[], void *), void *arg) { struct estimatefee *efee = tal(bitcoind, struct estimatefee); @@ -323,7 +323,7 @@ void bitcoind_estimate_fees_(struct bitcoind *bitcoind, 0); efee->cb = cb; efee->arg = arg; - efee->satoshi_per_kw = tal_arr(efee, u64, num_estimates); + efee->satoshi_per_kw = tal_arr(efee, u32, num_estimates); do_one_estimatefee(bitcoind, efee); } diff --git a/lightningd/bitcoind.h b/lightningd/bitcoind.h index ceec233ff..553488152 100644 --- a/lightningd/bitcoind.h +++ b/lightningd/bitcoind.h @@ -59,7 +59,7 @@ void bitcoind_estimate_fees_(struct bitcoind *bitcoind, const u32 blocks[], const char *estmode[], size_t num_estimates, void (*cb)(struct bitcoind *bitcoind, - const u64 satoshi_per_kw[], void *), + const u32 satoshi_per_kw[], void *), void *arg); #define bitcoind_estimate_fees(bitcoind_, blocks, estmode, num, cb, arg) \ @@ -67,7 +67,7 @@ void bitcoind_estimate_fees_(struct bitcoind *bitcoind, typesafe_cb_preargs(void, void *, \ (cb), (arg), \ struct bitcoind *, \ - const u64 *), \ + const u32 *), \ (arg)) void bitcoind_sendrawtx_(struct bitcoind *bitcoind, diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 0d21fed48..d9d27f239 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -300,11 +300,11 @@ static const char *feerate_name(enum feerate feerate) /* We sanitize feerates if necessary to put them in descending order. */ static void update_feerates(struct bitcoind *bitcoind, - const u64 *satoshi_per_kw, + const u32 *satoshi_per_kw, struct chain_topology *topo) { for (size_t i = 0; i < NUM_FEERATES; i++) { - log_debug(topo->log, "%s feerate %"PRIu64" (was %"PRIu64")", + log_debug(topo->log, "%s feerate %u (was %u)", feerate_name(i), satoshi_per_kw[i], topo->feerate[i]); topo->feerate[i] = satoshi_per_kw[i]; @@ -314,8 +314,7 @@ static void update_feerates(struct bitcoind *bitcoind, for (size_t j = 0; j < i; j++) { if (topo->feerate[j] < topo->feerate[i]) { log_unusual(topo->log, - "Feerate %s (%"PRIu64") above" - " %s (%"PRIu64")", + "Feerate %s (%u) above %s (%u)", feerate_name(i), topo->feerate[i], feerate_name(j), topo->feerate[j]); topo->feerate[j] = topo->feerate[i]; @@ -486,10 +485,10 @@ u32 get_block_height(const struct chain_topology *topo) } /* We may only have estimate for 2 blocks, for example. Extrapolate. */ -static u64 guess_feerate(const struct chain_topology *topo, enum feerate feerate) +static u32 guess_feerate(const struct chain_topology *topo, enum feerate feerate) { size_t i = 0; - u64 rate = 0; + u32 rate = 0; /* We assume each one is half the previous. */ for (i = 0; i < feerate; i++) { @@ -513,7 +512,7 @@ static u64 guess_feerate(const struct chain_topology *topo, enum feerate feerate return rate; } -u64 get_feerate(const struct chain_topology *topo, enum feerate feerate) +u32 get_feerate(const struct chain_topology *topo, enum feerate feerate) { if (topo->override_fee_rate) { log_debug(topo->log, "Forcing fee rate, ignoring estimate"); diff --git a/lightningd/chaintopology.h b/lightningd/chaintopology.h index 870a51fac..9ae34f88d 100644 --- a/lightningd/chaintopology.h +++ b/lightningd/chaintopology.h @@ -89,7 +89,7 @@ struct chain_topology { struct block *root; struct block *tip; struct block_map block_map; - u64 feerate[NUM_FEERATES]; + u32 feerate[NUM_FEERATES]; bool startup; /* Where to log things. */ @@ -111,10 +111,10 @@ struct chain_topology { struct list_head outgoing_txs; /* Force a partiular fee rate regardless of estimatefee (satoshis/kb) */ - u64 *override_fee_rate; + u32 *override_fee_rate; /* What fee we use if estimatefee fails (satoshis/kb) */ - u64 default_fee_rate; + u32 default_fee_rate; /* Transactions/txos we are watching. */ struct txwatch_hash txwatches; @@ -146,7 +146,7 @@ size_t get_tx_depth(const struct chain_topology *topo, u32 get_block_height(const struct chain_topology *topo); /* Get fee rate in satoshi per kiloweight. */ -u64 get_feerate(const struct chain_topology *topo, enum feerate feerate); +u32 get_feerate(const struct chain_topology *topo, enum feerate feerate); /* Broadcast a single tx, and rebroadcast as reqd (copies tx). * If failed is non-NULL, call that and don't rebroadcast. */ diff --git a/lightningd/options.c b/lightningd/options.c index 693c9899f..0d46c23a7 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -54,22 +54,6 @@ static void tal_freefn(void *ptr) #define TIME_FROM_MSEC(msec) \ { { .tv_nsec = ((msec) % 1000) * 1000000, .tv_sec = (msec) / 1000 } } -static char *opt_set_u64(const char *arg, u64 *u) -{ - char *endp; - unsigned long long l; - - /* This is how the manpage says to do it. Yech. */ - errno = 0; - l = strtoull(arg, &endp, 0); - if (*endp || !arg[0]) - return tal_fmt(NULL, "'%s' is not a number", arg); - *u = l; - if (errno || *u != l) - return tal_fmt(NULL, "'%s' is out of range", arg); - return NULL; -} - static char *opt_set_u32(const char *arg, u32 *u) { char *endp; @@ -130,11 +114,6 @@ static char *opt_add_ipaddr(const char *arg, struct lightningd *ld) return tal_fmt(NULL, "Unable to parse IP address '%s'", arg); } -static void opt_show_u64(char buf[OPT_SHOW_LEN], const u64 *u) -{ - snprintf(buf, OPT_SHOW_LEN, "%"PRIu64, *u); -} - static void opt_show_u32(char buf[OPT_SHOW_LEN], const u32 *u) { snprintf(buf, OPT_SHOW_LEN, "%"PRIu32, *u); @@ -197,7 +176,7 @@ static char *opt_set_alias(const char *arg, struct lightningd *ld) static char *opt_set_fee_rates(const char *arg, struct chain_topology *topo) { tal_free(topo->override_fee_rate); - topo->override_fee_rate = tal_arr(topo, u64, 3); + topo->override_fee_rate = tal_arr(topo, u32, 3); for (size_t i = 0; i < tal_count(topo->override_fee_rate); i++) { char *endp; @@ -249,7 +228,7 @@ static void config_register_opts(struct lightningd *ld) opt_register_arg("--override-fee-rates", opt_set_fee_rates, NULL, ld->topology, "Force a specific rates (immediate/normal/slow) in satoshis per kb regardless of estimated fees"); - opt_register_arg("--default-fee-rate", opt_set_u64, opt_show_u64, + opt_register_arg("--default-fee-rate", opt_set_u32, opt_show_u32, &ld->topology->default_fee_rate, "Satoshis per kb if can't estimate fees"); opt_register_arg("--cltv-delta", opt_set_u32, opt_show_u32, diff --git a/lightningd/test/run-commit_tx.c b/lightningd/test/run-commit_tx.c index 5a7184ccd..45fa5e2eb 100644 --- a/lightningd/test/run-commit_tx.c +++ b/lightningd/test/run-commit_tx.c @@ -204,7 +204,7 @@ static void report_htlcs(const struct bitcoin_tx *tx, const struct pubkey *remotekey, const struct pubkey *remote_htlckey, const struct pubkey *remote_revocation_key, - u64 feerate_per_kw) + u32 feerate_per_kw) { tal_t *tmpctx = tal_tmpctx(NULL); size_t i, n; @@ -336,7 +336,7 @@ static void report(struct bitcoin_tx *tx, const struct pubkey *remotekey, const struct pubkey *remote_htlckey, const struct pubkey *remote_revocation_key, - u64 feerate_per_kw, + u32 feerate_per_kw, const struct htlc **htlc_map) { tal_t *tmpctx = tal_tmpctx(NULL); @@ -387,12 +387,12 @@ static u64 calc_fee(const struct bitcoin_tx *tx, u64 input_satoshi) } /* For debugging, we do brute-force increase to find thresholds */ -static u64 increase(u64 feerate_per_kw) +static u32 increase(u32 feerate_per_kw) { return feerate_per_kw + 1; } #else -static u64 increase(u64 feerate_per_kw) +static u64 increase(u32 feerate_per_kw) { /* BOLT #3: * @@ -444,7 +444,8 @@ int main(void) { tal_t *tmpctx = tal_tmpctx(NULL); struct sha256_double funding_txid; - u64 funding_amount_satoshi, dust_limit_satoshi, feerate_per_kw; + u64 funding_amount_satoshi, dust_limit_satoshi; + u32 feerate_per_kw; u16 to_self_delay; /* x_ prefix means internal vars we used to derive spec */ struct privkey local_funding_privkey, x_remote_funding_privkey; @@ -713,7 +714,7 @@ int main(void) "name: simple commitment tx with no HTLCs\n" "to_local_msat: %"PRIu64"\n" "to_remote_msat: %"PRIu64"\n" - "local_feerate_per_kw: %"PRIu64"\n", + "local_feerate_per_kw: %u\n", to_local_msat, to_remote_msat, feerate_per_kw); keyset.self_revocation_key = remote_revocation_key; @@ -774,7 +775,7 @@ int main(void) "name: commitment tx with all 5 htlcs untrimmed (minimum feerate)\n" "to_local_msat: %"PRIu64"\n" "to_remote_msat: %"PRIu64"\n" - "local_feerate_per_kw: %"PRIu64"\n", + "local_feerate_per_kw: %u\n", to_local_msat, to_remote_msat, feerate_per_kw); print_superverbose = true; @@ -846,7 +847,7 @@ int main(void) tx_must_be_eq(newtx, tx2); #ifdef DEBUG if (feerate_per_kw % 100000 == 0) - printf("feerate_per_kw = %"PRIu64", fees = %"PRIu64"\n", + printf("feerate_per_kw = %u, fees = %"PRIu64"\n", feerate_per_kw, calc_fee(newtx, funding_amount_satoshi)); if (tal_count(newtx->output) == tal_count(tx->output)) { tal_free(newtx); @@ -857,7 +858,7 @@ int main(void) "name: commitment tx with %zu output%s untrimmed (maximum feerate)\n" "to_local_msat: %"PRIu64"\n" "to_remote_msat: %"PRIu64"\n" - "local_feerate_per_kw: %"PRIu64"\n", + "local_feerate_per_kw: %u\n", tal_count(tx->output), tal_count(tx->output) > 1 ? "s" : "", to_local_msat, to_remote_msat, feerate_per_kw-1); @@ -893,7 +894,7 @@ int main(void) "name: commitment tx with %zu output%s untrimmed (minimum feerate)\n" "to_local_msat: %"PRIu64"\n" "to_remote_msat: %"PRIu64"\n" - "local_feerate_per_kw: %"PRIu64"\n", + "local_feerate_per_kw: %u\n", tal_count(newtx->output), tal_count(newtx->output) > 1 ? "s" : "", to_local_msat, to_remote_msat, feerate_per_kw); @@ -955,7 +956,7 @@ int main(void) "name: commitment tx with fee greater than funder amount\n" "to_local_msat: %"PRIu64"\n" "to_remote_msat: %"PRIu64"\n" - "local_feerate_per_kw: %"PRIu64"\n", + "local_feerate_per_kw: %u\n", to_local_msat, to_remote_msat, feerate_per_kw); tx = commit_tx(tmpctx, &funding_txid, funding_output_index, funding_amount_satoshi, diff --git a/onchaind/onchain.c b/onchaind/onchain.c index 3c0424d63..01062b1eb 100644 --- a/onchaind/onchain.c +++ b/onchaind/onchain.c @@ -31,7 +31,7 @@ static const struct keyset *keyset; /* The feerate to use when we generate transactions. */ -static u64 feerate_per_kw; +static u32 feerate_per_kw; /* The dust limit to use when we generate transactions. */ static u64 dust_limit_satoshis; diff --git a/onchaind/onchain_wire.csv b/onchaind/onchain_wire.csv index 2c7912b17..38383f7ee 100644 --- a/onchaind/onchain_wire.csv +++ b/onchaind/onchain_wire.csv @@ -10,7 +10,7 @@ onchain_init,,old_remote_per_commitment_point,struct pubkey onchain_init,,remote_per_commitment_point,struct pubkey onchain_init,,local_to_self_delay,u32 onchain_init,,remote_to_self_delay,u32 -onchain_init,,feerate_per_kw,u64 +onchain_init,,feerate_per_kw,u32 onchain_init,,local_dust_limit_satoshi,u64 onchain_init,,remote_revocation_basepoint,struct pubkey # Gives an easy way to tell if it's our unilateral close or theirs... diff --git a/wallet/wallet.c b/wallet/wallet.c index 77d340961..4d38d61af 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -438,7 +438,7 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt, ok &= sqlite3_column_pubkey(stmt, col++, &channel_info->theirbase.delayed_payment); ok &= sqlite3_column_pubkey(stmt, col++, &channel_info->remote_per_commit); ok &= sqlite3_column_pubkey(stmt, col++, &channel_info->old_remote_per_commit); - channel_info->feerate_per_kw = sqlite3_column_int64(stmt, col++); + channel_info->feerate_per_kw = sqlite3_column_int(stmt, col++); wallet_channel_config_load(w, remote_config_id, &chan->peer->channel_info->their_config); } else { /* No channel_info, skip positions in the result */