Browse Source

Add TestMemPoolEntryHelper::FromTx version for CTransaction

0.13
Matt Corallo 9 years ago
parent
commit
f4f8f14adc
  1. 6
      src/test/test_bitcoin.cpp
  2. 1
      src/test/test_bitcoin.h

6
src/test/test_bitcoin.cpp

@ -126,7 +126,11 @@ TestChain100Setup::~TestChain100Setup()
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(CMutableTransaction &tx, CTxMemPool *pool) { CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(CMutableTransaction &tx, CTxMemPool *pool) {
CTransaction txn(tx); CTransaction txn(tx);
bool hasNoDependencies = pool ? pool->HasNoInputsOf(tx) : hadNoDependencies; return FromTx(txn, pool);
}
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(CTransaction &txn, CTxMemPool *pool) {
bool hasNoDependencies = pool ? pool->HasNoInputsOf(txn) : hadNoDependencies;
// Hack to assume either its completely dependent on other mempool txs or not at all // Hack to assume either its completely dependent on other mempool txs or not at all
CAmount inChainValue = hasNoDependencies ? txn.GetValueOut() : 0; CAmount inChainValue = hasNoDependencies ? txn.GetValueOut() : 0;

1
src/test/test_bitcoin.h

@ -78,6 +78,7 @@ struct TestMemPoolEntryHelper
hadNoDependencies(false), spendsCoinbase(false), sigOpCount(1) { } hadNoDependencies(false), spendsCoinbase(false), sigOpCount(1) { }
CTxMemPoolEntry FromTx(CMutableTransaction &tx, CTxMemPool *pool = NULL); CTxMemPoolEntry FromTx(CMutableTransaction &tx, CTxMemPool *pool = NULL);
CTxMemPoolEntry FromTx(CTransaction &tx, CTxMemPool *pool = NULL);
// Change the default value // Change the default value
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; } TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }

Loading…
Cancel
Save