mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
struct secret: use everywhere.
We alternated between using a sha256 and using a privkey, but there are numerous places where we have a random 32 bytes which are neither. This fixes many of them (plus, struct privkey is now defined in terms of struct secret). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -878,7 +878,6 @@ static void their_htlc_added(struct peer *peer, struct htlc *htlc,
|
||||
struct peer *only_dest)
|
||||
{
|
||||
struct invoice *invoice;
|
||||
struct privkey pk;
|
||||
struct onionpacket *packet;
|
||||
struct route_step *step = NULL;
|
||||
|
||||
@@ -909,15 +908,13 @@ static void their_htlc_added(struct peer *peer, struct htlc *htlc,
|
||||
return;
|
||||
}
|
||||
|
||||
//FIXME: dirty trick to retrieve unexported state
|
||||
memcpy(&pk, peer->dstate->secret, sizeof(pk));
|
||||
|
||||
packet = parse_onionpacket(peer,
|
||||
htlc->routing, tal_count(htlc->routing));
|
||||
if (packet) {
|
||||
u8 shared_secret[32];
|
||||
|
||||
if (onion_shared_secret(shared_secret, packet, &pk))
|
||||
if (onion_shared_secret(shared_secret, packet,
|
||||
peer->dstate->privkey))
|
||||
step = process_onionpacket(packet, packet,
|
||||
shared_secret,
|
||||
htlc->rhash.u.u8,
|
||||
|
||||
Reference in New Issue
Block a user