onchaind: no longer need information about current feerates.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-04-06 09:03:25 +09:30
parent c1bc4d0ead
commit a3b81ba17f
4 changed files with 1 additions and 39 deletions

View File

@ -1285,7 +1285,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
struct lightningd *ld = channel->peer->ld;
struct pubkey final_key;
int hsmfd;
u32 feerates[4];
enum state_change reason;
/* use REASON_ONCHAIN or closer's reason, if known */
@ -1363,21 +1362,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
64,
&our_last_txid);
/* We try to get the feerate for each transaction type, 0 if estimation
* failed. */
feerates[0] = delayed_to_us_feerate(ld->topology);
feerates[1] = htlc_resolution_feerate(ld->topology);
feerates[2] = penalty_feerate(ld->topology);
/* We check them separately but there is a high chance that if estimation
* failed for one, it failed for all.. */
for (size_t i = 0; i < 3; i++) {
if (!feerates[i])
feerates[i] = tx_feerate(channel->last_tx);
}
/* This is 10x highest bitcoind estimate (depending on dev-max-fee-multiplier),
* so cap at 2x */
feerates[3] = feerate_max(ld, NULL) / 5;
log_debug(channel->log, "channel->static_remotekey_start[LOCAL] %"PRIu64,
channel->static_remotekey_start[LOCAL]);
@ -1396,8 +1380,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
* we specify theirs. */
channel->channel_info.their_config.to_self_delay,
channel->our_config.to_self_delay,
/* delayed_to_us, htlc, penalty, and penalty_max. */
feerates[0], feerates[1], feerates[2], feerates[3],
channel->our_config.dust_limit,
&our_last_txid,
channel->shutdown_scriptpubkey[LOCAL],

View File

@ -38,15 +38,6 @@ static const struct pubkey *remote_per_commitment_point;
/* The commitment number we're dealing with (if not mutual close) */
static u64 commit_num;
/* The feerate for the transaction spending our delayed output. */
static u32 delayed_to_us_feerate;
/* The feerate for transactions spending HTLC outputs. */
static u32 htlc_feerate;
/* The feerate for transactions spending from revoked transactions. */
static u32 penalty_feerate, max_penalty_feerate;
/* Min and max feerates we ever used */
static u32 min_possible_feerate, max_possible_feerate;
@ -3457,10 +3448,6 @@ int main(int argc, char *argv[])
&remote_per_commit_point,
&to_self_delay[LOCAL],
&to_self_delay[REMOTE],
&delayed_to_us_feerate,
&htlc_feerate,
&penalty_feerate,
&max_penalty_feerate,
&dust_limit,
&our_broadcast_txid,
&scriptpubkey[LOCAL],
@ -3488,9 +3475,6 @@ int main(int argc, char *argv[])
master_badmsg(WIRE_ONCHAIND_INIT, msg);
}
status_debug("delayed_to_us_feerate = %u, htlc_feerate = %u, "
"penalty_feerate = %u", delayed_to_us_feerate,
htlc_feerate, penalty_feerate);
/* We need to keep tx around, but there's only one: not really a leak */
tal_steal(ctx, notleak(tx));

View File

@ -20,10 +20,6 @@ msgdata,onchaind_init,old_remote_per_commitment_point,pubkey,
msgdata,onchaind_init,remote_per_commitment_point,pubkey,
msgdata,onchaind_init,local_to_self_delay,u32,
msgdata,onchaind_init,remote_to_self_delay,u32,
msgdata,onchaind_init,delayed_to_us_feerate,u32,
msgdata,onchaind_init,htlc_feerate,u32,
msgdata,onchaind_init,penalty_feerate,u32,
msgdata,onchaind_init,max_penalty_feerate,u32,
msgdata,onchaind_init,local_dust_limit_satoshi,amount_sat,
# Gives an easy way to tell if it's our unilateral close or theirs...
msgdata,onchaind_init,our_broadcast_txid,bitcoin_txid,

1 #include <bitcoin/tx_parts.h>
20 msgdata,onchaind_init,local_to_self_delay,u32,
21 msgdata,onchaind_init,remote_to_self_delay,u32,
22 msgdata,onchaind_init,delayed_to_us_feerate,u32, msgdata,onchaind_init,local_dust_limit_satoshi,amount_sat,
msgdata,onchaind_init,htlc_feerate,u32,
msgdata,onchaind_init,penalty_feerate,u32,
msgdata,onchaind_init,max_penalty_feerate,u32,
msgdata,onchaind_init,local_dust_limit_satoshi,amount_sat,
23 # Gives an easy way to tell if it's our unilateral close or theirs...
24 msgdata,onchaind_init,our_broadcast_txid,bitcoin_txid,
25 msgdata,onchaind_init,local_scriptpubkey_len,u16,

View File

@ -51,7 +51,7 @@ bool fromwire_onchaind_dev_memleak(const void *p UNNEEDED)
bool fromwire_onchaind_htlcs(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct htlc_stub **htlc UNNEEDED, bool **tell_if_missing UNNEEDED, bool **tell_immediately UNNEEDED)
{ fprintf(stderr, "fromwire_onchaind_htlcs called!\n"); abort(); }
/* Generated stub for fromwire_onchaind_init */
bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, u32 *max_penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, u32 *ourwallet_index UNNEEDED, struct ext_key *ourwallet_ext_key UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, u64 *local_static_remotekey_start UNNEEDED, u64 *remote_static_remotekey_start UNNEEDED, bool *option_anchor_outputs UNNEEDED, u32 *min_relay_feerate UNNEEDED)
bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, u32 *ourwallet_index UNNEEDED, struct ext_key *ourwallet_ext_key UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, u64 *local_static_remotekey_start UNNEEDED, u64 *remote_static_remotekey_start UNNEEDED, bool *option_anchor_outputs UNNEEDED, u32 *min_relay_feerate UNNEEDED)
{ fprintf(stderr, "fromwire_onchaind_init called!\n"); abort(); }
/* Generated stub for fromwire_onchaind_known_preimage */
bool fromwire_onchaind_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)