1919#ifndef LIBBITCOIN_DATABASE_STORE_IPP
2020#define LIBBITCOIN_DATABASE_STORE_IPP
2121
22- #include < algorithm>
23- #include < chrono>
22+ #include < unordered_map>
2423#include < bitcoin/system.hpp>
2524#include < bitcoin/database/boost.hpp>
2625#include < bitcoin/database/define.hpp>
@@ -33,10 +32,6 @@ namespace database {
3332
3433BC_PUSH_WARNING (NO_THROW_IN_NOEXCEPT)
3534
36- // head doesn't guard (performance) and parameter is cast to Link object,
37- // so establish 1 as the minimum value (which also implies disabled).
38- constexpr auto nonzero = 1_u32;
39-
4035// public
4136// ----------------------------------------------------------------------------
4237
@@ -136,7 +131,7 @@ CLASS::store(const settings& config) NOEXCEPT
136131
137132 header_head_ (head(config.path / schema::dir::heads, schema::archive::header)),
138133 header_body_(body(config.path, schema::archive::header), config.header_size, config.header_rate),
139- header(header_head_, header_body_, std::max( config.header_buckets, nonzero) ),
134+ header(header_head_, header_body_, config.header_bits ),
140135
141136 input_head_(head(config.path / schema::dir::heads, schema::archive::input)),
142137 input_body_(body(config.path, schema::archive::input), config.input_size, config.input_rate),
@@ -148,7 +143,7 @@ CLASS::store(const settings& config) NOEXCEPT
148143
149144 point_head_(head(config.path / schema::dir::heads, schema::archive::point)),
150145 point_body_(body(config.path, schema::archive::point), config.point_size, config.point_rate),
151- point(point_head_, point_body_, std::max( config.point_buckets, nonzero) ),
146+ point(point_head_, point_body_, config.point_bits ),
152147
153148 ins_head_(head(config.path / schema::dir::heads, schema::archive::ins)),
154149 ins_body_(body(config.path, schema::archive::ins), config.ins_size, config.ins_rate),
@@ -160,11 +155,11 @@ CLASS::store(const settings& config) NOEXCEPT
160155
161156 tx_head_(head(config.path / schema::dir::heads, schema::archive::tx)),
162157 tx_body_(body(config.path, schema::archive::tx), config.tx_size, config.tx_rate),
163- tx(tx_head_, tx_body_, std::max( config.tx_buckets, nonzero) ),
158+ tx(tx_head_, tx_body_, config.tx_bits ),
164159
165160 txs_head_(head(config.path / schema::dir::heads, schema::archive::txs)),
166161 txs_body_(body(config.path, schema::archive::txs), config.txs_size, config.txs_rate),
167- txs(txs_head_, txs_body_, std::max( config.txs_buckets, nonzero) ),
162+ txs(txs_head_, txs_body_, config.txs_bits ),
168163
169164 // Indexes.
170165 // ------------------------------------------------------------------------
@@ -179,37 +174,33 @@ CLASS::store(const settings& config) NOEXCEPT
179174
180175 strong_tx_head_(head(config.path / schema::dir::heads, schema::indexes::strong_tx)),
181176 strong_tx_body_(body(config.path, schema::indexes::strong_tx), config.strong_tx_size, config.strong_tx_rate),
182- strong_tx(strong_tx_head_, strong_tx_body_, std::max( config.strong_tx_buckets, nonzero) ),
177+ strong_tx(strong_tx_head_, strong_tx_body_, config.strong_tx_bits ),
183178
184179 // Caches.
185180 // ------------------------------------------------------------------------
186181
187182 prevout_head_(head(config.path / schema::dir::heads, schema::caches::prevout)),
188183 prevout_body_(body(config.path, schema::caches::prevout), config.prevout_size, config.prevout_rate),
189- prevout(prevout_head_, prevout_body_, std::max( config.prevout_buckets, nonzero) ),
184+ prevout(prevout_head_, prevout_body_, config.prevout_buckets),
190185
191186 validated_bk_head_(head(config.path / schema::dir::heads, schema::caches::validated_bk)),
192187 validated_bk_body_(body(config.path, schema::caches::validated_bk), config.validated_bk_size, config.validated_bk_rate),
193- validated_bk(validated_bk_head_, validated_bk_body_, std::max( config.validated_bk_buckets, nonzero) ),
188+ validated_bk(validated_bk_head_, validated_bk_body_, config.validated_bk_bits ),
194189
195190 validated_tx_head_(head(config.path / schema::dir::heads, schema::caches::validated_tx)),
196191 validated_tx_body_(body(config.path, schema::caches::validated_tx), config.validated_tx_size, config.validated_tx_rate),
197- validated_tx(validated_tx_head_, validated_tx_body_, std::max( config.validated_tx_buckets, nonzero) ),
192+ validated_tx(validated_tx_head_, validated_tx_body_, config.validated_tx_bits ),
198193
199194 // Optionals.
200195 // ------------------------------------------------------------------------
201196
202197 address_head_(head(config.path / schema::dir::heads, schema::optionals::address)),
203198 address_body_(body(config.path, schema::optionals::address), config.address_size, config.address_rate),
204- address(address_head_, address_body_, std::max( config.address_buckets, nonzero) ),
199+ address(address_head_, address_body_, config.address_bits ),
205200
206201 neutrino_head_(head(config.path / schema::dir::heads, schema::optionals::neutrino)),
207202 neutrino_body_(body(config.path, schema::optionals::neutrino), config.neutrino_size, config.neutrino_rate),
208- neutrino(neutrino_head_, neutrino_body_, std::max(config.neutrino_buckets, nonzero)),
209-
210- // //bootstrap_head_(head(config.path / schema::dir::heads, schema::optionals::bootstrap)),
211- // //bootstrap_body_(body(config.path, schema::optionals::bootstrap), config.bootstrap_size, config.bootstrap_rate),
212- // //bootstrap(bootstrap_head_, bootstrap_body_),
203+ neutrino(neutrino_head_, neutrino_body_, config.neutrino_bits),
213204
214205 // Locks.
215206 // ------------------------------------------------------------------------
0 commit comments