mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 06:54:30 +01:00
wallet: Use persistent shachain for remote secrets
This commit is contained in:
committed by
Rusty Russell
parent
1ff64ef07c
commit
85d2256898
@@ -478,7 +478,7 @@ void add_peer(struct lightningd *ld, u64 unique_id,
|
||||
= peer->next_index[REMOTE]
|
||||
= peer->num_revocations_received = 0;
|
||||
peer->next_htlc_id = 0;
|
||||
shachain_init(&peer->their_shachain);
|
||||
wallet_shachain_init(ld->wallet, &peer->their_shachain);
|
||||
peer->closing_sig_received = NULL;
|
||||
|
||||
idname = type_to_string(peer, struct pubkey, id);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <lightningd/channel_config.h>
|
||||
#include <lightningd/peer_state.h>
|
||||
#include <stdbool.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
#define ANNOUNCE_MIN_DEPTH 6
|
||||
@@ -29,7 +30,7 @@ struct peer {
|
||||
u8 *error;
|
||||
|
||||
/* Their shachain. */
|
||||
struct shachain their_shachain;
|
||||
struct wallet_shachain their_shachain;
|
||||
|
||||
/* What's happening. */
|
||||
enum peer_state state;
|
||||
|
||||
@@ -1131,9 +1131,9 @@ int peer_got_revoke(struct peer *peer, const u8 *msg)
|
||||
* A receiving node MAY fail if the `per_commitment_secret` was not
|
||||
* generated by the protocol in [BOLT #3]
|
||||
*/
|
||||
if (!shachain_add_hash(&peer->their_shachain,
|
||||
shachain_index(revokenum),
|
||||
&per_commitment_secret)) {
|
||||
if (!wallet_shachain_add_hash(peer->ld->wallet, &peer->their_shachain,
|
||||
shachain_index(revokenum),
|
||||
&per_commitment_secret)) {
|
||||
char *err = tal_fmt(peer,
|
||||
"Bad per_commitment_secret %s for %"PRIu64,
|
||||
type_to_string(msg, struct sha256,
|
||||
|
||||
Reference in New Issue
Block a user