14 #include <boost/test/unit_test.hpp> 26 std::vector<CAmount> feeV;
30 for (
int j = 0; j < 10; j++) {
31 feeV.push_back(basefee * (j+1));
38 std::vector<uint256> txHashes[10];
42 for (
unsigned int i = 0; i < 128; i++)
46 tx.
vin[0].scriptSig = garbage;
48 tx.
vout[0].nValue=0LL;
52 std::vector<CTransactionRef> block;
58 while (blocknum < 200) {
59 for (
int j = 0; j < 10; j++) {
60 for (
int k = 0;
k < 4;
k++) {
61 tx.
vin[0].prevout.n = 10000*blocknum+100*j+
k;
64 txHashes[j].push_back(hash);
68 for (
int h = 0; h <= blocknum%10; h++) {
72 while (txHashes[9-h].size()) {
76 txHashes[9-h].pop_back();
92 std::vector<CAmount> origFeeEst;
99 for (
int i = 1; i < 10;i++) {
111 for (
int i = 10; i <= 48; i++) {
117 while (blocknum < 250)
121 for (
int i = 2; i < 10;i++) {
129 while (blocknum < 265) {
130 for (
int j = 0; j < 10; j++) {
131 for (
int k = 0;
k < 4;
k++) {
132 tx.
vin[0].prevout.n = 10000*blocknum+100*j+
k;
135 txHashes[j].push_back(hash);
141 for (
int i = 1; i < 10;i++) {
147 for (
int j = 0; j < 10; j++) {
148 while(txHashes[j].size()) {
151 block.push_back(ptx);
152 txHashes[j].pop_back();
158 for (
int i = 2; i < 10;i++) {
164 while (blocknum < 665) {
165 for (
int j = 0; j < 10; j++) {
166 for (
int k = 0;
k < 4;
k++) {
167 tx.
vin[0].prevout.n = 10000*blocknum+100*j+
k;
172 block.push_back(ptx);
180 for (
int i = 2; i < 9; i++) {
std::shared_ptr< const CTransaction > CTransactionRef
Testing setup that performs all steps up until right before ChainstateManager gets initialized...
CFeeRate estimateFee(int confTarget) const EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator)
DEPRECATED.
TestMemPoolEntryHelper & Fee(CAmount _fee)
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
CTxMemPoolEntry FromTx(const CMutableTransaction &tx) const
std::unique_ptr< CTxMemPool > mempool
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void addUnchecked(const CTxMemPoolEntry &entry, bool validFeeEstimate=true) EXCLUSIVE_LOCKS_REQUIRED(cs
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transa...
int64_t CAmount
Amount in satoshis (Can be negative)
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
void push_back(const T &value)
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
BOOST_AUTO_TEST_SUITE_END()
std::vector< CTxOut > vout
TestMemPoolEntryHelper & Height(unsigned int _height)
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
Serialized script, used inside transaction inputs and outputs.
TestMemPoolEntryHelper & Time(NodeSeconds tp)
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
A mutable version of CTransaction.
CTransactionRef get(const uint256 &hash) const
The basic transaction that is broadcasted on the network and contained in blocks. ...
BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
void removeForBlock(const std::vector< CTransactionRef > &vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs)
Called when a block is connected.
CAmount GetFeePerK() const
Return the fee in satoshis for a vsize of 1000 vbytes.
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
#define Assert(val)
Identity function.
#define BOOST_CHECK(expr)