Skip to content

Commit b3ad636

Browse files
authored
Merge pull request #641 from evoskuil/master
Adapt to database change to get sizes.
2 parents 56f354c + 64bda60 commit b3ad636

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

console/executor_test_reader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ void executor::read_test(const hash_digest&) const
4545
return;
4646
}
4747

48-
const auto bytes = query_.get_block_size(link, true);
49-
if (is_zero(bytes))
48+
size_t bytes{};
49+
if (!query_.get_block_size(bytes, link, true))
5050
{
5151
logger(format("Block (%1%) is not associated.") % height);
5252
return;

src/protocols/protocol_native.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,21 @@ bool protocol_native::handle_get_block_header_context(const code& ec,
291291
// The "state" element implies transactions are associated.
292292
if (query.is_associated(link))
293293
{
294+
size_t size{}, weight{};
295+
if (!query.get_block_sizes(size, weight, link))
296+
{
297+
send_internal_server_error(database::error::integrity);
298+
return true;
299+
}
300+
294301
const auto check = system_settings().top_checkpoint().height();
295302
const auto bypass = context.height < check || query.is_milestone(link);
303+
296304
object["state"] = boost::json::object
297305
{
306+
{ "size", size },
307+
{ "weight", weight },
298308
{ "count", query.get_tx_count(link) },
299-
{ "size", query.get_block_size(link, true) },
300-
{ "weight", query.get_block_size(link, false) },
301309
{ "validated", bypass || query.is_validated(link) },
302310
{ "confirmed", check || query.is_confirmed_block(link) },
303311
{ "confirmable", bypass || query.is_confirmable(link) },
@@ -708,8 +716,8 @@ bool protocol_native::handle_get_tx_details(const code& ec,
708716
const auto bip141 = context.is_enabled(chain::flags::bip141_rule);
709717
object["confirmed"] = boost::json::object
710718
{
711-
{ "height", context.height },
712-
{ "position", position },
719+
{ "height", context.height },
720+
{ "position", position },
713721
{ "sigops", tx->signature_operations(bip16, bip141) }
714722
};
715723
}

0 commit comments

Comments
 (0)