16#include <boost/test/unit_test.hpp> 
   19static std::vector<unsigned char>
 
   22    std::vector<unsigned char> sSerialized(s.
begin(), s.
end());
 
   47    std::vector<CPubKey> keys;
 
   48    for (
int i = 0; i < 3; i++)
 
   88    creationTx.
vin.resize(1);
 
   89    creationTx.
vin[0].prevout.SetNull();
 
   91    creationTx.
vout.resize(1);
 
   92    creationTx.
vout[0].nValue = 1;
 
   93    creationTx.
vout[0].scriptPubKey = scriptPubKey;
 
   96    spendingTx.
vin.resize(1);
 
   97    spendingTx.
vin[0].prevout.hash = creationTx.
GetHash();
 
   98    spendingTx.
vin[0].prevout.n = 0;
 
   99    spendingTx.
vin[0].scriptSig = scriptSig;
 
  100    spendingTx.
vin[0].scriptWitness = witness;
 
  101    spendingTx.
vout.resize(1);
 
  102    spendingTx.
vout[0].nValue = 1;
 
  160        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  161        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  164        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
  171        assert(scriptPubKey[0] == 0x00);
 
  172        scriptPubKey[0] = 0x51;
 
  173        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
  175        scriptPubKey[0] = 0x00;
 
  176        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
  179        spendingTx.
vin[0].prevout.SetNull();
 
  189        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  190        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  192        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
  203        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  204        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  205        scriptWitness.
stack.push_back(std::vector<unsigned char>(witnessScript.
begin(), witnessScript.
end()));
 
  207        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
  220        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  221        scriptWitness.
stack.push_back(std::vector<unsigned char>(0));
 
  222        scriptWitness.
stack.push_back(std::vector<unsigned char>(witnessScript.
begin(), witnessScript.
end()));
 
  224        BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
 
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Abstract view on the open txout dataset.
An encapsulated private key.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
CPubKey GetPubKey() const
Compute the public key from a private key.
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs as 20 sigops.
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const std::vector< CTxIn > vin
void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check_for_overwrite)
Utility function to add all of a transaction's outputs to a cache.
static const int WITNESS_SCALE_FACTOR
BOOST_AUTO_TEST_SUITE_END()
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ ASSERT_FAIL
Abort execution through assertion failure (for consensus code)
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static const int MAX_PUBKEYS_PER_MULTISIG
std::vector< unsigned char > ToByteVector(const T &in)
enum ScriptError_t ScriptError
@ SCRIPT_ERR_CHECKMULTISIGVERIFY
static ScriptError VerifyWithFlag(const CTransaction &output, const CMutableTransaction &input, uint32_t flags)
Verifies script execution of the zeroth scriptPubKey of tx output and zeroth scriptSig and witness of...
static void BuildTxs(CMutableTransaction &spendingTx, CCoinsViewCache &coins, CMutableTransaction &creationTx, const CScript &scriptPubKey, const CScript &scriptSig, const CScriptWitness &witness)
Builds a creationTx from scriptPubKey and a spendingTx from scriptSig and witness such that spendingT...
static std::vector< unsigned char > Serialize(const CScript &s)
BOOST_AUTO_TEST_CASE(GetSigOpCount)
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
A mutable version of CTransaction.
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
std::vector< CTxOut > vout
std::vector< std::vector< unsigned char > > stack
bool error(const char *fmt, const Args &... args)
int64_t GetTransactionSigOpCost(const CTransaction &tx, const CCoinsViewCache &inputs, uint32_t flags)
Compute total signature operation cost of a transaction.