ipc_fuzz.h raw

   1  // Copyright (c) 2026-present The Bitcoin Core developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  #ifndef BITCOIN_IPC_TEST_FUZZ_IPC_FUZZ_H
   6  #define BITCOIN_IPC_TEST_FUZZ_IPC_FUZZ_H
   7  
   8  #include <primitives/transaction.h>
   9  #include <script/script.h>
  10  #include <univalue.h>
  11  
  12  #include <algorithm>
  13  #include <vector>
  14  
  15  class IpcFuzzImplementation
  16  {
  17  public:
  18      int add(int a, int b) { return a + b; }
  19      COutPoint passOutPoint(COutPoint o) { return COutPoint{o.hash, o.n ^ 0xFFFFFFFFu}; }
  20      std::vector<uint8_t> passVectorUint8(std::vector<uint8_t> v) { std::reverse(v.begin(), v.end()); return v; }
  21      CScript passScript(CScript s) { s << OP_NOP; return s; }
  22      UniValue passUniValue(UniValue v) { return v; }
  23      CTransactionRef passTransaction(CTransactionRef t) { return t; }
  24  };
  25  
  26  #endif // BITCOIN_IPC_TEST_FUZZ_IPC_FUZZ_H
  27