Skip to content

Commit 10acbff

Browse files
committed
onchaind: Remove key derivation involving the signer
The signer may not be present at this time. If we want to keep the check to protect against bit flips we should move it into `onchaind` where it doesn't matter as much that the signer may be slow to respond.
1 parent d496126 commit 10acbff

File tree

5 files changed

+1
-18
lines changed

5 files changed

+1
-18
lines changed

lightningd/onchain_control.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
15041504
u8 *msg;
15051505
struct bitcoin_txid our_last_txid;
15061506
struct lightningd *ld = channel->peer->ld;
1507-
struct pubkey final_key;
15081507
int hsmfd;
15091508
enum state_change reason;
15101509

@@ -1564,8 +1563,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
15641563
return KEEP_WATCHING;
15651564
}
15661565

1567-
bip32_pubkey(ld, &final_key, channel->final_key_idx);
1568-
15691566
struct ext_key final_wallet_ext_key;
15701567
if (bip32_key_from_parent(
15711568
ld->bip32_base,
@@ -1611,8 +1608,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
16111608
channel->shutdown_scriptpubkey[LOCAL],
16121609
channel->shutdown_scriptpubkey[REMOTE],
16131610
channel->final_key_idx,
1614-
&final_wallet_ext_key,
1615-
&final_key,
16161611
channel->opener,
16171612
&channel->local_basepoints,
16181613
&channel->channel_info.theirbase,

onchaind/onchaind.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ static u32 to_self_delay[NUM_SIDES];
4848

4949
/* Where we send money to (our wallet) */
5050
static u32 our_wallet_index;
51-
static struct ext_key our_wallet_ext_key;
52-
static struct pubkey our_wallet_pubkey;
5351

5452
/* Their revocation secret (only if they cheated). */
5553
static const struct secret *remote_per_commitment_secret;
@@ -3432,8 +3430,6 @@ int main(int argc, char *argv[])
34323430
&scriptpubkey[LOCAL],
34333431
&scriptpubkey[REMOTE],
34343432
&our_wallet_index,
3435-
&our_wallet_ext_key,
3436-
&our_wallet_pubkey,
34373433
&opener,
34383434
&basepoints[LOCAL],
34393435
&basepoints[REMOTE],

onchaind/onchaind_wire.csv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ msgdata,onchaind_init,local_scriptpubkey,u8,local_scriptpubkey_len
2828
msgdata,onchaind_init,remote_scriptpubkey_len,u16,
2929
msgdata,onchaind_init,remote_scriptpubkey,u8,remote_scriptpubkey_len
3030
msgdata,onchaind_init,ourwallet_index,u32,
31-
msgdata,onchaind_init,ourwallet_ext_key,ext_key,
32-
msgdata,onchaind_init,ourwallet_pubkey,pubkey,
3331
# We need these two for commit number obscurer
3432
msgdata,onchaind_init,opener,enum side,
3533
msgdata,onchaind_init,local_basepoints,basepoints,

onchaind/test/run-grind_feerate-bug.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ void fromwire_basepoints(const u8 **ptr UNNEEDED, size_t *max UNNEEDED,
4242
/* Generated stub for fromwire_chain_coin_mvt */
4343
void fromwire_chain_coin_mvt(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct chain_coin_mvt *mvt UNNEEDED)
4444
{ fprintf(stderr, "fromwire_chain_coin_mvt called!\n"); abort(); }
45-
/* Generated stub for fromwire_ext_key */
46-
void fromwire_ext_key(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct ext_key *bip32 UNNEEDED)
47-
{ fprintf(stderr, "fromwire_ext_key called!\n"); abort(); }
4845
/* Generated stub for fromwire_hsmd_get_per_commitment_point_reply */
4946
bool fromwire_hsmd_get_per_commitment_point_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey *per_commitment_point UNNEEDED, struct secret **old_commitment_secret UNNEEDED)
5047
{ fprintf(stderr, "fromwire_hsmd_get_per_commitment_point_reply called!\n"); abort(); }
@@ -225,9 +222,6 @@ void towire_basepoints(u8 **pptr UNNEEDED, const struct basepoints *b UNNEEDED)
225222
/* Generated stub for towire_chain_coin_mvt */
226223
void towire_chain_coin_mvt(u8 **pptr UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED)
227224
{ fprintf(stderr, "towire_chain_coin_mvt called!\n"); abort(); }
228-
/* Generated stub for towire_ext_key */
229-
void towire_ext_key(u8 **pptr UNNEEDED, const struct ext_key *bip32 UNNEEDED)
230-
{ fprintf(stderr, "towire_ext_key called!\n"); abort(); }
231225
/* Generated stub for towire_hsmd_get_per_commitment_point */
232226
u8 *towire_hsmd_get_per_commitment_point(const tal_t *ctx UNNEEDED, u64 n UNNEEDED)
233227
{ fprintf(stderr, "towire_hsmd_get_per_commitment_point called!\n"); abort(); }

onchaind/test/run-grind_feerate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool fromwire_onchaind_dev_memleak(const void *p UNNEEDED)
5656
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)
5757
{ fprintf(stderr, "fromwire_onchaind_htlcs called!\n"); abort(); }
5858
/* Generated stub for fromwire_onchaind_init */
59-
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 *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, bool *option_anchors_zero_fee_htlc_tx UNNEEDED, u32 *min_relay_feerate UNNEEDED)
59+
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, 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 *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, bool *option_anchors_zero_fee_htlc_tx UNNEEDED, u32 *min_relay_feerate UNNEEDED)
6060
{ fprintf(stderr, "fromwire_onchaind_init called!\n"); abort(); }
6161
/* Generated stub for fromwire_onchaind_known_preimage */
6262
bool fromwire_onchaind_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)

0 commit comments

Comments
 (0)