subdaemons: pass back and forth the htlc points.

Openingd sets it to the same as the payment point for the remote side.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-11-15 16:51:39 +10:30 committed by Christian Decker
parent 654c2f4eb8
commit fc05779f78
7 changed files with 16 additions and 10 deletions

View File

@ -2023,6 +2023,7 @@ static void init_channel(struct peer *peer)
&funding_pubkey[REMOTE],
&points[REMOTE].revocation,
&points[REMOTE].payment,
&points[REMOTE].htlc,
&points[REMOTE].delayed_payment,
&peer->remote_per_commit,
&peer->old_remote_per_commit,
@ -2057,8 +2058,6 @@ static void init_channel(struct peer *peer)
&funding_signed))
master_badmsg(WIRE_CHANNEL_INIT, msg);
points[REMOTE].htlc = points[REMOTE].payment;
status_trace("init %s: remote_per_commit = %s, old_remote_per_commit = %s"
" next_idx_local = %"PRIu64
" next_idx_remote = %"PRIu64

View File

@ -16,9 +16,10 @@ channel_init,,feerate_per_kw,u32
channel_init,,first_commit_sig,secp256k1_ecdsa_signature
channel_init,,crypto_state,struct crypto_state
channel_init,,remote_fundingkey,struct pubkey
channel_init,,revocation_basepoint,struct pubkey
channel_init,,payment_basepoint,struct pubkey
channel_init,,delayed_payment_basepoint,struct pubkey
channel_init,,remote_revocation_basepoint,struct pubkey
channel_init,,remote_payment_basepoint,struct pubkey
channel_init,,remote_htlc_basepoint,struct pubkey
channel_init,,remote_delayed_payment_basepoint,struct pubkey
channel_init,,remote_per_commit,struct pubkey
channel_init,,old_remote_per_commit,struct pubkey
channel_init,,funder,enum side

1 # Received and sent funding_locked
16 channel_init,,remote_fundingkey,struct pubkey
17 channel_init,,revocation_basepoint,struct pubkey channel_init,,remote_revocation_basepoint,struct pubkey
18 channel_init,,payment_basepoint,struct pubkey channel_init,,remote_payment_basepoint,struct pubkey
19 channel_init,,delayed_payment_basepoint,struct pubkey channel_init,,remote_htlc_basepoint,struct pubkey
20 channel_init,,remote_per_commit,struct pubkey channel_init,,remote_delayed_payment_basepoint,struct pubkey
21 channel_init,,old_remote_per_commit,struct pubkey channel_init,,remote_per_commit,struct pubkey
22 channel_init,,old_remote_per_commit,struct pubkey
23 channel_init,,funder,enum side
24 channel_init,,fee_base,u32
25 channel_init,,fee_proportional,u32

View File

@ -1408,6 +1408,7 @@ static enum watch_result funding_spent(struct peer *peer,
&ourkey,
peer->funder,
&peer->channel_info->theirbase.payment,
&peer->channel_info->theirbase.htlc,
&peer->channel_info->theirbase.delayed_payment,
tx,
block->height,
@ -2093,6 +2094,7 @@ static bool peer_start_channeld(struct peer *peer,
&peer->channel_info->remote_fundingkey,
&peer->channel_info->theirbase.revocation,
&peer->channel_info->theirbase.payment,
&peer->channel_info->theirbase.htlc,
&peer->channel_info->theirbase.delayed_payment,
&peer->channel_info->remote_per_commit,
&peer->channel_info->old_remote_per_commit,
@ -2167,6 +2169,7 @@ static void opening_funder_finished(struct subd *opening, const u8 *resp,
&cs,
&channel_info->theirbase.revocation,
&channel_info->theirbase.payment,
&channel_info->theirbase.htlc,
&channel_info->theirbase.delayed_payment,
&channel_info->remote_per_commit,
&fc->peer->minimum_depth,
@ -2177,8 +2180,6 @@ static void opening_funder_finished(struct subd *opening, const u8 *resp,
tal_hex(resp, resp));
return;
}
/* FIXME */
channel_info->theirbase.htlc = channel_info->theirbase.payment;
/* old_remote_per_commit not valid yet, copy valid one. */
channel_info->old_remote_per_commit = channel_info->remote_per_commit;
@ -2284,6 +2285,7 @@ static void opening_fundee_finished(struct subd *opening,
&cs,
&channel_info->theirbase.revocation,
&channel_info->theirbase.payment,
&channel_info->theirbase.htlc,
&channel_info->theirbase.delayed_payment,
&channel_info->remote_per_commit,
&channel_info->remote_fundingkey,
@ -2298,8 +2300,6 @@ static void opening_fundee_finished(struct subd *opening,
tal_hex(reply, reply));
return;
}
/* FIXME */
channel_info->theirbase.htlc = channel_info->theirbase.payment;
/* old_remote_per_commit not valid yet, copy valid one. */
channel_info->old_remote_per_commit = channel_info->remote_per_commit;

View File

@ -1974,6 +1974,7 @@ int main(int argc, char *argv[])
&our_wallet_pubkey,
&funder,
&remote_payment_basepoint,
&remote_htlc_basepoint,
&remote_delayed_payment_basepoint,
tx,
&tx_blockheight,
@ -1982,7 +1983,7 @@ int main(int argc, char *argv[])
&num_htlcs)) {
master_badmsg(WIRE_ONCHAIN_INIT, msg);
}
remote_htlc_basepoint = remote_payment_basepoint;
derive_basepoints(&seed, NULL, &basepoints, &secrets, &shaseed);
bitcoin_txid(tx, &txid);

View File

@ -23,6 +23,7 @@ onchain_init,,ourwallet_pubkey,struct pubkey
# We need these two for commit number obscurer
onchain_init,,funder,enum side
onchain_init,,remote_payment_basepoint,struct pubkey
onchain_init,,remote_htlc_basepoint,struct pubkey
onchain_init,,remote_delayed_payment_basepoint,struct pubkey
onchain_init,,tx,struct bitcoin_tx
onchain_init,,tx_blockheight,u32

1 #include <common/htlc_wire.h>
23 # We need these two for commit number obscurer
24 onchain_init,,funder,enum side
25 onchain_init,,remote_payment_basepoint,struct pubkey
26 onchain_init,,remote_htlc_basepoint,struct pubkey
27 onchain_init,,remote_delayed_payment_basepoint,struct pubkey
28 onchain_init,,tx,struct bitcoin_tx
29 onchain_init,,tx_blockheight,u32

View File

@ -443,6 +443,7 @@ static u8 *funder_channel(struct state *state,
&state->cs,
&theirs.revocation,
&theirs.payment,
&theirs.htlc,
&theirs.delayed_payment,
&state->next_per_commit[REMOTE],
minimum_depth,
@ -665,6 +666,7 @@ static u8 *fundee_channel(struct state *state,
&state->cs,
&theirs.revocation,
&theirs.payment,
&theirs.htlc,
&theirs.delayed_payment,
&state->next_per_commit[REMOTE],
&their_funding_pubkey,

View File

@ -36,6 +36,7 @@ opening_funder_reply,,first_commit_sig,secp256k1_ecdsa_signature
opening_funder_reply,,crypto_state,struct crypto_state
opening_funder_reply,,revocation_basepoint,struct pubkey
opening_funder_reply,,payment_basepoint,struct pubkey
opening_funder_reply,,htlc_basepoint,struct pubkey
opening_funder_reply,,delayed_payment_basepoint,struct pubkey
opening_funder_reply,,their_per_commit_point,struct pubkey
opening_funder_reply,,minimum_depth,u32
@ -59,6 +60,7 @@ opening_fundee_reply,,first_commit_sig,secp256k1_ecdsa_signature
opening_fundee_reply,,crypto_state,struct crypto_state
opening_fundee_reply,,revocation_basepoint,struct pubkey
opening_fundee_reply,,payment_basepoint,struct pubkey
opening_fundee_reply,,htlc_basepoint,struct pubkey
opening_fundee_reply,,delayed_payment_basepoint,struct pubkey
opening_fundee_reply,,their_per_commit_point,struct pubkey
opening_fundee_reply,,remote_fundingkey,struct pubkey

1 #include <common/cryptomsg.h>
36 opening_funder_reply,,payment_basepoint,struct pubkey
37 opening_funder_reply,,delayed_payment_basepoint,struct pubkey opening_funder_reply,,htlc_basepoint,struct pubkey
38 opening_funder_reply,,their_per_commit_point,struct pubkey opening_funder_reply,,delayed_payment_basepoint,struct pubkey
39 opening_funder_reply,,their_per_commit_point,struct pubkey
40 opening_funder_reply,,minimum_depth,u32
41 opening_funder_reply,,remote_fundingkey,struct pubkey
42 opening_funder_reply,,funding_txid,struct sha256_double
60 opening_fundee_reply,,their_per_commit_point,struct pubkey opening_fundee_reply,,delayed_payment_basepoint,struct pubkey
61 opening_fundee_reply,,remote_fundingkey,struct pubkey opening_fundee_reply,,their_per_commit_point,struct pubkey
62 opening_fundee_reply,,funding_txid,struct sha256_double opening_fundee_reply,,remote_fundingkey,struct pubkey
63 opening_fundee_reply,,funding_txid,struct sha256_double
64 opening_fundee_reply,,funding_txout,u16
65 opening_fundee_reply,,funding_satoshis,u64
66 opening_fundee_reply,,push_msat,u64