common/json_parse_simple: drop redundant and wrong json_str_to_u64()
#8413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
json_str_to_u64()
function contains incorrect logic. It chops one character off of the beginning and end of the JSMN token and then parses the remainder as au64
, butJSMN_STRING
tokens already do not include the enclosing quotation marks, sojson_str_to_u64()
would actually parse the JSON string"1234"
into the integer 23. Oops! Also note that it would simply fail on all input strings shorter than two characters sincetok->end
would wind up beforetok->start
.Just drop the function entirely. It was only used in one place, and that place explicitly doesn't care whether its input is a JSON number or a numeric string, and it was already calling
json_to_u64()
as an alternative, and that function already accepts both JSON strings and JSON numbers as input, so the call tojson_str_to_u64()
would have been entirely redundant if it had been correct.Changelog-Fixed: The
keysend
command no longer corrupts the type numbers of extra TLVs when they are specified as numeric strings longer than 2 digits.Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: