Skip to content

Commit f9c9550

Browse files
committed
Incorporate prevout table into store.
1 parent a40b385 commit f9c9550

File tree

7 files changed

+79
-71
lines changed

7 files changed

+79
-71
lines changed

include/bitcoin/database/impl/store.ipp

Lines changed: 48 additions & 40 deletions
Large diffs are not rendered by default.

include/bitcoin/database/settings.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ struct BCD_API settings
8888
/// Caches.
8989
/// -----------------------------------------------------------------------
9090

91+
uint32_t prevout_buckets;
92+
uint64_t prevout_size;
93+
uint16_t prevout_rate;
94+
9195
uint32_t validated_bk_buckets;
9296
uint64_t validated_bk_size;
9397
uint16_t validated_bk_rate;
@@ -109,10 +113,6 @@ struct BCD_API settings
109113

110114
////uint32_t bootstrap_size;
111115
////uint16_t bootstrap_rate;
112-
113-
////uint32_t buffer_buckets;
114-
////uint64_t buffer_size;
115-
////uint16_t buffer_rate;
116116
};
117117

118118
} // namespace database

include/bitcoin/database/store.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ class store
113113
table::strong_tx strong_tx;
114114

115115
/// Caches.
116+
table::prevout prevout;
116117
table::validated_bk validated_bk;
117118
table::validated_tx validated_tx;
118119

119120
/// Optionals.
120121
table::address address;
121122
table::neutrino neutrino;
122123
////table::bootstrap bootstrap;
123-
////table::buffer buffer;
124124

125125
protected:
126126
code open_load(const event_handler& handler) NOEXCEPT;
@@ -185,6 +185,10 @@ class store
185185
/// Caches.
186186
/// -----------------------------------------------------------------------
187187

188+
// record arraymap
189+
Storage prevout_head_;
190+
Storage prevout_body_;
191+
188192
// record hashmap
189193
Storage validated_bk_head_;
190194
Storage validated_bk_body_;
@@ -208,10 +212,6 @@ class store
208212
////Storage bootstrap_head_;
209213
////Storage bootstrap_body_;
210214

211-
////// slab hashmap
212-
////Storage buffer_head_;
213-
////Storage buffer_body_;
214-
215215
/// Locks.
216216
/// -----------------------------------------------------------------------
217217

include/bitcoin/database/tables/table.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ enum class table_t
6464
strong_tx_body,
6565

6666
/// Caches.
67+
prevout_table,
68+
prevout_head,
69+
prevout_body,
6770
validated_bk_table,
6871
validated_bk_head,
6972
validated_bk_body,
@@ -77,13 +80,10 @@ enum class table_t
7780
address_body,
7881
neutrino_table,
7982
neutrino_head,
80-
neutrino_body,
83+
neutrino_body
8184
////bootstrap_table,
8285
////bootstrap_head,
83-
////bootstrap_body,
84-
////buffer_table,
85-
////buffer_head,
86-
////buffer_body,
86+
////bootstrap_body
8787
};
8888

8989
} // namespace database

include/bitcoin/database/tables/tables.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <bitcoin/database/tables/archives/transaction.hpp>
2929
#include <bitcoin/database/tables/archives/txs.hpp>
3030

31+
#include <bitcoin/database/tables/caches/prevout.hpp>
3132
#include <bitcoin/database/tables/caches/validated_bk.hpp>
3233
#include <bitcoin/database/tables/caches/validated_tx.hpp>
3334

@@ -37,7 +38,6 @@
3738
#include <bitcoin/database/tables/optionals/address.hpp>
3839
#include <bitcoin/database/tables/optionals/neutrino.hpp>
3940
////#include <bitcoin/database/tables/optionals/bootstrap.hpp>
40-
////#include <bitcoin/database/tables/optionals/buffer.hpp>
4141

4242
#include <bitcoin/database/tables/context.hpp>
4343
#include <bitcoin/database/tables/event.hpp>

src/settings.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ settings::settings() NOEXCEPT
7575

7676
// Caches.
7777

78+
prevout_buckets{ 100 },
79+
prevout_size{ 1 },
80+
prevout_rate{ 50 },
81+
7882
validated_bk_buckets{ 100 },
7983
validated_bk_size{ 1 },
8084
validated_bk_rate{ 50 },
@@ -93,14 +97,8 @@ settings::settings() NOEXCEPT
9397
neutrino_size{ 1 },
9498
neutrino_rate{ 50 }
9599

96-
// Caches.
97-
98100
////bootstrap_size{ 1 },
99-
////bootstrap_rate{ 50 },
100-
101-
////buffer_buckets{ 100 },
102-
////buffer_size{ 1 },
103-
////buffer_rate{ 50 }
101+
////bootstrap_rate{ 50 }
104102
{
105103
}
106104

test/settings.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected)
3939
BOOST_REQUIRE_EQUAL(configuration.output_rate, 50u);
4040
BOOST_REQUIRE_EQUAL(configuration.puts_size, 1u);
4141
BOOST_REQUIRE_EQUAL(configuration.puts_rate, 50u);
42+
BOOST_REQUIRE_EQUAL(configuration.spend_buckets, 100u);
43+
BOOST_REQUIRE_EQUAL(configuration.spend_size, 1u);
44+
BOOST_REQUIRE_EQUAL(configuration.spend_rate, 50u);
4245
BOOST_REQUIRE_EQUAL(configuration.tx_buckets, 100u);
4346
BOOST_REQUIRE_EQUAL(configuration.tx_size, 1u);
4447
BOOST_REQUIRE_EQUAL(configuration.tx_rate, 50u);
@@ -47,35 +50,34 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected)
4750
BOOST_REQUIRE_EQUAL(configuration.txs_rate, 50u);
4851

4952
// Indexes.
50-
BOOST_REQUIRE_EQUAL(configuration.address_buckets, 100u);
51-
BOOST_REQUIRE_EQUAL(configuration.address_size, 1u);
52-
BOOST_REQUIRE_EQUAL(configuration.address_rate, 50u);
5353
BOOST_REQUIRE_EQUAL(configuration.candidate_size, 1u);
5454
BOOST_REQUIRE_EQUAL(configuration.candidate_rate, 50u);
5555
BOOST_REQUIRE_EQUAL(configuration.confirmed_size, 1u);
5656
BOOST_REQUIRE_EQUAL(configuration.confirmed_rate, 50u);
57-
BOOST_REQUIRE_EQUAL(configuration.spend_buckets, 100u);
58-
BOOST_REQUIRE_EQUAL(configuration.spend_size, 1u);
59-
BOOST_REQUIRE_EQUAL(configuration.spend_rate, 50u);
6057
BOOST_REQUIRE_EQUAL(configuration.strong_tx_buckets, 100u);
6158
BOOST_REQUIRE_EQUAL(configuration.strong_tx_size, 1u);
6259
BOOST_REQUIRE_EQUAL(configuration.strong_tx_rate, 50u);
6360

6461
// Caches.
62+
BOOST_REQUIRE_EQUAL(configuration.prevout_buckets, 100u);
63+
BOOST_REQUIRE_EQUAL(configuration.prevout_size, 1u);
64+
BOOST_REQUIRE_EQUAL(configuration.prevout_rate, 50u);
6565
BOOST_REQUIRE_EQUAL(configuration.validated_bk_buckets, 100u);
6666
BOOST_REQUIRE_EQUAL(configuration.validated_bk_size, 1u);
6767
BOOST_REQUIRE_EQUAL(configuration.validated_bk_rate, 50u);
6868
BOOST_REQUIRE_EQUAL(configuration.validated_tx_buckets, 100u);
6969
BOOST_REQUIRE_EQUAL(configuration.validated_tx_size, 1u);
7070
BOOST_REQUIRE_EQUAL(configuration.validated_tx_rate, 50u);
71+
72+
// Optionals.
73+
BOOST_REQUIRE_EQUAL(configuration.address_buckets, 100u);
74+
BOOST_REQUIRE_EQUAL(configuration.address_size, 1u);
75+
BOOST_REQUIRE_EQUAL(configuration.address_rate, 50u);
7176
BOOST_REQUIRE_EQUAL(configuration.neutrino_buckets, 100u);
7277
BOOST_REQUIRE_EQUAL(configuration.neutrino_size, 1u);
7378
BOOST_REQUIRE_EQUAL(configuration.neutrino_rate, 50u);
7479
////BOOST_REQUIRE_EQUAL(configuration.bootstrap_size, 1u);
7580
////BOOST_REQUIRE_EQUAL(configuration.bootstrap_rate, 50u);
76-
////BOOST_REQUIRE_EQUAL(configuration.buffer_buckets, 100u);
77-
////BOOST_REQUIRE_EQUAL(configuration.buffer_size, 1u);
78-
////BOOST_REQUIRE_EQUAL(configuration.buffer_rate, 50u);
7981
}
8082

8183
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)