mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
gossip: Added short_channel_id_to_uint for uintmap index
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
0bc2f8714d
commit
d7224e2178
@ -32,3 +32,9 @@ bool short_channel_id_eq(const struct short_channel_id *a,
|
|||||||
return a->blocknum == b->blocknum && a->txnum == b->txnum &&
|
return a->blocknum == b->blocknum && a->txnum == b->txnum &&
|
||||||
a->outnum == b->outnum;
|
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);
|
||||||
|
}
|
||||||
|
@ -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);
|
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 */
|
#endif /* LIGHTNING_BITCOIN_SHORT_CHANNEL_ID_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user