originally done so that any field within a subtype needed context,
that would be reflected at the top-most layer. in reality, we
allocate subtype fields off of the instance of the subtype, so
there's no need to check beneath the 'top' layer of field/types
in a message to determine whether or not to pass in a context.
Add parsing know-how for enum fields. This is necessary for
internally defined wire generators. Enums are denoted by prefixing
the field with an `e:`.
Ex:
msgdata,msg_name,field_name,e:enum_type,
we rely, perhaps a bit hackily, on there only being one copy of
each type object floating about. using `deepcopy` on a Message
for message extensions destroys this paradigm, which breaks
things in the case where it's a later defined subtype that contains
variable-length members.
to fix this, we modify `__deepcopy__` on the Field class, such
that it preserves the reference to the original type_obj instance.
remove extra space from the lead-in for inline comments
so that a provided comment like this
# This is a comment
will appear like this
/* This is a comment */
Add a test for checking that the bolt-gens do the right thing
for a fairly exhaustive test case set (and that it compiles).
Note that this doesn't check that we've got the memory assignment
pieces worked out.
It's got a kind of exotic reliance on the update-mocks in that in
order to depend on as little of the wire/ code as possible (we
only import wire/wire.h), we include an AUTOGENERATE comment
in the test_cases CSV file, and then run update-mocks as part of
the build for that file.
we'll need this for internal wire message formats. also disambiguates
from 'bolt message optional fields', which we rename to extensions here.
example of an optional field declaration (note the ? prefixing the
type):
msgdata,msg_name,field_name,?type,count
these are handled with either a boolean if they're not present,
or a true value and then the object if they are.
if there are any comments that aren't "attached" to a message,
print them at the top of the generated file. we need this for
the fancy auto-gen'd dependencies in the tool-wiregen tests.
The new TLV spec uses BigSize, like Bitcoin's CompactInt but
*little-endian*. So change our name for clarity, and insist that
decoding be minimal as the spec requires.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
==1503== Use of uninitialised value of size 8
==1503== at 0x566786B: _itoa_word (_itoa.c:179)
==1503== by 0x566AF0D: vfprintf (vfprintf.c:1642)
==1503== by 0x569790F: vsnprintf (vsnprintf.c:114)
==1503== by 0x156CCB: do_vfmt (str.c:66)
==1503== by 0x156DB1: tal_vfmt_ (str.c:92)
==1503== by 0x1289CD: status_vfmt (status.c:141)
==1503== by 0x128AAC: status_fmt (status.c:151)
==1503== by 0x118E05: route_prune (routing.c:2495)
==1503== by 0x11DE2D: gossip_refresh_network (gossipd.c:1997)
==1503== by 0x1292B8: timer_expired (timeout.c:39)
==1503== by 0x12088C: main (gossipd.c:3075)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Also, change the values to match the spec values (I made the
to_self_delays different to catch more bugs).
Suggested-by: @niftynei
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is also required for actually creating usable onions. For the moment,
due to API limitations, we only let them set realm 0.
Note that the privkey parsing was broken, requiring an additional two
hex digits, overflowing the buffer, and were ignored.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Add odd-length string can never be valid hex!
In addition, don't try to print the next hop if there isn't one, but
always print the (raw) payload.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This allows for complete channel simulation, including HTLC
transactions, but means we use higher-level primitives to
make the easy.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
These utilities allow us to create valid test txs and information given both
sides' complete set of secrets.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This lets us use it as an interactive driver of conversation, rather
than writing all packets then reading all packets.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Our previous param support was a bit limited in this case.
We create a dev- command multiplexer, so we can exercise it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>