Formatting.
This commit is contained in:
parent
cb340c5031
commit
4ac5de4b3e
2 changed files with 17 additions and 17 deletions
|
@ -80,32 +80,32 @@ TEST (conflicts, rollback_source)
|
|||
auto & node2 (*system.nodes[1]);
|
||||
rai::genesis genesis;
|
||||
rai::keypair key1;
|
||||
system.wallet(0)->insert_adhoc (rai::test_genesis_key.prv);
|
||||
auto send1 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, genesis.hash (), rai::test_genesis_key.pub, rai::genesis_amount - rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate(genesis.hash ())));
|
||||
system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv);
|
||||
auto send1 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, genesis.hash (), rai::test_genesis_key.pub, rai::genesis_amount - rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (genesis.hash ())));
|
||||
ASSERT_EQ (rai::process_result::progress, node2.process (*send1).code);
|
||||
ASSERT_FALSE (node2.active.start (send1));
|
||||
ASSERT_EQ (rai::process_result::progress, node1.process (*send1).code);
|
||||
ASSERT_FALSE (node1.active.start (send1));
|
||||
auto send2 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, send1->hash (), rai::test_genesis_key.pub, rai::genesis_amount - 2 * rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate(send1->hash ())));
|
||||
auto send2 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, send1->hash (), rai::test_genesis_key.pub, rai::genesis_amount - 2 * rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (send1->hash ())));
|
||||
ASSERT_EQ (rai::process_result::progress, node2.process (*send2).code);
|
||||
ASSERT_FALSE (node2.active.start (send2));
|
||||
auto send3 (std::make_shared<rai::state_block> (key1.pub, 0, key1.pub, rai::Gxrb_ratio, send1->hash (), key1.prv, key1.pub, system.work.generate(key1.pub)));
|
||||
auto send3 (std::make_shared<rai::state_block> (key1.pub, 0, key1.pub, rai::Gxrb_ratio, send1->hash (), key1.prv, key1.pub, system.work.generate (key1.pub)));
|
||||
ASSERT_EQ (rai::process_result::progress, node2.process (*send3).code);
|
||||
ASSERT_FALSE (node2.active.start (send3));
|
||||
auto send4 (std::make_shared<rai::state_block> (key1.pub, send3->hash (), key1.pub, 2 * rai::Gxrb_ratio, send2->hash (), key1.prv, key1.pub, system.work.generate(send3->hash ())));
|
||||
auto send4 (std::make_shared<rai::state_block> (key1.pub, send3->hash (), key1.pub, 2 * rai::Gxrb_ratio, send2->hash (), key1.prv, key1.pub, system.work.generate (send3->hash ())));
|
||||
ASSERT_EQ (rai::process_result::progress, node2.process (*send4).code);
|
||||
ASSERT_FALSE (node2.active.start (send4));
|
||||
auto send5 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, send1->hash (), rai::test_genesis_key.pub, rai::genesis_amount - 3 * rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate(send1->hash ())));
|
||||
ASSERT_EQ (rai::process_result::progress, node1.process(*send5).code);
|
||||
auto send5 (std::make_shared<rai::state_block> (rai::test_genesis_key.pub, send1->hash (), rai::test_genesis_key.pub, rai::genesis_amount - 3 * rai::Gxrb_ratio, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (send1->hash ())));
|
||||
ASSERT_EQ (rai::process_result::progress, node1.process (*send5).code);
|
||||
ASSERT_FALSE (node1.active.start (send5));
|
||||
auto iterations (0);
|
||||
while (!node2.active.active(*send4))
|
||||
while (!node2.active.active (*send4))
|
||||
{
|
||||
system.poll ();
|
||||
++iterations;
|
||||
ASSERT_LT (iterations, 200);
|
||||
}
|
||||
while (node2.active.active(*send4))
|
||||
while (node2.active.active (*send4))
|
||||
{
|
||||
system.poll ();
|
||||
++iterations;
|
||||
|
|
|
@ -894,7 +894,7 @@ void rai::ledger::dump_account_chain (rai::account const & account_a)
|
|||
class block_fit_visitor : public rai::block_visitor
|
||||
{
|
||||
public:
|
||||
block_fit_visitor(rai::ledger & ledger_a, MDB_txn * transaction_a) :
|
||||
block_fit_visitor (rai::ledger & ledger_a, MDB_txn * transaction_a) :
|
||||
ledger (ledger_a),
|
||||
transaction (transaction_a),
|
||||
result (false)
|
||||
|
@ -902,27 +902,27 @@ public:
|
|||
}
|
||||
void send_block (rai::send_block const & block_a) override
|
||||
{
|
||||
result = ledger.store.block_exists(transaction, block_a.previous());
|
||||
result = ledger.store.block_exists (transaction, block_a.previous ());
|
||||
}
|
||||
void receive_block (rai::receive_block const & block_a) override
|
||||
{
|
||||
result = ledger.store.block_exists(transaction, block_a.previous());
|
||||
result &= ledger.store.block_exists(transaction, block_a.source());
|
||||
result = ledger.store.block_exists (transaction, block_a.previous ());
|
||||
result &= ledger.store.block_exists (transaction, block_a.source ());
|
||||
}
|
||||
void open_block (rai::open_block const & block_a) override
|
||||
{
|
||||
result = ledger.store.block_exists(transaction, block_a.source ());
|
||||
result = ledger.store.block_exists (transaction, block_a.source ());
|
||||
}
|
||||
void change_block (rai::change_block const & block_a) override
|
||||
{
|
||||
result = ledger.store.block_exists(transaction, block_a.previous());
|
||||
result = ledger.store.block_exists (transaction, block_a.previous ());
|
||||
}
|
||||
void state_block (rai::state_block const & block_a) override
|
||||
{
|
||||
result = block_a.previous().is_zero() || ledger.store.block_exists (transaction, block_a.previous());
|
||||
result = block_a.previous ().is_zero () || ledger.store.block_exists (transaction, block_a.previous ());
|
||||
if (result && !ledger.is_send (transaction, block_a))
|
||||
{
|
||||
result &= ledger.store.block_exists(transaction, block_a.hashables.link);
|
||||
result &= ledger.store.block_exists (transaction, block_a.hashables.link);
|
||||
}
|
||||
}
|
||||
rai::ledger & ledger;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue