proto: Added handling for nested packets

This commit is contained in:
Christian Decker
2016-12-12 14:55:15 +01:00
committed by Rusty Russell
parent 1c4d4f8c91
commit db481d881a
4 changed files with 56 additions and 1 deletions

View File

@@ -213,6 +213,19 @@ void queue_pkt_revocation(struct peer *peer,
queue_pkt(peer, PKT__PKT_UPDATE_REVOCATION, u);
}
/* Send a serialized nested packet. */
void queue_pkt_nested(struct peer *peer,
int type,
const u8 *nested_pkt)
{
NestedPkt *pb = tal(peer, NestedPkt);
nested_pkt__init(pb);
pb->type = type;
pb->inner_pkt.len = tal_count(nested_pkt);
pb->inner_pkt.data = tal_dup_arr(pb, u8, nested_pkt, pb->inner_pkt.len, 0);
queue_pkt(peer, PKT__PKT_NESTED, pb);
}
Pkt *pkt_err(struct peer *peer, const char *msg, ...)
{
Error *e = tal(peer, Error);