mirror of
https://codeberg.org/wownero/wownero-lws
synced 2026-01-09 15:15:15 -08:00
Refuse chain rollback past a checkpoint (#92)
This commit is contained in:
committed by
Lee *!* Clagett
parent
d2ca5b4180
commit
55f6bbb386
@@ -28,6 +28,7 @@
|
||||
#include "chain.test.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include "checkpoints/checkpoints.h" // monero/src
|
||||
#include "db/storage.test.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -112,6 +113,23 @@ LWS_CASE("db::storage::sync_chain")
|
||||
lws_test::test_chain(lest_env, MONERO_UNWRAP(db.start_read()), last_block.id, fchain);
|
||||
EXPECT(get_account().scan_height == lws::db::block_id(std::uint64_t(last_block.id) + 1));
|
||||
}
|
||||
|
||||
SECTION("Fork past checkpoint")
|
||||
{
|
||||
const auto& checkpoints = lws::db::storage::get_checkpoints();
|
||||
const auto& points = checkpoints.get_points();
|
||||
EXPECT(!points.empty());
|
||||
|
||||
auto point = points.begin();
|
||||
const crypto::hash fchain[3] = {
|
||||
point->second,
|
||||
crypto::rand<crypto::hash>(),
|
||||
crypto::rand<crypto::hash>()
|
||||
};
|
||||
|
||||
const auto sync_result = db.sync_chain(lws::db::block_id(point->first), fchain);
|
||||
EXPECT(sync_result == lws::error::bad_blockchain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,8 +282,6 @@ namespace
|
||||
|
||||
LWS_CASE("lws::scanner::sync and lws::scanner::run")
|
||||
{
|
||||
mlog_set_log_level(4);
|
||||
|
||||
cryptonote::account_keys keys{};
|
||||
crypto::generate_keys(keys.m_account_address.m_spend_public_key, keys.m_spend_secret_key);
|
||||
crypto::generate_keys(keys.m_account_address.m_view_public_key, keys.m_view_secret_key);
|
||||
|
||||
Reference in New Issue
Block a user