Page MenuHomePhabricator

vout parameter check in createrawtransaction is confused with missing & type_error.
ClosedPublic

Authored by andychen on Jul 11 2018, 02:48.

Details

Summary

vout parameter in createrawtransaction could be missing or non-num,
but the code simply check the type of vout and throws missing error, which is
not right for string vout.

Test Plan

make check

Diff Detail

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

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jul 11 2018, 02:48

fix some code formatting auto-done by editor.

make check is not an appropriate test for this. This is changing behavior, and such behavior needs to be tested. Please update the test plan accordingly.

Except this, LGTM.

make check is not an appropriate test for this. This is changing behavior, and such behavior needs to be tested. Please update the test plan accordingly.

Except this, LGTM.

I will make it :)

Amaury is saying you need to add this to the test plan, at a minimum:

/test/functional/test_runner.py rawtransactions.py

This ensures you test changes pass locally before publishing the diff. :)

jasonbcox requested changes to this revision.Jul 11 2018, 16:40
jasonbcox added inline comments.
test/functional/rawtransactions.py
181 ↗(On Diff #4274)

you introduced a typo. 'vot' <-> 'vout'

188 ↗(On Diff #4274)

The "1" for 'vout' shouldn't be a string by the looks of the other test cases.

This revision now requires changes to proceed.Jul 11 2018, 16:40

Amaury is saying you need to add this to the test plan, at a minimum:

/test/functional/test_runner.py rawtransactions.py

This ensures you test changes pass locally before publishing the diff. :)

OK, thanks, I had test it locally and it's OK, I will update it to the commit. The code format lint is quite hard to fix, any suggestion?

test/functional/rawtransactions.py
181 ↗(On Diff #4274)

that's for missing of vout, but maybe just remove vout parameter is better than "vot"?

188 ↗(On Diff #4274)

that's for number test

update Test Plan & make rawtransaction test case better

Regarding linting errors, check clang-format --version and make sure you're on 4.x instead of 5 or 6.

test/functional/rawtransactions.py
181 ↗(On Diff #4274)

Yes, I think removing it all together is better, as it doesn't look like an error.

188 ↗(On Diff #4274)

Ah, sorry didn't read close enough.

Regarding linting errors, check clang-format --version and make sure you're on 4.x instead of 5 or 6.

found 7.0...thanks.

fix string concat bug by use string directly.

Regarding linting errors, check clang-format --version and make sure you're on 4.x instead of 5 or 6.

It's green now :)

schancel requested changes to this revision.Jul 12 2018, 18:18
schancel added a subscriber: schancel.

Seems like a good change. However, please fix the code style as per what I suggested. Just check for null first.

src/rpc/rawtransaction.cpp
510 ↗(On Diff #4283)

Please make this two ifs. rather than an or and an internal branch (via ternary operator)

This revision now requires changes to proceed.Jul 12 2018, 18:18
src/rpc/rawtransaction.cpp
510 ↗(On Diff #4283)

The first version I made is 2 ifs, but the code format said the new if is coped from line 512:
https://reviews.bitcoinabc.org/D1556?id=4272

Then I turn the 2 ifs into one to avoid the coding style warning, I think 2ifs is more easy to read, but make the 2ifs into 1 is acceptable too, what do you think?

Seems like a good change. However, please fix the code style as per what I suggested. Just check for null first.

It's done :)

sometimes bip68-sequence.py test will fail which I think is irrelevant with this commit.

Seems like a good change. However, please fix the code style as per what I suggested. Just check for null first.

It's done, it can be land after you accept it.

This revision is now accepted and ready to land.Jul 16 2018, 16:39
This revision was automatically updated to reflect the committed changes.