hardfork: rescan speedup

Add a block height before which version 1 is assumed
Use DB transactions
This commit is contained in:
moneromooo-monero 2015-09-26 16:22:57 +01:00
parent fec98b8952
commit 0a7421b607
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 49 additions and 23 deletions

View file

@ -196,7 +196,7 @@ TEST(states, Success)
TEST(steps_asap, Success)
{
TestDB db;
HardFork hf(db, 1,1,1,1);
HardFork hf(db, 1,0,1,1,1);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -225,7 +225,7 @@ TEST(steps_asap, Success)
TEST(steps_1, Success)
{
TestDB db;
HardFork hf(db, 1,1,1,1);
HardFork hf(db, 1,0,1,1,1);
ASSERT_TRUE(hf.add(1, 0, 0));
for (int n = 1 ; n < 10; ++n)
@ -246,7 +246,7 @@ TEST(reorganize, Same)
{
for (int history = 1; history <= 12; ++history) {
TestDB db;
HardFork hf(db, 1, 1, 1, history, 100);
HardFork hf(db, 1, 0, 1, 1, history, 100);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -276,7 +276,7 @@ TEST(reorganize, Changed)
{
int history = 4;
TestDB db;
HardFork hf(db, 1, 1, 1, 4, 100);
HardFork hf(db, 1, 0, 1, 1, 4, 100);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -325,7 +325,7 @@ TEST(voting, threshold)
{
for (int threshold = 87; threshold <= 88; ++threshold) {
TestDB db;
HardFork hf(db, 1, 1, 1, 8, threshold);
HardFork hf(db, 1, 0, 1, 1, 8, threshold);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -353,7 +353,7 @@ TEST(voting, threshold)
TEST(new_blocks, denied)
{
TestDB db;
HardFork hf(db, 1, 1, 1, 4, 50);
HardFork hf(db, 1, 0, 1, 1, 4, 50);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -379,7 +379,7 @@ TEST(new_blocks, denied)
TEST(new_version, early)
{
TestDB db;
HardFork hf(db, 1, 1, 1, 4, 50);
HardFork hf(db, 1, 0, 1, 1, 4, 50);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));
@ -402,7 +402,7 @@ TEST(new_version, early)
TEST(reorganize, changed)
{
TestDB db;
HardFork hf(db, 1, 1, 1, 4, 50);
HardFork hf(db, 1, 0, 1, 1, 4, 50);
// v h t
ASSERT_TRUE(hf.add(1, 0, 0));