mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
sphinx: Make payload size computation publicly available
This commit is contained in:
parent
0eaba5600a
commit
dff0a13bd1
2 changed files with 6 additions and 1 deletions
|
@ -83,7 +83,7 @@ static size_t sphinx_hop_size(const struct sphinx_hop *hop)
|
||||||
return tal_bytelen(hop->raw_payload) + HMAC_SIZE;
|
return tal_bytelen(hop->raw_payload) + HMAC_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t sphinx_path_payloads_size(const struct sphinx_path *path)
|
size_t sphinx_path_payloads_size(const struct sphinx_path *path)
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for (size_t i=0; i<tal_count(path->hops); i++)
|
for (size_t i=0; i<tal_count(path->hops); i++)
|
||||||
|
|
|
@ -221,4 +221,9 @@ struct sphinx_path *sphinx_path_new_with_key(const tal_t *ctx,
|
||||||
void sphinx_add_hop(struct sphinx_path *path, const struct pubkey *pubkey,
|
void sphinx_add_hop(struct sphinx_path *path, const struct pubkey *pubkey,
|
||||||
const u8 *payload TAKES);
|
const u8 *payload TAKES);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the size of the serialized payloads.
|
||||||
|
*/
|
||||||
|
size_t sphinx_path_payloads_size(const struct sphinx_path *path);
|
||||||
|
|
||||||
#endif /* LIGHTNING_COMMON_SPHINX_H */
|
#endif /* LIGHTNING_COMMON_SPHINX_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue