Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
test: Move variable `state` down where it is used #10739
+1
−1
Conversation
|
utACK 46d53a6 |
promag
reviewed
Jul 4, 2017
Why not remove the upper declaration as it isn't used in that scope and state is not shared across those blocks?
|
@promag no particular reason other than loosing 3- diff status... |
fanquake
added the
Refactoring
label
Jul 4, 2017
|
utACK 46d53a6 |
MarcoFalke
added the
Tests
label
Jul 7, 2017
|
I'd prefer the +1-1 diff suggested by promag. This way, the state does not leak into the outer scope. diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp
index a74f402..3d8a4fd 100644
--- a/src/test/txvalidationcache_tests.cpp
+++ b/src/test/txvalidationcache_tests.cpp
@@ -198,4 +198,4 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
// spend_tx is invalid according to DERSIG
- CValidationState state;
{
+ CValidationState state;
PrecomputedTransactionData ptd_spend_tx(spend_tx); |
|
Combined/correct fix used instead. |
| { | ||
| + CValidationState state; |
| @@ -293,7 +292,6 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup) | ||
| // Make it valid, and check again | ||
| invalid_with_csv_tx.vin[0].scriptSig = CScript() << vchSig << 100; | ||
| - CValidationState state; |
| @@ -354,7 +352,6 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup) | ||
| // Invalidate vin[1] | ||
| tx.vin[1].scriptWitness.SetNull(); | ||
| - CValidationState state; |
|
Obvious ACK 5618b7d. |
|
Please rename PR and commit before merge. |
paveljanik
changed the title from
Do not shadow upper local variable `state`, reuse it as in other cases. to Do not shadow upper local variable `state`
Jul 8, 2017
paveljanik
changed the title from
Do not shadow upper local variable `state` to Move variable `state` down where it is used
Jul 15, 2017
|
utACK 5618b7d |
|
utACK 5618b7d |
MarcoFalke
changed the title from
Move variable `state` down where it is used to test: Move variable `state` down where it is used
Jul 16, 2017
|
utACK 5618b7d |
MarcoFalke
merged commit 5618b7d
into
bitcoin:master
Jul 16, 2017
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
MarcoFalke
added a commit
that referenced
this pull request
Jul 16, 2017
|
|
MarcoFalke |
1fc783f
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
paveljanik commentedJul 4, 2017
Tests added in #10192 emit few shadowing warnings:
Remove shadowing declarations and reuse the upper local declaration as in other already present test cases.