hardfork: switch voting to block minor version

Using major version would cause older daemons to reject those
blocks as they fail to deserialize blocks with a major version
which is not 1. There is no such restriction on the minor
version, so switching allows older daemons to coexist with
newer ones till the actual fork date, when most will hopefully
have updated already.

Also, for the same reason, we consider a vote for 0 to be a
vote for 1, since older daemons set minor version to 0.
This commit is contained in:
moneromooo-monero 2015-10-21 19:18:00 +01:00
parent 55178aed8c
commit 6376627530
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 21 additions and 13 deletions

View file

@ -131,7 +131,7 @@ private:
static cryptonote::block mkblock(uint8_t version)
{
cryptonote::block b;
b.major_version = version;
b.minor_version = version;
return b;
}
@ -358,7 +358,6 @@ TEST(new_blocks, denied)
ASSERT_TRUE(hf.add(2, 2, 1));
hf.init();
ASSERT_FALSE(hf.add(mkblock(0), 0));
ASSERT_TRUE(hf.add(mkblock(1), 0));
ASSERT_TRUE(hf.add(mkblock(1), 1));
ASSERT_TRUE(hf.add(mkblock(1), 2));
@ -384,7 +383,6 @@ TEST(new_version, early)
ASSERT_TRUE(hf.add(2, 4, 1));
hf.init();
ASSERT_FALSE(hf.add(mkblock(0), 0));
ASSERT_TRUE(hf.add(mkblock(2), 0));
ASSERT_TRUE(hf.add(mkblock(2), 1)); // we have enough votes already
ASSERT_TRUE(hf.add(mkblock(2), 2));
@ -417,7 +415,6 @@ TEST(reorganize, changed)
#define ADD_TRUE(v, h) ADD(v, h, TRUE)
#define ADD_FALSE(v, h) ADD(v, h, FALSE)
ADD_FALSE(0, 0);
ADD_TRUE(1, 0);
ADD_TRUE(1, 1);
ADD_TRUE(2, 2);