Browse Source

gossip: Added short_channel_id_to_uint for uintmap index

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
d7224e2178
  1. 6
      bitcoin/short_channel_id.c
  2. 3
      bitcoin/short_channel_id.h

6
bitcoin/short_channel_id.c

@ -32,3 +32,9 @@ bool short_channel_id_eq(const struct short_channel_id *a,
return a->blocknum == b->blocknum && a->txnum == b->txnum &&
a->outnum == b->outnum;
}
u64 short_channel_id_to_uint(const struct short_channel_id *scid)
{
return ((u64)scid->blocknum & 0xFFFFFF) << 40 |
((u64)scid->txnum & 0xFFFFFF) << 16 | (scid->outnum & 0xFFFF);
}

3
bitcoin/short_channel_id.h

@ -25,4 +25,7 @@ bool short_channel_id_eq(const struct short_channel_id *a,
char *short_channel_id_to_str(const tal_t *ctx, const struct short_channel_id *scid);
/* Fast, platform dependent, way to convert from a short_channel_id to u64 */
u64 short_channel_id_to_uint(const struct short_channel_id *scid);
#endif /* LIGHTNING_BITCOIN_SHORT_CHANNEL_ID_H */

Loading…
Cancel
Save