Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TLV's to decodemsg utility #2531

Merged
merged 2 commits into from Apr 8, 2019

Conversation

niftynei
Copy link
Collaborator

@niftynei niftynei commented Apr 5, 2019

Fixup the decodemsg utility to also include abilities for TLVs...

fixup printing methods in devtools/decodemsg such that TLV's can
now be printed as well. here's how you'd use it:

   $ ./devtools/decodemsg --tlv opening_tlv 0120001E020202020202020202020202020202020202020202020202020202020202
   > WIRE_OPTION_UPFRONT_SHUTDOWN_SCRIPT (size 32):
   > shutdown_scriptpubkey=[020202020202020202020202020202020202020202020202020202020202]
Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not how I would have done it: I would have generated print_tlv_XXX functions and hardcoded them in decodemsg. But this is nicer!

Separately, we should make decodemsg exitcode depend on the message, (and document it in the help!):

  1. Decoded fine, no surprises, may have extra data (unless --no-extra specified).
  2. Truncated, or had extra data and --no-extra was specified.
  3. Unknown message.

Making print_xxx return a bitfield (enum for unknown/truncated/extra/ok) is probably simplest implementation.

@rustyrussell
Copy link
Contributor

Ack b445b1b

@rustyrussell rustyrussell merged commit ed12234 into ElementsProject:master Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants