Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions console/executor_test_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
namespace libbitcoin {
namespace node {

////using boost::format;
using boost::format;
using namespace network;
using namespace system;

#if defined(UNDEFINED)

// arbitrary testing (non-const).
void executor::write_test(const hash_digest&)
{
logger("No write test implemented.");
}

#if defined(UNDEFINED)

void executor::write_test(const system::hash_digest&)
{
for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link)
Expand Down Expand Up @@ -201,40 +201,25 @@ void executor::write_test(const system::hash_digest&)
logger(format("block" BN_WRITE_ROW) % height % span.count());
}

void executor::write_test(const system::hash_digest&)
{
constexpr auto hash251684 = base16_hash(
"00000000000000720e4c59ad28a8b61f38015808e92465e53111e3463aed80de");
const auto link = query_.to_header(hash251684);
#endif // UNDEFINED

void executor::write_test(const system::hash_digest& hash)
{
const auto id = encode_hash(hash);
const auto link = query_.to_header(hash);
if (link.is_terminal())
{
logger("link.is_terminal()");
return;
logger(format("Block [%1%] not found.") % id);
}

if (query_.confirmed_records() != 251684u)
{
logger("!query_.confirmed_records() != 251684u");
return;
}

if (!query_.push_confirmed(link, true))
else if (query_.set_block_unknown(link))
{
logger("!query_.push_confirmed(link)");
return;
logger(format("Successfully reset block [%1%].") % id);
}

if (query_.confirmed_records() != 251685u)
else
{
logger("!query_.confirmed_records() != 251685u");
return;
logger(format("Failed to reset block [%1%].") % id);
}

logger("Successfully confirmed block 251684.");
}

#endif // UNDEFINED

} // namespace node
} // namespace libbitcoin
4 changes: 3 additions & 1 deletion src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ void chaser_validate::do_bump(height_t) NOEXCEPT
const auto ec = query.get_block_state(link);

// First block state should be unvalidated, valid, or confirmable. This is
// assured in do_checked by chasing block checks.
// assured in do_checked by chasing block checks. unknown_state is a reset.
const auto ready =
(ec == database::error::unvalidated) ||
(ec == database::error::block_valid) ||
(ec == database::error::unknown_state) ||
(ec == database::error::block_confirmable);

if (ready)
Expand Down Expand Up @@ -186,6 +187,7 @@ void chaser_validate::do_bumped(height_t height) NOEXCEPT
else switch (ec.value())
{
case database::error::unvalidated:
case database::error::unknown_state:
{
post_block(link, bypass);
break;
Expand Down
Loading