Page MenuHomePhabricator

Give more descriptive error when parsing partial-byte hex values
ClosedPublic

Authored by jasonbcox on Apr 14 2018, 23:09.

Details

Summary

Fixes T312. 0x0 and 0x001 are examples of hex values that fail the script parser. This isn't immediately obvious unless you're familiar with the code, and the script fails with a totally useless and generic error message.

Test Plan

make check + make check with script_tests.json having one line changed 0x02 -> 0x2 (fails with the expected error)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/core_read.cpp
73–75 ↗(On Diff #3512)

Uh. The linter did this. I wasn't aware this is valid C++. I looked it up and it may not be supported on older compilers. Let me know if you'd prefer that I add backslashes to concatenate them.

deadalnix requested changes to this revision.Apr 15 2018, 20:49

Can you add a test case for this ?

This revision now requires changes to proceed.Apr 15 2018, 20:49
deadalnix requested changes to this revision.Apr 17 2018, 00:14

Please add the test to src/test/CMakeLists.txt

This revision now requires changes to proceed.Apr 17 2018, 00:14
deadalnix added inline comments.
src/test/CMakeLists.txt
72 ↗(On Diff #3519)

I missed it. I'm an idiot.

This revision is now accepted and ready to land.Apr 17 2018, 00:50
This revision was automatically updated to reflect the committed changes.