mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
onchaind: clean up types for penalty transactions.
We can use pubkey_from_secret() to avoid the ugly sha->secret->privkey conversion. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
dfaf74d972
commit
437b65eba1
@ -1676,7 +1676,6 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
|
|||||||
struct keyset *ks;
|
struct keyset *ks;
|
||||||
size_t i;
|
size_t i;
|
||||||
struct secret per_commitment_secret;
|
struct secret per_commitment_secret;
|
||||||
struct privkey per_commitment_privkey;
|
|
||||||
struct pubkey per_commitment_point;
|
struct pubkey per_commitment_point;
|
||||||
|
|
||||||
init_reply("Tracking their illegal close: taking all funds");
|
init_reply("Tracking their illegal close: taking all funds");
|
||||||
@ -1693,15 +1692,11 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
|
|||||||
== sizeof(*revocation_preimage));
|
== sizeof(*revocation_preimage));
|
||||||
memcpy(&per_commitment_secret, revocation_preimage,
|
memcpy(&per_commitment_secret, revocation_preimage,
|
||||||
sizeof(per_commitment_secret));
|
sizeof(per_commitment_secret));
|
||||||
BUILD_ASSERT(sizeof(per_commitment_privkey)
|
if (!pubkey_from_secret(&per_commitment_secret, &per_commitment_point))
|
||||||
== sizeof(*revocation_preimage));
|
|
||||||
memcpy(&per_commitment_privkey, revocation_preimage,
|
|
||||||
sizeof(per_commitment_privkey));
|
|
||||||
if (!pubkey_from_privkey(&per_commitment_privkey, &per_commitment_point))
|
|
||||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||||
"Failed derive from per_commitment_secret %s",
|
"Failed derive from per_commitment_secret %s",
|
||||||
type_to_string(tmpctx, struct privkey,
|
type_to_string(tmpctx, struct secret,
|
||||||
&per_commitment_privkey));
|
&per_commitment_secret));
|
||||||
|
|
||||||
status_trace("Deriving keyset %"PRIu64
|
status_trace("Deriving keyset %"PRIu64
|
||||||
": per_commit_point=%s"
|
": per_commit_point=%s"
|
||||||
|
Loading…
Reference in New Issue
Block a user