Skip to content

Commit 4647338

Browse files
committed
Move virtual_size() util to system::chain.
1 parent d605fe9 commit 4647338

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

include/bitcoin/database/impl/query/fees.ipp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,6 @@
3333
namespace libbitcoin {
3434
namespace database {
3535

36-
// static/private
37-
TEMPLATE
38-
constexpr size_t CLASS::virtual_size(size_t light, size_t heavy) NOEXCEPT
39-
{
40-
using namespace system;
41-
using namespace system::chain;
42-
constexpr auto scale = base_size_contribution + total_size_contribution;
43-
44-
const auto weight = ceilinged_add(
45-
ceilinged_multiply(base_size_contribution, light),
46-
ceilinged_multiply(total_size_contribution, heavy));
47-
48-
// Block weight is 3 * nominal size * + 1 * witness size [bip141].
49-
return ceilinged_divide(weight, scale);
50-
}
51-
5236
TEMPLATE
5337
bool CLASS::get_tx_virtual_size(size_t& out,
5438
const tx_link& link) const NOEXCEPT
@@ -57,7 +41,7 @@ bool CLASS::get_tx_virtual_size(size_t& out,
5741
if (!get_tx_sizes(light, heavy, link))
5842
return false;
5943

60-
out = virtual_size(light, heavy);
44+
out = system::chain::virtual_size(light, heavy);
6145
return true;
6246
}
6347

@@ -69,7 +53,7 @@ bool CLASS::get_block_virtual_size(size_t& out,
6953
if (!get_block_sizes(light, heavy, link))
7054
return false;
7155

72-
out = virtual_size(light, heavy);
56+
out = system::chain::virtual_size(light, heavy);
7357
return true;
7458
}
7559

include/bitcoin/database/query.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ class query
793793
template <typename Functor>
794794
static inline code parallel_address_transform(std::atomic_bool& cancel,
795795
outpoints& out, const output_links& links, Functor&& functor) NOEXCEPT;
796-
static constexpr size_t virtual_size(size_t light, size_t heavy) NOEXCEPT;
797796

798797
// Not thread safe.
799798
size_t get_fork_() const NOEXCEPT;

0 commit comments

Comments
 (0)