diff --git a/include/bitcoin/database/impl/query/translate.ipp b/include/bitcoin/database/impl/query/translate.ipp index 6b474b5b..47fbfd6a 100644 --- a/include/bitcoin/database/impl/query/translate.ipp +++ b/include/bitcoin/database/impl/query/translate.ipp @@ -199,10 +199,10 @@ header_link CLASS::to_parent(const header_link& link) const NOEXCEPT } TEMPLATE -header_link CLASS::to_block(const tx_link& link) const NOEXCEPT +header_link CLASS::to_block(const tx_link& key) const NOEXCEPT { table::strong_tx::record strong{}; - if (!store_.strong_tx.find(link, strong) || !strong.positive) + if (!store_.strong_tx.find(key, strong) || !strong.positive) return {}; // Terminal implies not strong (not in block). @@ -216,6 +216,8 @@ header_link CLASS::to_block(const tx_link& link) const NOEXCEPT TEMPLATE inline strong_pair CLASS::to_strong(const hash_digest& tx_hash) const NOEXCEPT { + // Iteration of tx is necessary because there may be duplicates. + // Only top block (strong) association for given tx instance is considered. auto it = store_.tx.it(tx_hash); strong_pair strong{ {}, it.self() }; if (!it) diff --git a/include/bitcoin/database/query.hpp b/include/bitcoin/database/query.hpp index cb5fd0cc..7fc5e735 100644 --- a/include/bitcoin/database/query.hpp +++ b/include/bitcoin/database/query.hpp @@ -272,7 +272,7 @@ class query /// block/tx to block/s (reverse navigation) header_link to_parent(const header_link& link) const NOEXCEPT; - header_link to_block(const tx_link& link) const NOEXCEPT; + header_link to_block(const tx_link& key) const NOEXCEPT; /// output to spenders (reverse navigation) spend_links to_spenders(const point& prevout) const NOEXCEPT;