From b3514d343036bf205174ebdb56b4222b9519cc86 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 22 Aug 2017 14:34:37 +0930 Subject: [PATCH] generate-wire.py: generate chain_hash fields as sha256_double. Signed-off-by: Rusty Russell --- lightningd/opening/opening.c | 4 ++-- tools/generate-wire.py | 2 ++ wire/test/run-peer-wire.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lightningd/opening/opening.c b/lightningd/opening/opening.c index 67a4e319c..09ddc8626 100644 --- a/lightningd/opening/opening.c +++ b/lightningd/opening/opening.c @@ -243,7 +243,7 @@ static u8 *funder_channel(struct state *state, 1000 * state->funding_satoshis); msg = towire_open_channel(state, - &state->chainparams->genesis_blockhash.sha, + &state->chainparams->genesis_blockhash, &channel_id, state->funding_satoshis, state->push_msat, state->localconf.dust_limit_satoshis, @@ -479,7 +479,7 @@ static u8 *fundee_channel(struct state *state, * `delayed_payment_basepoint` are not valid DER-encoded compressed * secp256k1 pubkeys. */ - if (!fromwire_open_channel(peer_msg, NULL, &chain_hash.sha, &channel_id, + if (!fromwire_open_channel(peer_msg, NULL, &chain_hash, &channel_id, &state->funding_satoshis, &state->push_msat, &state->remoteconf->dust_limit_satoshis, &state->remoteconf->max_htlc_value_in_flight_msat, diff --git a/tools/generate-wire.py b/tools/generate-wire.py index 89b92fe6f..1aa5969c9 100755 --- a/tools/generate-wire.py +++ b/tools/generate-wire.py @@ -17,6 +17,7 @@ type2size = { 'struct preimage': 32, 'struct pubkey': 33, 'struct sha256': 32, + 'struct sha256_double': 32, 'u64': 8, 'u32': 4, 'u16': 2, @@ -76,6 +77,7 @@ partialtypemap = { 'signature': FieldType('secp256k1_ecdsa_signature'), 'features': FieldType('u8'), 'channel_id': FieldType('struct channel_id'), + 'chain_hash': FieldType('struct sha256_double'), 'pad': FieldType('pad'), } diff --git a/wire/test/run-peer-wire.c b/wire/test/run-peer-wire.c index 9b182c94c..1b5ad7941 100644 --- a/wire/test/run-peer-wire.c +++ b/wire/test/run-peer-wire.c @@ -164,7 +164,7 @@ struct msg_node_announcement { u8 *addresses; }; struct msg_open_channel { - struct sha256 chain_hash; + struct sha256_double chain_hash; struct channel_id temporary_channel_id; u64 funding_satoshis; u64 push_msat;