Update validations on UNL change (RIPD-1566):

Change the trust status of existing validations based when nodes are
added or removed from the UNL.
This commit is contained in:
Brad Chase
2018-02-13 13:32:16 -05:00
committed by Mike Ellery
parent 8b909d5c17
commit 20defb4844
24 changed files with 764 additions and 389 deletions

View File

@@ -31,15 +31,38 @@ namespace test {
class RCLValidations_test : public beast::unit_test::suite
{
public:
void
run() override
testChangeTrusted()
{
testcase("Change validation trusted status");
PublicKey key = derivePublicKey(KeyType::ed25519, randomSecretKey());
auto v = std::make_shared<STValidation>(
uint256(), NetClock::time_point(), key, calcNodeID(key), true);
BEAST_EXPECT(!v->isTrusted());
v->setTrusted();
BEAST_EXPECT(v->isTrusted());
v->setUntrusted();
BEAST_EXPECT(!v->isTrusted());
RCLValidation rcv{v};
BEAST_EXPECT(!rcv.trusted());
rcv.setTrusted();
BEAST_EXPECT(rcv.trusted());
rcv.setUntrusted();
BEAST_EXPECT(!rcv.trusted());
}
void
testRCLValidatedLedger()
{
testcase("RCLValidatedLedger ancestry");
beast::Journal j;
using Seq = RCLValidatedLedger::Seq;
using ID = RCLValidatedLedger::ID;
// This tests RCLValidatedLedger properly implements the type
// requirements of a LedgerTrie ledger, with its added behavior that
// only the 256 prior ledger hashes are available to determine ancestry.
@@ -193,8 +216,14 @@ public:
}
}
}
}
public:
void
run() override
{
testChangeTrusted();
testRCLValidatedLedger();
}
};