mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
script: Consolidate scripts to use pubkey_to_hash160
This commit is contained in:
committed by
Rusty Russell
parent
f371b6df20
commit
7dc693963d
@@ -236,26 +236,6 @@ bool onion_shared_secret(
|
||||
privkey->secret.data);
|
||||
}
|
||||
|
||||
void pubkey_hash160(
|
||||
u8 *dst,
|
||||
const struct pubkey *pubkey)
|
||||
{
|
||||
struct ripemd160 r;
|
||||
struct sha256 h;
|
||||
u8 der[33];
|
||||
size_t outputlen = 33;
|
||||
|
||||
secp256k1_ec_pubkey_serialize(secp256k1_ctx,
|
||||
der,
|
||||
&outputlen,
|
||||
&pubkey->pubkey,
|
||||
SECP256K1_EC_COMPRESSED);
|
||||
sha256(&h, der, sizeof(der));
|
||||
ripemd160(&r, h.u.u8, sizeof(h));
|
||||
|
||||
memcpy(dst, r.u.u8, sizeof(r));
|
||||
}
|
||||
|
||||
static void generate_key_set(const u8 secret[SHARED_SECRET_SIZE],
|
||||
struct keyset *keys)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user