From 3c6bd617b8c8f503d4799fe260d968f4a570db93 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Mon, 12 Oct 2026 21:55:51 -0400 Subject: [PATCH 1/4] Run ci on branch pushes. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d56bac147..65d038021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,8 @@ on: - 'test/**' - 'tools/initchain/**' push: + branches: + - "**" tags-ignore: - "**" paths: From 8337beeed9cc0fccf19782f772747cd361567717 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Mon, 12 Oct 2026 22:45:54 -0400 Subject: [PATCH 2/4] Rename strong_tx table to strong. --- builds/gnu/Makefile.am | 4 +-- .../libbitcoin-database-test.vcxproj | 2 +- .../libbitcoin-database-test.vcxproj.filters | 2 +- .../libbitcoin-database.vcxproj | 2 +- .../libbitcoin-database.vcxproj.filters | 2 +- include/bitcoin/database.hpp | 2 +- .../impl/query/consensus/consensus_strong.ipp | 14 +++++----- .../bitcoin/database/impl/query/extent.ipp | 10 +++---- .../impl/query/navigate/navigate_reverse.ipp | 4 +-- include/bitcoin/database/impl/store/store.ipp | 10 +++---- .../database/impl/store/store_backup.ipp | 2 +- .../database/impl/store/store_close.ipp | 2 +- .../database/impl/store/store_create.ipp | 6 ++-- .../database/impl/store/store_dump.ipp | 2 +- .../database/impl/store/store_open.ipp | 6 ++-- .../database/impl/store/store_open_load.ipp | 8 +++--- .../database/impl/store/store_reload.ipp | 4 +-- .../database/impl/store/store_report.ipp | 10 +++---- .../database/impl/store/store_restore.ipp | 2 +- .../database/impl/store/store_snapshot.ipp | 2 +- .../database/impl/store/store_tables.ipp | 6 ++-- .../impl/store/store_unload_close.ipp | 8 +++--- .../database/impl/unspent/unspent_reader.ipp | 8 +++--- include/bitcoin/database/query.hpp | 10 +++---- include/bitcoin/database/settings.hpp | 2 +- include/bitcoin/database/store.hpp | 6 ++-- include/bitcoin/database/tables/envelope.hpp | 4 +-- .../indexes/{strong_tx.hpp => strong.hpp} | 14 +++++----- include/bitcoin/database/tables/names.hpp | 2 +- include/bitcoin/database/tables/schema.hpp | 4 +-- include/bitcoin/database/tables/table.hpp | 6 ++-- include/bitcoin/database/tables/tables.hpp | 2 +- include/bitcoin/database/types/type.hpp | 2 +- src/tables/envelope.cpp | 10 +++---- test/mocks/chunk_store.hpp | 8 +++--- test/mocks/map_store.hpp | 8 +++--- test/query/extent.cpp | 10 +++---- test/settings.cpp | 10 +++---- test/store/store.cpp | 4 +-- test/tables/envelope.cpp | 4 +-- .../indexes/{strong_tx.cpp => strong.cpp} | 28 +++++++++---------- 41 files changed, 126 insertions(+), 126 deletions(-) rename include/bitcoin/database/tables/indexes/{strong_tx.hpp => strong.hpp} (89%) rename test/tables/indexes/{strong_tx.cpp => strong.cpp} (80%) diff --git a/builds/gnu/Makefile.am b/builds/gnu/Makefile.am index af8f95b57..1018d2beb 100644 --- a/builds/gnu/Makefile.am +++ b/builds/gnu/Makefile.am @@ -330,7 +330,7 @@ include_bitcoin_database_tables_indexes_HEADERS = \ ${srcdir}/../../include/bitcoin/database/tables/indexes/height.hpp \ ${srcdir}/../../include/bitcoin/database/tables/indexes/scan.hpp \ ${srcdir}/../../include/bitcoin/database/tables/indexes/state.hpp \ - ${srcdir}/../../include/bitcoin/database/tables/indexes/strong_tx.hpp \ + ${srcdir}/../../include/bitcoin/database/tables/indexes/strong.hpp \ ${srcdir}/../../include/bitcoin/database/tables/indexes/wtxid.hpp include_bitcoin_database_tables_optionalsdir = \ @@ -503,7 +503,7 @@ test_libbitcoin_database_test_SOURCES = \ ${srcdir}/../../test/tables/indexes/height.cpp \ ${srcdir}/../../test/tables/indexes/scan.cpp \ ${srcdir}/../../test/tables/indexes/state.cpp \ - ${srcdir}/../../test/tables/indexes/strong_tx.cpp \ + ${srcdir}/../../test/tables/indexes/strong.cpp \ ${srcdir}/../../test/tables/indexes/wtxid.cpp \ ${srcdir}/../../test/tables/optional/address.cpp \ ${srcdir}/../../test/tables/optional/filter_bk.cpp \ diff --git a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj index 5b4f67205..956283ba3 100644 --- a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj +++ b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj @@ -218,7 +218,7 @@ - + diff --git a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters index a2a7dcdd6..e33c80000 100644 --- a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters +++ b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters @@ -369,7 +369,7 @@ src\tables\indexes - + src\tables\indexes diff --git a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj index 706bf717b..5c841f064 100644 --- a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj +++ b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj @@ -196,7 +196,7 @@ - + diff --git a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters index 0b618bd38..8f39ddd85 100644 --- a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters +++ b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters @@ -356,7 +356,7 @@ include\bitcoin\database\tables\indexes - + include\bitcoin\database\tables\indexes diff --git a/include/bitcoin/database.hpp b/include/bitcoin/database.hpp index 8a2a7ee8a..438bc068e 100644 --- a/include/bitcoin/database.hpp +++ b/include/bitcoin/database.hpp @@ -86,7 +86,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/bitcoin/database/impl/query/consensus/consensus_strong.ipp b/include/bitcoin/database/impl/query/consensus/consensus_strong.ipp index 68d0c4c91..d0a92f57b 100644 --- a/include/bitcoin/database/impl/query/consensus/consensus_strong.ipp +++ b/include/bitcoin/database/impl/query/consensus/consensus_strong.ipp @@ -110,19 +110,19 @@ bool CLASS::set_strong(const header_link& link, const tx_links& fks, bool positive) NOEXCEPT { using namespace system; - using link_t = table::strong_tx::link; - using element_t = table::strong_tx::record; + using link_t = table::strong::link; + using element_t = table::strong::record; - // Preallocate all strong_tx records for the block and reuse memory ptr. + // Preallocate all strong records for the block and reuse memory ptr. const auto records = possible_narrow_cast(fks.size()); - auto record = store_.strong_tx.allocate(records); - const auto ptr = store_.strong_tx.get_memory(); + auto record = store_.strong.allocate(records); + const auto ptr = store_.strong.get_memory(); for (const auto& fk: fks) - if (!store_.strong_tx.put(ptr, record++, tx_link{ fk }, element_t + if (!store_.strong.put(ptr, record++, tx_link{ fk }, element_t { {}, - table::strong_tx::merge(positive, link) + table::strong::merge(positive, link) })) return false; return true; diff --git a/include/bitcoin/database/impl/query/extent.ipp b/include/bitcoin/database/impl/query/extent.ipp index 8178946dd..618c824a4 100644 --- a/include/bitcoin/database/impl/query/extent.ipp +++ b/include/bitcoin/database/impl/query/extent.ipp @@ -89,7 +89,7 @@ size_t CLASS::store_body_size() const NOEXCEPT return archive_body_size() + candidate_body_size() + confirmed_body_size() - + strong_tx_body_size() + + strong_body_size() + scan_body_size() + scan_prefix_body_size() + ecdsa0_body_size() @@ -132,7 +132,7 @@ size_t CLASS::store_head_size() const NOEXCEPT return archive_head_size() + candidate_head_size() + confirmed_head_size() - + strong_tx_head_size() + + strong_head_size() + scan_head_size() + scan_prefix_head_size() + ecdsa0_head_size() @@ -170,7 +170,7 @@ DEFINE_SIZES(tx) DEFINE_SIZES(candidate) DEFINE_SIZES(confirmed) -DEFINE_SIZES(strong_tx) +DEFINE_SIZES(strong) DEFINE_SIZES(scan) DEFINE_SIZES(scan_prefix) DEFINE_SIZES(ecdsa0) @@ -203,7 +203,7 @@ DEFINE_BUCKETS(outs) DEFINE_BUCKETS(txs) DEFINE_BUCKETS(tx) -DEFINE_BUCKETS(strong_tx) +DEFINE_BUCKETS(strong) DEFINE_BUCKETS(scan) DEFINE_BUCKETS(duplicate) DEFINE_BUCKETS(prevout) @@ -222,7 +222,7 @@ DEFINE_RECORDS(tx) DEFINE_RECORDS(candidate) DEFINE_RECORDS(confirmed) -DEFINE_RECORDS(strong_tx) +DEFINE_RECORDS(strong) DEFINE_RECORDS(scan) DEFINE_RECORDS(scan_prefix) DEFINE_RECORDS(ecdsa0) diff --git a/include/bitcoin/database/impl/query/navigate/navigate_reverse.ipp b/include/bitcoin/database/impl/query/navigate/navigate_reverse.ipp index cecc505ce..a6ab2cbbb 100644 --- a/include/bitcoin/database/impl/query/navigate/navigate_reverse.ipp +++ b/include/bitcoin/database/impl/query/navigate/navigate_reverse.ipp @@ -284,8 +284,8 @@ tx_links CLASS::to_duplicates(const hash_digest& tx_hash) const NOEXCEPT TEMPLATE header_link CLASS::to_block(const tx_link& link) const NOEXCEPT { - table::strong_tx::record strong{}; - if (!store_.strong_tx.find(link, strong) || !strong.positive()) + table::strong::record strong{}; + if (!store_.strong.find(link, strong) || !strong.positive()) return {}; return strong.header_fk(); diff --git a/include/bitcoin/database/impl/store/store.ipp b/include/bitcoin/database/impl/store/store.ipp index 964d05517..e1e4263f2 100644 --- a/include/bitcoin/database/impl/store/store.ipp +++ b/include/bitcoin/database/impl/store/store.ipp @@ -73,8 +73,8 @@ CLASS::store(const settings& config) NOEXCEPT candidate_head_(head(config.path / schema::dir::heads, schema::indexes::candidate), head_settings(config.candidate), sequential), confirmed_head_(head(config.path / schema::dir::heads, schema::indexes::confirmed), head_settings(config.confirmed), sequential), - strong_tx_head_(head(config.path / schema::dir::heads, schema::indexes::strong_tx), head_settings(config.strong_tx), random), - strong_tx_body_(body(config.path, schema::indexes::strong_tx), config.strong_tx, sequential, staged), + strong_head_(head(config.path / schema::dir::heads, schema::indexes::strong), head_settings(config.strong), random), + strong_body_(body(config.path, schema::indexes::strong), config.strong, sequential, staged), scan_head_(head(config.path / schema::dir::heads, schema::indexes::scan), head_settings(config.scan), random), scan_body_(body(config.path, schema::indexes::scan), config.scan, sequential, staged), scan_prefix_head_(head(config.path / schema::dir::heads, schema::indexes::scan_prefix), head_settings(config.scan), sequential), @@ -157,7 +157,7 @@ CLASS::store(const settings& config) NOEXCEPT candidate(candidate_head_), confirmed(confirmed_head_), - strong_tx(strong_tx_head_, strong_tx_body_, config.strong_tx.buckets, config.strong_tx.expected), + strong(strong_head_, strong_body_, config.strong.buckets, config.strong.expected), scan(scan_head_, scan_body_, config.scan.buckets), scan_prefix(scan_prefix_head_, scan_prefix_body_), @@ -193,7 +193,7 @@ CLASS::store(const settings& config) NOEXCEPT envelope_.ins_k = possible_narrow_cast(ins.filter_k()); envelope_.outs_k = possible_narrow_cast(outs.filter_k()); envelope_.tx_k = possible_narrow_cast(tx.filter_k()); - envelope_.strong_tx_k = possible_narrow_cast(strong_tx.filter_k()); + envelope_.strong_k = possible_narrow_cast(strong.filter_k()); envelope_.duplicate_k = possible_narrow_cast(duplicate.filter_k()); envelope_.pool_k = possible_narrow_cast(pool.filter_k()); } @@ -354,7 +354,7 @@ void CLASS::set_current(bool current) NOEXCEPT txs_head_.current(current); candidate_head_.current(current); confirmed_head_.current(current); - strong_tx_head_.current(current); + strong_head_.current(current); scan_head_.current(current); scan_prefix_head_.current(current); ecdsa0_head_.current(current); diff --git a/include/bitcoin/database/impl/store/store_backup.ipp b/include/bitcoin/database/impl/store/store_backup.ipp index 25fb98cab..8097a86d6 100644 --- a/include/bitcoin/database/impl/store/store_backup.ipp +++ b/include/bitcoin/database/impl/store/store_backup.ipp @@ -52,7 +52,7 @@ code CLASS::backup(const event_handler& handler, bool prune) NOEXCEPT backup(ec, candidate, table_t::candidate_table); backup(ec, confirmed, table_t::confirmed_table); - backup(ec, strong_tx, table_t::strong_tx_table); + backup(ec, strong, table_t::strong_table); backup(ec, scan, table_t::scan_table); backup(ec, scan_prefix, table_t::scan_prefix_table); diff --git a/include/bitcoin/database/impl/store/store_close.ipp b/include/bitcoin/database/impl/store/store_close.ipp index 930ee459f..e61e01236 100644 --- a/include/bitcoin/database/impl/store/store_close.ipp +++ b/include/bitcoin/database/impl/store/store_close.ipp @@ -56,7 +56,7 @@ code CLASS::close(const event_handler& handler) NOEXCEPT close(ec, candidate, table_t::candidate_table); close(ec, confirmed, table_t::confirmed_table); - close(ec, strong_tx, table_t::strong_tx_table); + close(ec, strong, table_t::strong_table); close(ec, scan, table_t::scan_table); close(ec, scan_prefix, table_t::scan_prefix_table); diff --git a/include/bitcoin/database/impl/store/store_create.ipp b/include/bitcoin/database/impl/store/store_create.ipp index 55c5d93c6..d0a8c2b93 100644 --- a/include/bitcoin/database/impl/store/store_create.ipp +++ b/include/bitcoin/database/impl/store/store_create.ipp @@ -96,8 +96,8 @@ code CLASS::create_load(const event_handler& handler) NOEXCEPT create(ec, candidate_head_, table_t::candidate_head); create(ec, confirmed_head_, table_t::confirmed_head); - create(ec, strong_tx_head_, table_t::strong_tx_head); - create(ec, strong_tx_body_, table_t::strong_tx_body); + create(ec, strong_head_, table_t::strong_head); + create(ec, strong_body_, table_t::strong_body); create(ec, scan_head_, table_t::scan_head); create(ec, scan_body_, table_t::scan_body); create(ec, scan_prefix_head_, table_t::scan_prefix_head); @@ -169,7 +169,7 @@ code CLASS::create_load(const event_handler& handler) NOEXCEPT populate(ec, candidate, table_t::candidate_table); populate(ec, confirmed, table_t::confirmed_table); - populate(ec, strong_tx, table_t::strong_tx_table); + populate(ec, strong, table_t::strong_table); populate(ec, scan, table_t::scan_table); populate(ec, scan_prefix, table_t::scan_prefix_table); diff --git a/include/bitcoin/database/impl/store/store_dump.ipp b/include/bitcoin/database/impl/store/store_dump.ipp index 914fddbc3..ee30d32b7 100644 --- a/include/bitcoin/database/impl/store/store_dump.ipp +++ b/include/bitcoin/database/impl/store/store_dump.ipp @@ -52,7 +52,7 @@ code CLASS::dump(const path& folder, dump(ec, candidate_head_, schema::indexes::candidate, table_t::candidate_head); dump(ec, confirmed_head_, schema::indexes::confirmed, table_t::confirmed_head); - dump(ec, strong_tx_head_, schema::indexes::strong_tx, table_t::strong_tx_head); + dump(ec, strong_head_, schema::indexes::strong, table_t::strong_head); dump(ec, scan_head_, schema::indexes::scan, table_t::scan_head); dump(ec, scan_prefix_head_, schema::indexes::scan_prefix, table_t::scan_prefix_head); diff --git a/include/bitcoin/database/impl/store/store_open.ipp b/include/bitcoin/database/impl/store/store_open.ipp index 17fb844fd..c7d21c2b3 100644 --- a/include/bitcoin/database/impl/store/store_open.ipp +++ b/include/bitcoin/database/impl/store/store_open.ipp @@ -74,7 +74,7 @@ code CLASS::open(const event_handler& handler) NOEXCEPT verify(ec, candidate, table_t::candidate_table); verify(ec, confirmed, table_t::confirmed_table); - verify(ec, strong_tx, table_t::strong_tx_table); + verify(ec, strong, table_t::strong_table); verify(ec, scan, table_t::scan_table); verify(ec, scan_prefix, table_t::scan_prefix_table); @@ -210,7 +210,7 @@ code CLASS::load_envelope() NOEXCEPT !ins.set_buckets(envelope_.ins_buckets) || !outs.set_buckets(envelope_.outs_buckets) || !tx.set_buckets(envelope_.tx_buckets) || - !strong_tx.set_buckets(envelope_.strong_tx_buckets) || + !strong.set_buckets(envelope_.strong_buckets) || !duplicate.set_buckets(envelope_.duplicate_buckets) || !pool.set_buckets(envelope_.pool_buckets) || !wtxid.set_buckets(envelope_.pool_buckets)) @@ -223,7 +223,7 @@ code CLASS::load_envelope() NOEXCEPT !ins.set_filter_k(envelope_.ins_k) || !outs.set_filter_k(envelope_.outs_k) || !tx.set_filter_k(envelope_.tx_k) || - !strong_tx.set_filter_k(envelope_.strong_tx_k) || + !strong.set_filter_k(envelope_.strong_k) || !duplicate.set_filter_k(envelope_.duplicate_k) || !pool.set_filter_k(envelope_.pool_k) || !wtxid.set_filter_k(envelope_.pool_k)) diff --git a/include/bitcoin/database/impl/store/store_open_load.ipp b/include/bitcoin/database/impl/store/store_open_load.ipp index 7c1f9c0e8..16900737f 100644 --- a/include/bitcoin/database/impl/store/store_open_load.ipp +++ b/include/bitcoin/database/impl/store/store_open_load.ipp @@ -80,8 +80,8 @@ code CLASS::open_load(const event_handler& handler) NOEXCEPT open(ec, candidate_head_, table_t::candidate_head); open(ec, confirmed_head_, table_t::confirmed_head); - open(ec, strong_tx_head_, table_t::strong_tx_head); - open(ec, strong_tx_body_, table_t::strong_tx_body); + open(ec, strong_head_, table_t::strong_head); + open(ec, strong_body_, table_t::strong_body); open(ec, scan_head_, table_t::scan_head); open(ec, scan_body_, table_t::scan_body); open(ec, scan_prefix_head_, table_t::scan_prefix_head); @@ -145,8 +145,8 @@ code CLASS::open_load(const event_handler& handler) NOEXCEPT load(ec, candidate_head_, table_t::candidate_head); load(ec, confirmed_head_, table_t::confirmed_head); - load(ec, strong_tx_head_, table_t::strong_tx_head); - load(ec, strong_tx_body_, table_t::strong_tx_body); + load(ec, strong_head_, table_t::strong_head); + load(ec, strong_body_, table_t::strong_body); load(ec, scan_head_, table_t::scan_head); load(ec, scan_body_, table_t::scan_body); load(ec, scan_prefix_head_, table_t::scan_prefix_head); diff --git a/include/bitcoin/database/impl/store/store_reload.ipp b/include/bitcoin/database/impl/store/store_reload.ipp index 831b6371b..4af834134 100644 --- a/include/bitcoin/database/impl/store/store_reload.ipp +++ b/include/bitcoin/database/impl/store/store_reload.ipp @@ -70,8 +70,8 @@ code CLASS::reload(const event_handler& handler) NOEXCEPT reload(ec, candidate_head_, table_t::candidate_head); reload(ec, confirmed_head_, table_t::confirmed_head); - reload(ec, strong_tx_head_, table_t::strong_tx_head); - reload(ec, strong_tx_body_, table_t::strong_tx_body); + reload(ec, strong_head_, table_t::strong_head); + reload(ec, strong_body_, table_t::strong_body); reload(ec, scan_head_, table_t::scan_head); reload(ec, scan_body_, table_t::scan_body); reload(ec, scan_prefix_head_, table_t::scan_prefix_head); diff --git a/include/bitcoin/database/impl/store/store_report.ipp b/include/bitcoin/database/impl/store/store_report.ipp index 87a8cb247..f8d8e400c 100644 --- a/include/bitcoin/database/impl/store/store_report.ipp +++ b/include/bitcoin/database/impl/store/store_report.ipp @@ -48,7 +48,7 @@ void CLASS::report(const error_handler& handler) const NOEXCEPT report(*outs_body_, table_t::outs_body); report(tx_body_, table_t::tx_body); report(txs_body_, table_t::txs_body); - report(strong_tx_body_, table_t::strong_tx_body); + report(strong_body_, table_t::strong_body); report(scan_body_, table_t::scan_body); report(scan_prefix_body_, table_t::scan_prefix_body); report(ecdsa0_body_, table_t::ecdsa0_body); @@ -93,8 +93,8 @@ code CLASS::get_fault() const NOEXCEPT if ((ec = txs_body_.get_fault())) return ec; if ((ec = candidate_head_.get_fault())) return ec; if ((ec = confirmed_head_.get_fault())) return ec; - if ((ec = strong_tx_head_.get_fault())) return ec; - if ((ec = strong_tx_body_.get_fault())) return ec; + if ((ec = strong_head_.get_fault())) return ec; + if ((ec = strong_body_.get_fault())) return ec; if ((ec = scan_head_.get_fault())) return ec; if ((ec = scan_body_.get_fault())) return ec; if ((ec = scan_prefix_head_.get_fault())) return ec; @@ -168,8 +168,8 @@ size_t CLASS::get_space() const NOEXCEPT space(txs_body_); space(candidate_head_); space(confirmed_head_); - space(strong_tx_head_); - space(strong_tx_body_); + space(strong_head_); + space(strong_body_); space(scan_head_); space(scan_body_); space(scan_prefix_head_); diff --git a/include/bitcoin/database/impl/store/store_restore.ipp b/include/bitcoin/database/impl/store/store_restore.ipp index 7e05bf84a..7a06debdb 100644 --- a/include/bitcoin/database/impl/store/store_restore.ipp +++ b/include/bitcoin/database/impl/store/store_restore.ipp @@ -137,7 +137,7 @@ code CLASS::restore(const event_handler& handler) NOEXCEPT restore(ec, candidate, table_t::candidate_table); restore(ec, confirmed, table_t::confirmed_table); - restore(ec, strong_tx, table_t::strong_tx_table); + restore(ec, strong, table_t::strong_table); restore(ec, scan, table_t::scan_table); restore(ec, scan_prefix, table_t::scan_prefix_table); diff --git a/include/bitcoin/database/impl/store/store_snapshot.ipp b/include/bitcoin/database/impl/store/store_snapshot.ipp index c945c573b..0d2689a93 100644 --- a/include/bitcoin/database/impl/store/store_snapshot.ipp +++ b/include/bitcoin/database/impl/store/store_snapshot.ipp @@ -53,7 +53,7 @@ code CLASS::snapshot(const event_handler& handler, bool prune) NOEXCEPT flush(ec, tx_body_, table_t::tx_body); flush(ec, txs_body_, table_t::txs_body); - flush(ec, strong_tx_body_, table_t::strong_tx_body); + flush(ec, strong_body_, table_t::strong_body); flush(ec, scan_body_, table_t::scan_body); flush(ec, scan_prefix_body_, table_t::scan_prefix_body); diff --git a/include/bitcoin/database/impl/store/store_tables.ipp b/include/bitcoin/database/impl/store/store_tables.ipp index 4fdadf3e4..19c6bde5c 100644 --- a/include/bitcoin/database/impl/store/store_tables.ipp +++ b/include/bitcoin/database/impl/store/store_tables.ipp @@ -57,9 +57,9 @@ const CLASS::table_map CLASS::tables { table_t::candidate_head, "candidate_head" }, { table_t::confirmed_table, "confirmed_table" }, { table_t::confirmed_head, "confirmed_head" }, - { table_t::strong_tx_table, "strong_tx_table" }, - { table_t::strong_tx_head, "strong_tx_head" }, - { table_t::strong_tx_body, "strong_tx_body" }, + { table_t::strong_table, "strong_table" }, + { table_t::strong_head, "strong_head" }, + { table_t::strong_body, "strong_body" }, { table_t::scan_table, "scan_table" }, { table_t::scan_head, "scan_head" }, { table_t::scan_body, "scan_body" }, diff --git a/include/bitcoin/database/impl/store/store_unload_close.ipp b/include/bitcoin/database/impl/store/store_unload_close.ipp index b534b58f8..cc88e6f18 100644 --- a/include/bitcoin/database/impl/store/store_unload_close.ipp +++ b/include/bitcoin/database/impl/store/store_unload_close.ipp @@ -57,8 +57,8 @@ code CLASS::unload_close(const event_handler& handler) NOEXCEPT unload(ec, candidate_head_, table_t::candidate_head); unload(ec, confirmed_head_, table_t::confirmed_head); - unload(ec, strong_tx_head_, table_t::strong_tx_head); - unload(ec, strong_tx_body_, table_t::strong_tx_body); + unload(ec, strong_head_, table_t::strong_head); + unload(ec, strong_body_, table_t::strong_body); unload(ec, scan_head_, table_t::scan_head); unload(ec, scan_body_, table_t::scan_body); unload(ec, scan_prefix_head_, table_t::scan_prefix_head); @@ -132,8 +132,8 @@ code CLASS::unload_close(const event_handler& handler) NOEXCEPT close(ec, candidate_head_, table_t::candidate_head); close(ec, confirmed_head_, table_t::confirmed_head); - close(ec, strong_tx_head_, table_t::strong_tx_head); - close(ec, strong_tx_body_, table_t::strong_tx_body); + close(ec, strong_head_, table_t::strong_head); + close(ec, strong_body_, table_t::strong_body); close(ec, scan_head_, table_t::scan_head); close(ec, scan_body_, table_t::scan_body); close(ec, scan_prefix_head_, table_t::scan_prefix_head); diff --git a/include/bitcoin/database/impl/unspent/unspent_reader.ipp b/include/bitcoin/database/impl/unspent/unspent_reader.ipp index af420e9d6..821471ea6 100644 --- a/include/bitcoin/database/impl/unspent/unspent_reader.ipp +++ b/include/bitcoin/database/impl/unspent/unspent_reader.ipp @@ -241,16 +241,16 @@ code CLASS::read_blocks(header_links& out, auto block = header_link::terminal; out.resize(parents.size()); - const auto ptr = store_.strong_tx.get_memory(); + const auto ptr = store_.strong.get_memory(); for (size_t at{}; at < parents.size(); ++at) { if (parents.at(at) != parent) { parent = parents.at(at); - const auto fk = store_.strong_tx.first(ptr, parent); + const auto fk = store_.strong.first(ptr, parent); - table::strong_tx::record strong{}; - if (!store_.strong_tx.get(ptr, fk, strong) || !strong.positive()) + table::strong::record strong{}; + if (!store_.strong.get(ptr, fk, strong) || !strong.positive()) return error::branch_inactive; block = strong.header_fk(); diff --git a/include/bitcoin/database/query.hpp b/include/bitcoin/database/query.hpp index 622b364f8..08d0e9c27 100644 --- a/include/bitcoin/database/query.hpp +++ b/include/bitcoin/database/query.hpp @@ -144,7 +144,7 @@ class query size_t candidate_head_size() const NOEXCEPT; size_t confirmed_head_size() const NOEXCEPT; - size_t strong_tx_head_size() const NOEXCEPT; + size_t strong_head_size() const NOEXCEPT; size_t scan_head_size() const NOEXCEPT; size_t scan_prefix_head_size() const NOEXCEPT; size_t ecdsa0_head_size() const NOEXCEPT; @@ -179,7 +179,7 @@ class query size_t candidate_body_size() const NOEXCEPT; size_t confirmed_body_size() const NOEXCEPT; - size_t strong_tx_body_size() const NOEXCEPT; + size_t strong_body_size() const NOEXCEPT; size_t scan_body_size() const NOEXCEPT; size_t scan_prefix_body_size() const NOEXCEPT; size_t ecdsa0_body_size() const NOEXCEPT; @@ -214,7 +214,7 @@ class query size_t candidate_size() const NOEXCEPT; size_t confirmed_size() const NOEXCEPT; - size_t strong_tx_size() const NOEXCEPT; + size_t strong_size() const NOEXCEPT; size_t scan_size() const NOEXCEPT; size_t scan_prefix_size() const NOEXCEPT; size_t ecdsa0_size() const NOEXCEPT; @@ -245,7 +245,7 @@ class query size_t txs_buckets() const NOEXCEPT; size_t tx_buckets() const NOEXCEPT; - size_t strong_tx_buckets() const NOEXCEPT; + size_t strong_buckets() const NOEXCEPT; size_t scan_buckets() const NOEXCEPT; size_t duplicate_buckets() const NOEXCEPT; size_t prevout_buckets() const NOEXCEPT; @@ -262,7 +262,7 @@ class query size_t candidate_records() const NOEXCEPT; size_t confirmed_records() const NOEXCEPT; - size_t strong_tx_records() const NOEXCEPT; + size_t strong_records() const NOEXCEPT; size_t scan_records() const NOEXCEPT; size_t scan_prefix_records() const NOEXCEPT; size_t ecdsa0_records() const NOEXCEPT; diff --git a/include/bitcoin/database/settings.hpp b/include/bitcoin/database/settings.hpp index 796ee209b..a36ad9de5 100644 --- a/include/bitcoin/database/settings.hpp +++ b/include/bitcoin/database/settings.hpp @@ -104,7 +104,7 @@ struct BCD_API settings bucket_table candidate{}; bucket_table confirmed{}; - hash_table strong_tx{}; + hash_table strong{}; bucket_table scan{}; /// Caches. diff --git a/include/bitcoin/database/store.hpp b/include/bitcoin/database/store.hpp index 83f3394d6..f70cb5cb9 100644 --- a/include/bitcoin/database/store.hpp +++ b/include/bitcoin/database/store.hpp @@ -220,8 +220,8 @@ class store Storage confirmed_head_; // record hashmap - Storage strong_tx_head_; - Storage strong_tx_body_; + Storage strong_head_; + Storage strong_body_; Storage scan_head_; table::scan_storage scan_body_; Storage scan_prefix_head_; @@ -370,7 +370,7 @@ class store /// Indexes. table::height candidate; table::height confirmed; - table::strong_tx strong_tx; + table::strong strong; table::scan scan; table::scan_prefix scan_prefix; diff --git a/include/bitcoin/database/tables/envelope.hpp b/include/bitcoin/database/tables/envelope.hpp index 6260cecdf..5e23fba66 100644 --- a/include/bitcoin/database/tables/envelope.hpp +++ b/include/bitcoin/database/tables/envelope.hpp @@ -86,14 +86,14 @@ struct BCD_API envelope uint32_t ins_buckets{}; uint32_t outs_buckets{}; uint32_t tx_buckets{}; - uint32_t strong_tx_buckets{}; + uint32_t strong_buckets{}; uint32_t duplicate_buckets{}; uint32_t pool_buckets{}; uint8_t header_k{}; uint8_t ins_k{}; uint8_t outs_k{}; uint8_t tx_k{}; - uint8_t strong_tx_k{}; + uint8_t strong_k{}; uint8_t duplicate_k{}; uint8_t pool_k{}; diff --git a/include/bitcoin/database/tables/indexes/strong_tx.hpp b/include/bitcoin/database/tables/indexes/strong.hpp similarity index 89% rename from include/bitcoin/database/tables/indexes/strong_tx.hpp rename to include/bitcoin/database/tables/indexes/strong.hpp index ad1552bf1..78e946427 100644 --- a/include/bitcoin/database/tables/indexes/strong_tx.hpp +++ b/include/bitcoin/database/tables/indexes/strong.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_TX_HPP -#define LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_TX_HPP +#ifndef LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_HPP +#define LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_HPP #include #include @@ -27,12 +27,12 @@ namespace libbitcoin { namespace database { namespace table { -/// strong_tx is a record hashmap of tx confirmation state. -struct strong_tx - : public hash_map +/// strong is a record hashmap of tx confirmation state. +struct strong + : public hash_map { using header = schema::header::link; - using hash_map::hashmap; + using hash_map::hashmap; static constexpr auto offset = header::bits; static_assert(offset < to_bits(header::size)); @@ -45,7 +45,7 @@ struct strong_tx } struct record - : public schema::strong_tx + : public schema::strong { inline bool positive() const NOEXCEPT { diff --git a/include/bitcoin/database/tables/names.hpp b/include/bitcoin/database/tables/names.hpp index c958fd0b1..52e80f593 100644 --- a/include/bitcoin/database/tables/names.hpp +++ b/include/bitcoin/database/tables/names.hpp @@ -62,7 +62,7 @@ namespace indexes constexpr auto confirmed = "index_confirmed"; constexpr auto duplicate = "index_duplicate"; constexpr auto state = "index_state"; - constexpr auto strong_tx = "index_strong"; + constexpr auto strong = "index_strong"; constexpr auto wtxid = "index_wtxid"; } diff --git a/include/bitcoin/database/tables/schema.hpp b/include/bitcoin/database/tables/schema.hpp index 838755422..3d524e7ac 100644 --- a/include/bitcoin/database/tables/schema.hpp +++ b/include/bitcoin/database/tables/schema.hpp @@ -101,7 +101,7 @@ struct header { static constexpr size_t sk = schema::hash; static constexpr size_t pk = schema::block; - using link = linkage; // reduced for strong_tx merge. + using link = linkage; // reduced for strong merge. using key = system::data_array; static constexpr size_t minsize = schema::flags + // context.flags @@ -310,7 +310,7 @@ struct height }; // record hashmap -struct strong_tx +struct strong { static constexpr size_t sk = schema::transaction::pk; static constexpr size_t pk = schema::transaction::pk; diff --git a/include/bitcoin/database/tables/table.hpp b/include/bitcoin/database/tables/table.hpp index c4ea687e3..d60fb56fd 100644 --- a/include/bitcoin/database/tables/table.hpp +++ b/include/bitcoin/database/tables/table.hpp @@ -56,9 +56,9 @@ enum class table_t candidate_head, confirmed_table, confirmed_head, - strong_tx_table, - strong_tx_head, - strong_tx_body, + strong_table, + strong_head, + strong_body, scan_table, scan_head, scan_body, diff --git a/include/bitcoin/database/tables/tables.hpp b/include/bitcoin/database/tables/tables.hpp index 15326612b..9cb68db17 100644 --- a/include/bitcoin/database/tables/tables.hpp +++ b/include/bitcoin/database/tables/tables.hpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/bitcoin/database/types/type.hpp b/include/bitcoin/database/types/type.hpp index e05a3a339..12ebd7315 100644 --- a/include/bitcoin/database/types/type.hpp +++ b/include/bitcoin/database/types/type.hpp @@ -40,7 +40,7 @@ using outs_link = table::outs::link; using ins_link = table::ins::link; using tx_link = table::transaction::link; using filter_link = table::filter_tx::link; -using strong_link = table::strong_tx::link; +using strong_link = table::strong::link; using ecdsa_link = table::ecdsa_correlate::link; using schnorr_link = table::schnorr_correlate::link; using scan_link = table::scan_correlate::link; diff --git a/src/tables/envelope.cpp b/src/tables/envelope.cpp index e1bfb597e..80b5660c7 100644 --- a/src/tables/envelope.cpp +++ b/src/tables/envelope.cpp @@ -47,7 +47,7 @@ void envelope::set(const settings& database) NOEXCEPT ins_buckets = database.ins.buckets; outs_buckets = database.outs.buckets; tx_buckets = database.tx.buckets; - strong_tx_buckets = database.strong_tx.buckets; + strong_buckets = database.strong.buckets; duplicate_buckets = database.duplicate.buckets; pool_buckets = database.pool.buckets; provide_filters = to_bool(database.filter_bk.buckets) && @@ -176,14 +176,14 @@ bool envelope::from_data(reader& source) NOEXCEPT ins_buckets = source.read_little_endian(); outs_buckets = source.read_little_endian(); tx_buckets = source.read_little_endian(); - strong_tx_buckets = source.read_little_endian(); + strong_buckets = source.read_little_endian(); duplicate_buckets = source.read_little_endian(); pool_buckets = source.read_little_endian(); header_k = source.read_byte(); ins_k = source.read_byte(); outs_k = source.read_byte(); tx_k = source.read_byte(); - strong_tx_k = source.read_byte(); + strong_k = source.read_byte(); duplicate_k = source.read_byte(); pool_k = source.read_byte(); @@ -270,14 +270,14 @@ bool envelope::to_data(flipper& sink) const NOEXCEPT sink.write_little_endian(ins_buckets); sink.write_little_endian(outs_buckets); sink.write_little_endian(tx_buckets); - sink.write_little_endian(strong_tx_buckets); + sink.write_little_endian(strong_buckets); sink.write_little_endian(duplicate_buckets); sink.write_little_endian(pool_buckets); sink.write_byte(header_k); sink.write_byte(ins_k); sink.write_byte(outs_k); sink.write_byte(tx_k); - sink.write_byte(strong_tx_k); + sink.write_byte(strong_k); sink.write_byte(duplicate_k); sink.write_byte(pool_k); diff --git a/test/mocks/chunk_store.hpp b/test/mocks/chunk_store.hpp index dca7b09d9..ea6ffb87f 100644 --- a/test/mocks/chunk_store.hpp +++ b/test/mocks/chunk_store.hpp @@ -128,14 +128,14 @@ class chunk_store return confirmed_head_.buffer(); } - system::data_chunk& strong_tx_head() NOEXCEPT + system::data_chunk& strong_head() NOEXCEPT { - return strong_tx_head_.buffer(); + return strong_head_.buffer(); } - system::data_chunk& strong_tx_body() NOEXCEPT + system::data_chunk& strong_body() NOEXCEPT { - return strong_tx_body_.buffer(); + return strong_body_.buffer(); } // Caches. diff --git a/test/mocks/map_store.hpp b/test/mocks/map_store.hpp index 632df614e..d8d4c5ff8 100644 --- a/test/mocks/map_store.hpp +++ b/test/mocks/map_store.hpp @@ -159,14 +159,14 @@ class map_store return confirmed_head_.file(); } - inline const path& strong_tx_head_file() const NOEXCEPT + inline const path& strong_head_file() const NOEXCEPT { - return strong_tx_head_.file(); + return strong_head_.file(); } - inline const path& strong_tx_body_file() const NOEXCEPT + inline const path& strong_body_file() const NOEXCEPT { - return strong_tx_body_.file(); + return strong_body_.file(); } inline const path& duplicate_head_file() const NOEXCEPT diff --git a/test/query/extent.cpp b/test/query/extent.cpp index 11dcc8630..1d1bbfa8c 100644 --- a/test/query/extent.cpp +++ b/test/query/extent.cpp @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(query_extent__body_sizes__genesis__expected) BOOST_REQUIRE_EQUAL(query.candidate_body_size(), zero); BOOST_REQUIRE_EQUAL(query.confirmed_body_size(), zero); - BOOST_REQUIRE_EQUAL(query.strong_tx_body_size(), schema::strong_tx::minrow); + BOOST_REQUIRE_EQUAL(query.strong_body_size(), schema::strong::minrow); BOOST_REQUIRE_EQUAL(query.scan_body_size(), zero); BOOST_REQUIRE_EQUAL(query.ecdsa0_body_size(), zero); BOOST_REQUIRE_EQUAL(query.schnorr0_body_size(), zero); @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(query_extent__buckets__genesis__expected) BOOST_REQUIRE_EQUAL(query.txs_buckets(), 128u); BOOST_REQUIRE_EQUAL(query.tx_buckets(), 128u); - BOOST_REQUIRE_EQUAL(query.strong_tx_buckets(), 128u); + BOOST_REQUIRE_EQUAL(query.strong_buckets(), 128u); BOOST_REQUIRE_EQUAL(query.duplicate_buckets(), 128u); BOOST_REQUIRE_EQUAL(query.prevout_buckets(), 128); BOOST_REQUIRE_EQUAL(query.pool_buckets(), 128u); @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(query_extent__records__genesis__expected) BOOST_REQUIRE_EQUAL(query.candidate_records(), one); BOOST_REQUIRE_EQUAL(query.confirmed_records(), one); - BOOST_REQUIRE_EQUAL(query.strong_tx_records(), one); + BOOST_REQUIRE_EQUAL(query.strong_records(), one); BOOST_REQUIRE_EQUAL(query.scan_records(), zero); BOOST_REQUIRE_EQUAL(query.ecdsa0_records(), zero); BOOST_REQUIRE_EQUAL(query.schnorr0_records(), zero); @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(query_extent__store_head_size__genesis__archive_plus_indexe BOOST_REQUIRE(query.initialize(test::genesis)); const auto indexes = query.candidate_head_size() + query.confirmed_head_size() - + query.strong_tx_head_size() + + query.strong_head_size() + query.scan_head_size() + query.scan_prefix_head_size() + query.ecdsa0_head_size() @@ -289,7 +289,7 @@ BOOST_AUTO_TEST_CASE(query_extent__store_body_size__genesis__archive_plus_indexe BOOST_REQUIRE(query.initialize(test::genesis)); const auto indexes = query.candidate_body_size() + query.confirmed_body_size() - + query.strong_tx_body_size() + + query.strong_body_size() + query.scan_body_size() + query.scan_prefix_body_size() + query.ecdsa0_body_size() diff --git a/test/settings.cpp b/test/settings.cpp index 8df3f602b..00fa78b83 100644 --- a/test/settings.cpp +++ b/test/settings.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected) BOOST_REQUIRE_EQUAL(configuration.envelope.ins_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.outs_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.tx_buckets, 128u); - BOOST_REQUIRE_EQUAL(configuration.envelope.strong_tx_buckets, 128u); + BOOST_REQUIRE_EQUAL(configuration.envelope.strong_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.duplicate_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.pool_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.provide_filters, true); @@ -68,10 +68,10 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected) BOOST_REQUIRE_EQUAL(configuration.candidate.rate, 5u); BOOST_REQUIRE_EQUAL(configuration.confirmed.buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.confirmed.rate, 5u); - BOOST_REQUIRE_EQUAL(configuration.strong_tx.buckets, 128u); - BOOST_REQUIRE_EQUAL(configuration.strong_tx.expected, 0u); - BOOST_REQUIRE_EQUAL(configuration.strong_tx.size, 1u); - BOOST_REQUIRE_EQUAL(configuration.strong_tx.rate, 5u); + BOOST_REQUIRE_EQUAL(configuration.strong.buckets, 128u); + BOOST_REQUIRE_EQUAL(configuration.strong.expected, 0u); + BOOST_REQUIRE_EQUAL(configuration.strong.size, 1u); + BOOST_REQUIRE_EQUAL(configuration.strong.rate, 5u); BOOST_REQUIRE_EQUAL(configuration.scan.size, 1u); BOOST_REQUIRE_EQUAL(configuration.scan.rate, 5u); diff --git a/test/store/store.cpp b/test/store/store.cpp index 20642f602..50ea07164 100644 --- a/test/store/store.cpp +++ b/test/store/store.cpp @@ -157,8 +157,8 @@ BOOST_AUTO_TEST_CASE(store__paths__default_configuration__expected) /// Index. BOOST_REQUIRE_EQUAL(instance.candidate_head_file(), "bitcoin/heads/index_candidate.head"); BOOST_REQUIRE_EQUAL(instance.confirmed_head_file(), "bitcoin/heads/index_confirmed.head"); - BOOST_REQUIRE_EQUAL(instance.strong_tx_head_file(), "bitcoin/heads/index_strong.head"); - BOOST_REQUIRE_EQUAL(instance.strong_tx_body_file(), "bitcoin/index_strong.data"); + BOOST_REQUIRE_EQUAL(instance.strong_head_file(), "bitcoin/heads/index_strong.head"); + BOOST_REQUIRE_EQUAL(instance.strong_body_file(), "bitcoin/index_strong.data"); BOOST_REQUIRE_EQUAL(instance.duplicate_head_file(), "bitcoin/heads/index_duplicate.head"); BOOST_REQUIRE_EQUAL(instance.duplicate_body_file(), "bitcoin/index_duplicate.data"); BOOST_REQUIRE_EQUAL(instance.state_head_file(), "bitcoin/heads/index_state.head"); diff --git a/test/tables/envelope.cpp b/test/tables/envelope.cpp index 9a245346f..572951c14 100644 --- a/test/tables/envelope.cpp +++ b/test/tables/envelope.cpp @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(envelope__set__default_settings__expected) BOOST_REQUIRE_EQUAL(instance.ins_buckets, configuration.ins.buckets); BOOST_REQUIRE_EQUAL(instance.outs_buckets, configuration.outs.buckets); BOOST_REQUIRE_EQUAL(instance.tx_buckets, configuration.tx.buckets); - BOOST_REQUIRE_EQUAL(instance.strong_tx_buckets, configuration.strong_tx.buckets); + BOOST_REQUIRE_EQUAL(instance.strong_buckets, configuration.strong.buckets); BOOST_REQUIRE_EQUAL(instance.duplicate_buckets, configuration.duplicate.buckets); BOOST_REQUIRE_EQUAL(instance.pool_buckets, configuration.pool.buckets); BOOST_REQUIRE(instance.provide_filters); @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(envelope__construct__mainnet__unset_filter_k) BOOST_REQUIRE_EQUAL(instance.ins_k, 0u); BOOST_REQUIRE_EQUAL(instance.outs_k, 0u); BOOST_REQUIRE_EQUAL(instance.tx_k, 0u); - BOOST_REQUIRE_EQUAL(instance.strong_tx_k, 0u); + BOOST_REQUIRE_EQUAL(instance.strong_k, 0u); BOOST_REQUIRE_EQUAL(instance.duplicate_k, 0u); BOOST_REQUIRE_EQUAL(instance.pool_k, 0u); } diff --git a/test/tables/indexes/strong_tx.cpp b/test/tables/indexes/strong.cpp similarity index 80% rename from test/tables/indexes/strong_tx.cpp rename to test/tables/indexes/strong.cpp index 071ff0a56..2dd57b644 100644 --- a/test/tables/indexes/strong_tx.cpp +++ b/test/tables/indexes/strong.cpp @@ -19,21 +19,21 @@ #include "../../test.hpp" #include "../../mocks/chunk_storage.hpp" -BOOST_AUTO_TEST_SUITE(strong_tx_tests) +BOOST_AUTO_TEST_SUITE(strong_tests) using namespace system; -const table::strong_tx::key key1{ 0x01, 0x02, 0x03, 0x04 }; -const table::strong_tx::key key2{ 0xa1, 0xa2, 0xa3, 0xa4 }; -const table::strong_tx::record strong1 +const table::strong::key key1{ 0x01, 0x02, 0x03, 0x04 }; +const table::strong::key key2{ 0xa1, 0xa2, 0xa3, 0xa4 }; +const table::strong::record strong1 { {}, - table::strong_tx::merge(true, 0x0078f87f) + table::strong::merge(true, 0x0078f87f) }; -const table::strong_tx::record strong2 +const table::strong::record strong2 { {}, - table::strong_tx::merge(false, 0x0078f87f) + table::strong::merge(false, 0x0078f87f) }; const auto expected_head = base16_chunk @@ -71,18 +71,18 @@ const auto expected_body = base16_chunk "7ff878" // 0x0078f87f | 0x00000000 ); -BOOST_AUTO_TEST_CASE(strong_tx__put__two__expected) +BOOST_AUTO_TEST_CASE(strong__put__two__expected) { test::chunk_storage head_store{}; test::chunk_storage body_store{}; - table::strong_tx instance{ head_store, body_store, 8 }; + table::strong instance{ head_store, body_store, 8 }; BOOST_REQUIRE(instance.create()); - table::strong_tx::link link1{}; + table::strong::link link1{}; BOOST_REQUIRE(instance.put_link(link1, key1, strong1)); BOOST_REQUIRE_EQUAL(link1, 0u); - table::strong_tx::link link2{}; + table::strong::link link2{}; BOOST_REQUIRE(instance.put_link(link2, key2, strong2)); BOOST_REQUIRE_EQUAL(link2, 1u); @@ -92,17 +92,17 @@ BOOST_AUTO_TEST_CASE(strong_tx__put__two__expected) BOOST_REQUIRE_EQUAL(head_store.buffer(), closed_head); } -BOOST_AUTO_TEST_CASE(strong_tx__get__two__expected) +BOOST_AUTO_TEST_CASE(strong__get__two__expected) { auto head = expected_head; auto body = expected_body; test::chunk_storage head_store{ head }; test::chunk_storage body_store{ body }; - table::strong_tx instance{ head_store, body_store, 32 }; + table::strong instance{ head_store, body_store, 32 }; BOOST_REQUIRE_EQUAL(head_store.buffer(), expected_head); BOOST_REQUIRE_EQUAL(body_store.buffer(), expected_body); - table::strong_tx::record out{}; + table::strong::record out{}; BOOST_REQUIRE(instance.get(0u, out)); BOOST_REQUIRE_EQUAL(out.header_fk(), strong1.header_fk()); BOOST_REQUIRE_EQUAL(out.positive(), strong1.positive()); From 6b85962ff703c2873c437f2b07935ecf811efd4e Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Mon, 12 Oct 2026 22:45:54 -0400 Subject: [PATCH 3/4] Remove unused address table name. --- include/bitcoin/database/impl/store/store_tables.ipp | 3 --- include/bitcoin/database/tables/names.hpp | 1 - include/bitcoin/database/tables/table.hpp | 3 --- 3 files changed, 7 deletions(-) diff --git a/include/bitcoin/database/impl/store/store_tables.ipp b/include/bitcoin/database/impl/store/store_tables.ipp index 19c6bde5c..2681e8e47 100644 --- a/include/bitcoin/database/impl/store/store_tables.ipp +++ b/include/bitcoin/database/impl/store/store_tables.ipp @@ -125,9 +125,6 @@ const CLASS::table_map CLASS::tables { table_t::wtxid_body, "wtxid_body" }, // Optionals. - { table_t::address_table, "address_table" }, - { table_t::address_head, "address_head" }, - { table_t::address_body, "address_body" }, { table_t::filter_bk_table, "filter_bk_table" }, { table_t::filter_bk_head, "filter_bk_head" }, { table_t::filter_bk_body, "filter_bk_body" }, diff --git a/include/bitcoin/database/tables/names.hpp b/include/bitcoin/database/tables/names.hpp index 52e80f593..c6666e8d9 100644 --- a/include/bitcoin/database/tables/names.hpp +++ b/include/bitcoin/database/tables/names.hpp @@ -112,7 +112,6 @@ namespace caches namespace optionals { - constexpr auto address = "option_address"; constexpr auto filter_bk = "option_filter_bk"; constexpr auto filter_tx = "option_filter_tx"; } diff --git a/include/bitcoin/database/tables/table.hpp b/include/bitcoin/database/tables/table.hpp index d60fb56fd..f902b085f 100644 --- a/include/bitcoin/database/tables/table.hpp +++ b/include/bitcoin/database/tables/table.hpp @@ -124,9 +124,6 @@ enum class table_t wtxid_body, /// Optionals. - address_table, - address_head, - address_body, filter_bk_table, filter_bk_head, filter_bk_body, From 79fc0a7fe11de5a358b2113b6f64c5b904faa8e6 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Mon, 12 Oct 2026 22:45:54 -0400 Subject: [PATCH 4/4] Add wtxid table settings. --- include/bitcoin/database/impl/store/store.ipp | 7 ++++--- include/bitcoin/database/impl/store/store_open.ipp | 4 ++-- include/bitcoin/database/settings.hpp | 1 + include/bitcoin/database/tables/envelope.hpp | 2 ++ include/bitcoin/database/tables/schema.hpp | 3 ++- src/tables/envelope.cpp | 7 ++++++- test/settings.cpp | 5 +++++ test/tables/envelope.cpp | 6 ++++-- 8 files changed, 26 insertions(+), 9 deletions(-) diff --git a/include/bitcoin/database/impl/store/store.ipp b/include/bitcoin/database/impl/store/store.ipp index e1e4263f2..288841c7e 100644 --- a/include/bitcoin/database/impl/store/store.ipp +++ b/include/bitcoin/database/impl/store/store.ipp @@ -126,8 +126,8 @@ CLASS::store(const settings& config) NOEXCEPT pool_body_(body(config.path, schema::caches::pool), config.pool, sequential, staged), spends_head_(head(config.path / schema::dir::heads, schema::caches::spends), head_settings(config.spends), sequential), spends_body_(body(config.path, schema::caches::spends), config.spends, sequential, staged), - wtxid_head_(head(config.path / schema::dir::heads, schema::indexes::wtxid), head_settings(config.pool), random), - wtxid_body_(body(config.path, schema::indexes::wtxid), config.pool, sequential, staged), + wtxid_head_(head(config.path / schema::dir::heads, schema::indexes::wtxid), head_settings(config.wtxid), random), + wtxid_body_(body(config.path, schema::indexes::wtxid), config.wtxid, sequential, staged), // Optionals. // ------------------------------------------------------------------------ @@ -179,7 +179,7 @@ CLASS::store(const settings& config) NOEXCEPT state(state_head_), pool(pool_head_, pool_body_, config.pool.buckets, config.pool.expected), spends(spends_head_, spends_body_), - wtxid(wtxid_head_, wtxid_body_, config.pool.buckets, config.pool.expected), + wtxid(wtxid_head_, wtxid_body_, config.wtxid.buckets, config.wtxid.expected), filter_bk(filter_bk_head_, filter_bk_body_, config.filter_bk.buckets), filter_tx(filter_tx_head_, filter_tx_body_, config.filter_tx.buckets) @@ -196,6 +196,7 @@ CLASS::store(const settings& config) NOEXCEPT envelope_.strong_k = possible_narrow_cast(strong.filter_k()); envelope_.duplicate_k = possible_narrow_cast(duplicate.filter_k()); envelope_.pool_k = possible_narrow_cast(pool.filter_k()); + envelope_.wtxid_k = possible_narrow_cast(wtxid.filter_k()); } TEMPLATE diff --git a/include/bitcoin/database/impl/store/store_open.ipp b/include/bitcoin/database/impl/store/store_open.ipp index c7d21c2b3..c43f0d346 100644 --- a/include/bitcoin/database/impl/store/store_open.ipp +++ b/include/bitcoin/database/impl/store/store_open.ipp @@ -213,7 +213,7 @@ code CLASS::load_envelope() NOEXCEPT !strong.set_buckets(envelope_.strong_buckets) || !duplicate.set_buckets(envelope_.duplicate_buckets) || !pool.set_buckets(envelope_.pool_buckets) || - !wtxid.set_buckets(envelope_.pool_buckets)) + !wtxid.set_buckets(envelope_.wtxid_buckets)) { return error::verify_table; } @@ -226,7 +226,7 @@ code CLASS::load_envelope() NOEXCEPT !strong.set_filter_k(envelope_.strong_k) || !duplicate.set_filter_k(envelope_.duplicate_k) || !pool.set_filter_k(envelope_.pool_k) || - !wtxid.set_filter_k(envelope_.pool_k)) + !wtxid.set_filter_k(envelope_.wtxid_k)) { return error::verify_table; } diff --git a/include/bitcoin/database/settings.hpp b/include/bitcoin/database/settings.hpp index a36ad9de5..e7b053a95 100644 --- a/include/bitcoin/database/settings.hpp +++ b/include/bitcoin/database/settings.hpp @@ -106,6 +106,7 @@ struct BCD_API settings bucket_table confirmed{}; hash_table strong{}; bucket_table scan{}; + hash_table wtxid{}; /// Caches. /// ----------------------------------------------------------------------- diff --git a/include/bitcoin/database/tables/envelope.hpp b/include/bitcoin/database/tables/envelope.hpp index 5e23fba66..9883bd7bb 100644 --- a/include/bitcoin/database/tables/envelope.hpp +++ b/include/bitcoin/database/tables/envelope.hpp @@ -89,6 +89,7 @@ struct BCD_API envelope uint32_t strong_buckets{}; uint32_t duplicate_buckets{}; uint32_t pool_buckets{}; + uint32_t wtxid_buckets{}; uint8_t header_k{}; uint8_t ins_k{}; uint8_t outs_k{}; @@ -96,6 +97,7 @@ struct BCD_API envelope uint8_t strong_k{}; uint8_t duplicate_k{}; uint8_t pool_k{}; + uint8_t wtxid_k{}; /// Network settings. bool limited_blocks{}; diff --git a/include/bitcoin/database/tables/schema.hpp b/include/bitcoin/database/tables/schema.hpp index 3d524e7ac..73414fb87 100644 --- a/include/bitcoin/database/tables/schema.hpp +++ b/include/bitcoin/database/tables/schema.hpp @@ -58,7 +58,8 @@ namespace schema { /// 4.0.12.0 Association, milestone and checkpoint as block state flags. /// 4.0.13.0 Scanned and filtered block state flags, presilent batch tables. /// 4.0.14.0 Scan table head of scan starts, scan and tx counts at the latch. -constexpr std::array version{ 4, 0, 14, 0 }; +/// 4.0.15.0 Wtxid buckets and filter k in the envelope. +constexpr std::array version{ 4, 0, 15, 0 }; /// Values. /// ----------------------------------------------------------------------- diff --git a/src/tables/envelope.cpp b/src/tables/envelope.cpp index 80b5660c7..e3cb04534 100644 --- a/src/tables/envelope.cpp +++ b/src/tables/envelope.cpp @@ -50,6 +50,7 @@ void envelope::set(const settings& database) NOEXCEPT strong_buckets = database.strong.buckets; duplicate_buckets = database.duplicate.buckets; pool_buckets = database.pool.buckets; + wtxid_buckets = database.wtxid.buckets; provide_filters = to_bool(database.filter_bk.buckets) && to_bool(database.filter_tx.buckets); } @@ -179,6 +180,7 @@ bool envelope::from_data(reader& source) NOEXCEPT strong_buckets = source.read_little_endian(); duplicate_buckets = source.read_little_endian(); pool_buckets = source.read_little_endian(); + wtxid_buckets = source.read_little_endian(); header_k = source.read_byte(); ins_k = source.read_byte(); outs_k = source.read_byte(); @@ -186,6 +188,7 @@ bool envelope::from_data(reader& source) NOEXCEPT strong_k = source.read_byte(); duplicate_k = source.read_byte(); pool_k = source.read_byte(); + wtxid_k = source.read_byte(); limited_blocks = to_bool(source.read_byte()); provide_filters = to_bool(source.read_byte()); @@ -273,6 +276,7 @@ bool envelope::to_data(flipper& sink) const NOEXCEPT sink.write_little_endian(strong_buckets); sink.write_little_endian(duplicate_buckets); sink.write_little_endian(pool_buckets); + sink.write_little_endian(wtxid_buckets); sink.write_byte(header_k); sink.write_byte(ins_k); sink.write_byte(outs_k); @@ -280,6 +284,7 @@ bool envelope::to_data(flipper& sink) const NOEXCEPT sink.write_byte(strong_k); sink.write_byte(duplicate_k); sink.write_byte(pool_k); + sink.write_byte(wtxid_k); sink.write_byte(to_int(limited_blocks)); sink.write_byte(to_int(provide_filters)); @@ -296,7 +301,7 @@ size_t envelope::serialized_size() const NOEXCEPT { constexpr auto forks_size = 24_size; constexpr auto fixed = (4 * sizeof(uint32_t)) + sizeof(uint16_t) + - (7 * sizeof(uint32_t)) + (10 * sizeof(uint8_t)) + forks_size + + (8 * sizeof(uint32_t)) + (11 * sizeof(uint8_t)) + forks_size + sizeof(uint64_t) + (18 * sizeof(uint32_t)); const auto checkpoint_size = [](const chain::checkpoint& in) NOEXCEPT diff --git a/test/settings.cpp b/test/settings.cpp index 00fa78b83..164a28215 100644 --- a/test/settings.cpp +++ b/test/settings.cpp @@ -35,6 +35,7 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected) BOOST_REQUIRE_EQUAL(configuration.envelope.strong_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.duplicate_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.pool_buckets, 128u); + BOOST_REQUIRE_EQUAL(configuration.envelope.wtxid_buckets, 128u); BOOST_REQUIRE_EQUAL(configuration.envelope.provide_filters, true); BOOST_REQUIRE_EQUAL(configuration.path, "bitcoin"); @@ -74,6 +75,10 @@ BOOST_AUTO_TEST_CASE(settings__construct__default__expected) BOOST_REQUIRE_EQUAL(configuration.strong.rate, 5u); BOOST_REQUIRE_EQUAL(configuration.scan.size, 1u); BOOST_REQUIRE_EQUAL(configuration.scan.rate, 5u); + BOOST_REQUIRE_EQUAL(configuration.wtxid.buckets, 128u); + BOOST_REQUIRE_EQUAL(configuration.wtxid.expected, 0u); + BOOST_REQUIRE_EQUAL(configuration.wtxid.size, 1u); + BOOST_REQUIRE_EQUAL(configuration.wtxid.rate, 5u); // Caches. BOOST_REQUIRE_EQUAL(configuration.ecdsa.size, 1u); diff --git a/test/tables/envelope.cpp b/test/tables/envelope.cpp index 572951c14..ad0d0932d 100644 --- a/test/tables/envelope.cpp +++ b/test/tables/envelope.cpp @@ -22,7 +22,7 @@ BOOST_AUTO_TEST_SUITE(envelope_tests) using namespace system; -constexpr auto default_size = 365_size; +constexpr auto default_size = 370_size; static data_chunk to_chunk(const envelope& instance) { @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(envelope__serialized_size__default__expected) BOOST_AUTO_TEST_CASE(envelope__to_data__default__expected_version) { const envelope instance{}; - BOOST_REQUIRE_EQUAL(instance.schema, system::config::version(4, 0, 14, 0)); + BOOST_REQUIRE_EQUAL(instance.schema, system::config::version(4, 0, 15, 0)); BOOST_REQUIRE_EQUAL(to_chunk(instance).front(), schema::version.front()); } @@ -111,6 +111,7 @@ BOOST_AUTO_TEST_CASE(envelope__set__default_settings__expected) BOOST_REQUIRE_EQUAL(instance.strong_buckets, configuration.strong.buckets); BOOST_REQUIRE_EQUAL(instance.duplicate_buckets, configuration.duplicate.buckets); BOOST_REQUIRE_EQUAL(instance.pool_buckets, configuration.pool.buckets); + BOOST_REQUIRE_EQUAL(instance.wtxid_buckets, configuration.wtxid.buckets); BOOST_REQUIRE(instance.provide_filters); } @@ -165,6 +166,7 @@ BOOST_AUTO_TEST_CASE(envelope__construct__mainnet__unset_filter_k) BOOST_REQUIRE_EQUAL(instance.strong_k, 0u); BOOST_REQUIRE_EQUAL(instance.duplicate_k, 0u); BOOST_REQUIRE_EQUAL(instance.pool_k, 0u); + BOOST_REQUIRE_EQUAL(instance.wtxid_k, 0u); } BOOST_AUTO_TEST_CASE(envelope__from_data__mainnet__round_trip)