Skip to content

Commit

Permalink
Change the default read test.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 30, 2024
1 parent e915015 commit 01f07e1
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions console/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,39 +740,6 @@ void executor::scan_collisions() const
//// logger("No read test implemented.");
////}

#if defined(UNDEFINED)

void executor::read_test() const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
constexpr auto last = 500'000_size;

size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
{
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}

const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
return;
}

size += bytes;
}

const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % last % span.count());
}

void executor::read_test() const
{
constexpr auto start_tx = 15'000_u32;
Expand Down Expand Up @@ -1005,6 +972,7 @@ void executor::read_test() const
logger(format("Got all [%1%] payments to [%2%] addresses in [%3%] ms.") %
outs.size() % keys.size() % span.count());

// Write it all...
////logger(
//// "output_script_hash, "
//// "output_fk, "
Expand Down Expand Up @@ -1068,6 +1036,39 @@ void executor::read_test() const
////}
}

#if defined(UNDEFINED)

void executor::read_test() const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
constexpr auto last = 500'000_size;

size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
{
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}

const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
return;
}

size += bytes;
}

const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % last % span.count());
}

void executor::read_test() const
{
// Binance wallet address with 1,380,169 transaction count.
Expand Down Expand Up @@ -1508,8 +1509,6 @@ void executor::read_test() const
logger(format("STOP (%1% secs)") % span.count());
}

#endif // UNDEFINED

// TODO: create a block/tx dumper.
void executor::read_test() const
{
Expand All @@ -1530,6 +1529,7 @@ void executor::read_test() const
logger("!block");
return;
}

if (!block->is_valid())
{
logger("!block->is_valid()");
Expand Down Expand Up @@ -1586,6 +1586,8 @@ void executor::read_test() const
logger(format("Validated block 523354 in %1% msec.") % span.count());
}

#endif // UNDEFINED

// arbitrary testing (non-const).
void executor::write_test()
{
Expand Down

0 comments on commit 01f07e1

Please sign in to comment.