Merge bitcoin/bitcoin#33162: test: fix scripts in blockfilter_basic_test

ca64b71ed5 test: fix scripts in `blockfilter_basic_test` (UdjinM6)

Pull request description:

  `std::vector` fill ctor is like this:
  ```
  // Constructs a vector with `count` copies of elements with value `value`.
  explicit vector( size_type count, const T& value = T(), const Allocator& alloc = Allocator() ); // (until C++11)
  vector( size_type count, const T& value, const Allocator& alloc = Allocator() ); // (since C++11)(constexpr since C++20)
  ```
  https://en.cppreference.com/w/cpp/container/vector/vector.html

  i.e. `std::vector<unsigned char>(0, 65)` means a vector with `0` copies of `65` which feels wrong. I believe `count` and `value` were swapped in `blockfilter_basic_test` scripts.

ACKs for top commit:
  furszy:
    ACK ca64b71ed5
  pablomartin4btc:
    ACK ca64b71ed5
  janb84:
    ACK ca64b71ed5

Tree-SHA512: 2cfc7f09788b0a1afdffc9cd6663204c7f1775dabdbe1046cdcd42936c479658c348cb46e0d8835645e6c508e8b40a598cbe6534084b6780a6b60378bcbd0f96
This commit is contained in:
merge-script
2025-08-11 10:44:57 -04:00

View File

@@ -59,21 +59,21 @@ BOOST_AUTO_TEST_CASE(blockfilter_basic_test)
CScript included_scripts[5], excluded_scripts[4];
// First two are outputs on a single transaction.
included_scripts[0] << std::vector<unsigned char>(0, 65) << OP_CHECKSIG;
included_scripts[1] << OP_DUP << OP_HASH160 << std::vector<unsigned char>(1, 20) << OP_EQUALVERIFY << OP_CHECKSIG;
included_scripts[0] << std::vector<unsigned char>(65, 0) << OP_CHECKSIG;
included_scripts[1] << OP_DUP << OP_HASH160 << std::vector<unsigned char>(20, 1) << OP_EQUALVERIFY << OP_CHECKSIG;
// Third is an output on in a second transaction.
included_scripts[2] << OP_1 << std::vector<unsigned char>(2, 33) << OP_1 << OP_CHECKMULTISIG;
included_scripts[2] << OP_1 << std::vector<unsigned char>(33, 2) << OP_1 << OP_CHECKMULTISIG;
// Last two are spent by a single transaction.
included_scripts[3] << OP_0 << std::vector<unsigned char>(3, 32);
included_scripts[3] << OP_0 << std::vector<unsigned char>(32, 3);
included_scripts[4] << OP_4 << OP_ADD << OP_8 << OP_EQUAL;
// OP_RETURN output is an output on the second transaction.
excluded_scripts[0] << OP_RETURN << std::vector<unsigned char>(4, 40);
excluded_scripts[0] << OP_RETURN << std::vector<unsigned char>(40, 4);
// This script is not related to the block at all.
excluded_scripts[1] << std::vector<unsigned char>(5, 33) << OP_CHECKSIG;
excluded_scripts[1] << std::vector<unsigned char>(33, 5) << OP_CHECKSIG;
// OP_RETURN is non-standard since it's not followed by a data push, but is still excluded from
// filter.