Implement a hard fork for extended/infinite claim expiration times #112
1 changed files with 68 additions and 1 deletions
|
@ -374,6 +374,7 @@ BOOST_AUTO_TEST_CASE(claimtriebranching_claim)
|
||||||
fixture.DecrementBlocks(10);
|
fixture.DecrementBlocks(10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
spent claims
|
spent claims
|
||||||
spending winning claim will make losing active claim winner
|
spending winning claim will make losing active claim winner
|
||||||
|
@ -430,6 +431,7 @@ BOOST_AUTO_TEST_CASE(claimtriebranching_spend_claim)
|
||||||
fixture.DecrementBlocks(1);
|
fixture.DecrementBlocks(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
supports
|
supports
|
||||||
check support with wrong name does not work
|
check support with wrong name does not work
|
||||||
|
@ -470,7 +472,72 @@ BOOST_AUTO_TEST_CASE(claimtriebranching_support)
|
||||||
BOOST_CHECK(is_best_claim("test",tx4));
|
BOOST_CHECK(is_best_claim("test",tx4));
|
||||||
BOOST_CHECK(best_claim_effective_amount_equals("test",2));
|
BOOST_CHECK(best_claim_effective_amount_equals("test",2));
|
||||||
fixture.DecrementBlocks(10);
|
fixture.DecrementBlocks(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
support on abandon
|
||||||
|
supporting a claim the same block it gets abandoned,
|
||||||
|
or abandoing a support the same block claim gets abandoned,
|
||||||
|
when there were no other claims would crash lbrycrd,
|
||||||
|
make sure this doesn't happen in below three tests
|
||||||
|
(https://github.com/lbryio/lbrycrd/issues/77)
|
||||||
|
*/
|
||||||
|
BOOST_AUTO_TEST_CASE(claimtriebranching_support_on_abandon)
|
||||||
|
{
|
||||||
|
ClaimTrieChainFixture fixture;
|
||||||
|
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",2);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
|
||||||
|
//supporting and abandoing on the same block will cause it to crash
|
||||||
|
CMutableTransaction s1 = fixture.MakeSupport(fixture.GetCoinbase(),tx1,"test",1);
|
||||||
|
fixture.Spend(tx1);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
BOOST_CHECK(!is_best_claim("test",tx1));
|
||||||
|
|
||||||
|
fixture.DecrementBlocks(1);
|
||||||
|
BOOST_CHECK(is_best_claim("test",tx1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(claimtriebranching_support_on_abandon_2)
|
||||||
|
{
|
||||||
|
ClaimTrieChainFixture fixture;
|
||||||
|
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",2);
|
||||||
|
CMutableTransaction s1 = fixture.MakeSupport(fixture.GetCoinbase(),tx1,"test",1);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
|
||||||
|
//abandoning a support and abandoing claim on the same block will cause it to crash
|
||||||
|
fixture.Spend(tx1);
|
||||||
|
fixture.Spend(s1);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
BOOST_CHECK(!is_best_claim("test",tx1));
|
||||||
|
|
||||||
|
fixture.DecrementBlocks(1);
|
||||||
|
BOOST_CHECK(is_best_claim("test",tx1));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(claimtriebranching_update_on_support)
|
||||||
|
{
|
||||||
|
// make sure that support on abandon bug does not affect
|
||||||
|
// updates happening on the same block as a support
|
||||||
|
// (it should not)
|
||||||
|
ClaimTrieChainFixture fixture;
|
||||||
|
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(),"test","one",3);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
|
||||||
|
CMutableTransaction s1 = fixture.MakeSupport(fixture.GetCoinbase(),tx1,"test",1);
|
||||||
|
CMutableTransaction u1 = fixture.MakeUpdate(tx1,"test","two",ClaimIdHash(tx1.GetHash(),0),1);
|
||||||
|
fixture.IncrementBlocks(1);
|
||||||
|
|
||||||
|
BOOST_CHECK(is_best_claim("test",u1));
|
||||||
|
BOOST_CHECK(best_claim_effective_amount_equals("test",2));
|
||||||
|
|
||||||
|
fixture.DecrementBlocks(1);
|
||||||
|
BOOST_CHECK(is_best_claim("test",tx1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
support spend
|
support spend
|
||||||
spending suport on winning claim will cause it to lose
|
spending suport on winning claim will cause it to lose
|
||||||
|
|
Loading…
Reference in a new issue