mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
jsonrpc: Added nested messages for the getroute reply
The `route_hop` struct introduced in the previous refactoring is reused when returning the reply to a `getroute` request. Since these are nested messages I added the serialization and deserialization methods.
This commit is contained in:
parent
73e65cac4d
commit
2d198e22d0
@ -25,3 +25,17 @@ void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry
|
||||
}
|
||||
towire_u16(pptr, entry->port);
|
||||
}
|
||||
|
||||
void fromwire_route_hop(const u8 **pptr, size_t *max, struct route_hop *entry)
|
||||
{
|
||||
fromwire_pubkey(pptr, max, &entry->nodeid);
|
||||
entry->amount = fromwire_u32(pptr, max);
|
||||
entry->delay = fromwire_u32(pptr, max);
|
||||
}
|
||||
void towire_route_hop(u8 **pptr, const struct route_hop *entry)
|
||||
{
|
||||
towire_pubkey(pptr, &entry->nodeid);
|
||||
towire_u32(pptr, entry->amount);
|
||||
towire_u32(pptr, entry->delay);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define LIGHTNING_LIGHTNINGD_GOSSIP_MSG_H
|
||||
#include "config.h"
|
||||
#include <bitcoin/pubkey.h>
|
||||
#include <daemon/routing.h>
|
||||
|
||||
struct gossip_getnodes_entry {
|
||||
struct pubkey nodeid;
|
||||
@ -12,4 +13,7 @@ struct gossip_getnodes_entry {
|
||||
void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *max, struct gossip_getnodes_entry *entry);
|
||||
void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry *entry);
|
||||
|
||||
void fromwire_route_hop(const u8 **pprt, size_t *max, struct route_hop *entry);
|
||||
void towire_route_hop(u8 **pprt, const struct route_hop *entry);
|
||||
|
||||
#endif /* LIGHTNING_LIGHTGNINGD_GOSSIP_MSG_H */
|
||||
|
Loading…
Reference in New Issue
Block a user