lightningd: Add method to find a peer given its unique_id

Needed later
This commit is contained in:
Christian Decker
2017-03-09 14:06:17 +01:00
parent 477b537bad
commit 6319035033
2 changed files with 11 additions and 1 deletions

View File

@@ -42,6 +42,16 @@ struct peer *find_peer(struct lightningd_state *dstate, const struct pubkey *id)
FIXME_IMPLEMENT();
}
struct peer *find_peer_by_unique_id(struct lightningd *ld, u64 unique_id)
{
struct peer *peer;
list_for_each(&ld->peers, peer, list) {
if (peer->unique_id == unique_id)
return peer;
}
return NULL;
}
void peer_debug(struct peer *peer, const char *fmt, ...);
void peer_debug(struct peer *peer, const char *fmt, ...)
{

View File

@@ -55,7 +55,7 @@ struct lightningd {
void derive_peer_seed(struct lightningd *ld, struct privkey *peer_seed,
const struct pubkey *peer_id);
struct peer *find_peer_by_unique_id(struct lightningd *ld, u64 unique_id);
/* FIXME */
static inline struct lightningd *
ld_from_dstate(const struct lightningd_state *dstate)