Skip to content

Commit

Permalink
Add TestMemPoolEntryHelper::FromTx version for CTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Jun 19, 2016
1 parent 85ad31e commit f4f8f14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/test_bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ TestChain100Setup::~TestChain100Setup()

CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(CMutableTransaction &tx, CTxMemPool *pool) {
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
CAmount inChainValue = hasNoDependencies ? txn.GetValueOut() : 0;

Expand Down
1 change: 1 addition & 0 deletions src/test/test_bitcoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct TestMemPoolEntryHelper
hadNoDependencies(false), spendsCoinbase(false), sigOpCount(1) { }

CTxMemPoolEntry FromTx(CMutableTransaction &tx, CTxMemPool *pool = NULL);
CTxMemPoolEntry FromTx(CTransaction &tx, CTxMemPool *pool = NULL);

// Change the default value
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
Expand Down

0 comments on commit f4f8f14

Please sign in to comment.