Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
| Show First 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | void TestChain100Setup::MockMempoolMinFee(const CFeeRate &target_feerate) { | ||||
| LOCK2(cs_main, m_node.mempool->cs); | LOCK2(cs_main, m_node.mempool->cs); | ||||
| // Transactions in the mempool will affect the new minimum feerate. | // Transactions in the mempool will affect the new minimum feerate. | ||||
| assert(m_node.mempool->size() == 0); | assert(m_node.mempool->size() == 0); | ||||
| // The target feerate cannot be too low... | // The target feerate cannot be too low... | ||||
| // ...otherwise the transaction's feerate will need to be negative. | // ...otherwise the transaction's feerate will need to be negative. | ||||
| assert(target_feerate > MEMPOOL_FULL_FEE_INCREMENT); | assert(target_feerate > MEMPOOL_FULL_FEE_INCREMENT); | ||||
| // ...otherwise this is not meaningful. The feerate policy uses the maximum | // ...otherwise this is not meaningful. The feerate policy uses the maximum | ||||
| // of both feerates. | // of both feerates. | ||||
| assert(target_feerate > m_node.mempool->m_min_relay_feerate); | assert(target_feerate > m_node.mempool->m_opts.min_relay_feerate); | ||||
| // Manually create an invalid transaction. Manually set the fee in the | // Manually create an invalid transaction. Manually set the fee in the | ||||
| // CTxMemPoolEntry to achieve the exact target feerate. | // CTxMemPoolEntry to achieve the exact target feerate. | ||||
| CMutableTransaction mtx = CMutableTransaction(); | CMutableTransaction mtx = CMutableTransaction(); | ||||
| mtx.vin.push_back(CTxIn{COutPoint{TxId{m_rng.rand256()}, 0}}); | mtx.vin.push_back(CTxIn{COutPoint{TxId{m_rng.rand256()}, 0}}); | ||||
| mtx.vout.push_back(CTxOut( | mtx.vout.push_back(CTxOut( | ||||
| 1 * COIN, GetScriptForDestination(ScriptHash(CScript() << OP_TRUE)))); | 1 * COIN, GetScriptForDestination(ScriptHash(CScript() << OP_TRUE)))); | ||||
| const auto tx{MakeTransactionRef(mtx)}; | const auto tx{MakeTransactionRef(mtx)}; | ||||
| ▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines | |||||