@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
56
56
57
57
// Without any coins in the cache, we shouldn't need to flush.
58
58
BOOST_CHECK_EQUAL (
59
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
59
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
60
60
CoinsCacheSizeState::OK);
61
61
62
62
// If the initial memory allocations of cacheCoins don't match these common
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
71
71
}
72
72
73
73
BOOST_CHECK_EQUAL (
74
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
74
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
75
75
CoinsCacheSizeState::CRITICAL);
76
76
77
77
BOOST_TEST_MESSAGE (" Exiting cache flush tests early due to unsupported arch" );
@@ -92,34 +92,34 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
92
92
print_view_mem_usage (view);
93
93
BOOST_CHECK_EQUAL (view.AccessCoin (res).DynamicMemoryUsage (), COIN_SIZE);
94
94
BOOST_CHECK_EQUAL (
95
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
95
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
96
96
CoinsCacheSizeState::OK);
97
97
}
98
98
99
99
// Adding some additional coins will push us over the edge to CRITICAL.
100
100
for (int i{0 }; i < 4 ; ++i) {
101
101
add_coin (view);
102
102
print_view_mem_usage (view);
103
- if (chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ) ==
103
+ if (chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ) ==
104
104
CoinsCacheSizeState::CRITICAL) {
105
105
break ;
106
106
}
107
107
}
108
108
109
109
BOOST_CHECK_EQUAL (
110
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
110
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 0 ),
111
111
CoinsCacheSizeState::CRITICAL);
112
112
113
113
// Passing non-zero max mempool usage should allow us more headroom.
114
114
BOOST_CHECK_EQUAL (
115
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 1 << 10 ),
115
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 1 << 10 ),
116
116
CoinsCacheSizeState::OK);
117
117
118
118
for (int i{0 }; i < 3 ; ++i) {
119
119
add_coin (view);
120
120
print_view_mem_usage (view);
121
121
BOOST_CHECK_EQUAL (
122
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 1 << 10 ),
122
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, /* max_mempool_size_bytes*/ 1 << 10 ),
123
123
CoinsCacheSizeState::OK);
124
124
}
125
125
@@ -135,31 +135,31 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
135
135
BOOST_CHECK (usage_percentage >= 0.9 );
136
136
BOOST_CHECK (usage_percentage < 1 );
137
137
BOOST_CHECK_EQUAL (
138
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, 1 << 10 ),
138
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, 1 << 10 ),
139
139
CoinsCacheSizeState::LARGE);
140
140
}
141
141
142
142
// Using the default max_* values permits way more coins to be added.
143
143
for (int i{0 }; i < 1000 ; ++i) {
144
144
add_coin (view);
145
145
BOOST_CHECK_EQUAL (
146
- chainstate.GetCoinsCacheSizeState (tx_pool),
146
+ chainstate.GetCoinsCacheSizeState (& tx_pool),
147
147
CoinsCacheSizeState::OK);
148
148
}
149
149
150
150
// Flushing the view doesn't take us back to OK because cacheCoins has
151
151
// preallocated memory that doesn't get reclaimed even after flush.
152
152
153
153
BOOST_CHECK_EQUAL (
154
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, 0 ),
154
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, 0 ),
155
155
CoinsCacheSizeState::CRITICAL);
156
156
157
157
view.SetBestBlock (InsecureRand256 ());
158
158
BOOST_CHECK (view.Flush ());
159
159
print_view_mem_usage (view);
160
160
161
161
BOOST_CHECK_EQUAL (
162
- chainstate.GetCoinsCacheSizeState (tx_pool, MAX_COINS_CACHE_BYTES, 0 ),
162
+ chainstate.GetCoinsCacheSizeState (& tx_pool, MAX_COINS_CACHE_BYTES, 0 ),
163
163
CoinsCacheSizeState::CRITICAL);
164
164
}
165
165
0 commit comments