Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#31051: test: remove unused code from `script_te…
Browse files Browse the repository at this point in the history
…sts`

e0287bc test: remove unused code from script_tests (fanquake)

Pull request description:

  This has been unused since #29648. Noticed while running a newer version of clang-tidy (19.1.1):
  ```bash
  [127/391][6.2s] /opt/homebrew/opt/llvm/bin/clang-tidy -p=build -quiet --config-file=/bitcoin/src/.clang-tidy /bitcoin/src/test/script_tests.cpp
  bitcoin/src/test/script_tests.cpp:126:25: error: local copy 'tx2' of the variable 'tx' is never modified and never used; consider removing the statement [performance-unnecessary-copy-initialization,-warnings-as-errors]
    126 |     CMutableTransaction tx2 = tx;
        |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
    127 |     BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, &scriptWitness, flags, MutableTransactionSignatureChecker(&tx, 0, txCredit.vout[0].nValue, MissingDataBehavior::ASSERT_FAIL), &err) == expect, message);
  512 warnings generated.
  ```

ACKs for top commit:
  maflcko:
    review ACK e0287bc
  BrandonOdiwuor:
    ACK e0287bc

Tree-SHA512: f69513d0b898e0e9afad047bcec200707b057e3718a3d35bd479a788a1973e49ee7e5f48feadb8731ab5fdbd12a2b53b0bcf65296701e2296c3fdb67cdcabfb5
  • Loading branch information
fanquake committed Oct 8, 2024
2 parents caf44e5 + e0287bc commit 5d5cc02
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/test/script_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
ScriptError err;
const CTransaction txCredit{BuildCreditingTransaction(scriptPubKey, nValue)};
CMutableTransaction tx = BuildSpendingTransaction(scriptSig, scriptWitness, txCredit);
CMutableTransaction tx2 = tx;
BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, &scriptWitness, flags, MutableTransactionSignatureChecker(&tx, 0, txCredit.vout[0].nValue, MissingDataBehavior::ASSERT_FAIL), &err) == expect, message);
BOOST_CHECK_MESSAGE(err == scriptError, FormatScriptError(err) + " where " + FormatScriptError((ScriptError_t)scriptError) + " expected: " + message);

Expand Down

0 comments on commit 5d5cc02

Please sign in to comment.