forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wire: Add a function to serialize a raw set of TLV fields
The generated wrappers will ignore the raw fields and will only consider the shortcut fields. This function takes the raw fields and serializes them instead.
- Loading branch information
1 parent
ef0f28c
commit 1b32cc1
Showing
3 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <wire/tlvstream.h> | ||
#include <wire/wire.h> | ||
|
||
void towire_tlvstream_raw(u8 **pptr, const struct tlv_field *fields) | ||
{ | ||
if (!fields) | ||
return; | ||
|
||
for (size_t i = 0; i < tal_count(fields); i++) { | ||
const struct tlv_field *field = &fields[i]; | ||
/* BOLT #1: | ||
* | ||
* The sending node: | ||
... | ||
* - MUST minimally encode `type` and `length`. | ||
*/ | ||
towire_bigsize(pptr, field->numtype); | ||
towire_bigsize(pptr, field->length); | ||
towire(pptr, field->value, field->length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters