Fixing formatting.
This commit is contained in:
parent
d61b3ac855
commit
cec5dc4f7d
5 changed files with 21 additions and 20 deletions
|
@ -1480,17 +1480,17 @@ TEST (node, block_confirm)
|
|||
{
|
||||
rai::system system (24000, 1);
|
||||
rai::genesis genesis;
|
||||
system.nodes [0]->ledger.state_block_parse_canary = genesis.hash ();
|
||||
system.nodes[0]->ledger.state_block_parse_canary = 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, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes [0]->generate_work (genesis.hash ())));
|
||||
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, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes[0]->generate_work (genesis.hash ())));
|
||||
{
|
||||
rai::transaction transaction (system.nodes [0]->store.environment, nullptr, true);
|
||||
ASSERT_EQ (rai::process_result::progress, system.nodes [0]->ledger.process (transaction, *send1).code);
|
||||
rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true);
|
||||
ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *send1).code);
|
||||
}
|
||||
system.nodes [0]->block_confirm (send1);
|
||||
ASSERT_TRUE (system.nodes [0]->active.confirmed.empty ());
|
||||
system.nodes[0]->block_confirm (send1);
|
||||
ASSERT_TRUE (system.nodes[0]->active.confirmed.empty ());
|
||||
auto iterations (0);
|
||||
while (system.nodes [0]->active.confirmed.empty ())
|
||||
while (system.nodes[0]->active.confirmed.empty ())
|
||||
{
|
||||
system.poll ();
|
||||
++iterations;
|
||||
|
|
|
@ -3515,12 +3515,12 @@ TEST (rpc, block_confirm)
|
|||
rai::system system (24000, 1);
|
||||
system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv);
|
||||
rai::genesis genesis;
|
||||
system.nodes [0]->ledger.state_block_parse_canary = genesis.hash ();
|
||||
system.nodes[0]->ledger.state_block_parse_canary = 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, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes [0]->generate_work (genesis.hash ())));
|
||||
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, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes[0]->generate_work (genesis.hash ())));
|
||||
{
|
||||
rai::transaction transaction (system.nodes [0]->store.environment, nullptr, true);
|
||||
ASSERT_EQ (rai::process_result::progress, system.nodes [0]->ledger.process (transaction, *send1).code);
|
||||
rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true);
|
||||
ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *send1).code);
|
||||
}
|
||||
rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true));
|
||||
rpc.start ();
|
||||
|
@ -3533,13 +3533,14 @@ TEST (rpc, block_confirm)
|
|||
system.poll ();
|
||||
}
|
||||
ASSERT_EQ (200, response.status);
|
||||
ASSERT_EQ ("1", response.json.get <std::string> ("started"));
|
||||
ASSERT_EQ ("1", response.json.get<std::string> ("started"));
|
||||
}
|
||||
|
||||
TEST (rpc, block_confirm_absent)
|
||||
{
|
||||
rai::system system (24000, 1);
|
||||
system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true));
|
||||
system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv);
|
||||
rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true));
|
||||
rpc.start ();
|
||||
boost::property_tree::ptree request;
|
||||
request.put ("action", "block_confirm");
|
||||
|
@ -3550,5 +3551,5 @@ TEST (rpc, block_confirm_absent)
|
|||
system.poll ();
|
||||
}
|
||||
ASSERT_EQ (200, response.status);
|
||||
ASSERT_EQ ("Block not found", response.json.get <std::string> ("error"));
|
||||
ASSERT_EQ ("Block not found", response.json.get<std::string> ("error"));
|
||||
}
|
||||
|
|
|
@ -2391,7 +2391,7 @@ void rai::node::add_initial_peers ()
|
|||
{
|
||||
}
|
||||
|
||||
void rai::node::block_confirm (std::shared_ptr <rai::block> block_a)
|
||||
void rai::node::block_confirm (std::shared_ptr<rai::block> block_a)
|
||||
{
|
||||
rai::transaction transaction (store.environment, nullptr, false);
|
||||
active.start (transaction, block_a);
|
||||
|
@ -2462,7 +2462,7 @@ public:
|
|||
MDB_txn * transaction;
|
||||
rai::node & node;
|
||||
std::shared_ptr<rai::block> block;
|
||||
rai::block_hash const &hash;
|
||||
rai::block_hash const & hash;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2478,13 +2478,13 @@ void rai::node::process_confirmed (std::shared_ptr<rai::block> block_a)
|
|||
auto amount (ledger.amount (transaction, hash));
|
||||
bool is_state_send (false);
|
||||
rai::account pending_account (0);
|
||||
if (auto state = dynamic_cast <rai::state_block *> (block_a.get ()))
|
||||
if (auto state = dynamic_cast<rai::state_block *> (block_a.get ()))
|
||||
{
|
||||
rai::transaction transaction (store.environment, nullptr, false);
|
||||
is_state_send = ledger.is_send (transaction, *state);
|
||||
pending_account = state->hashables.link;
|
||||
}
|
||||
if (auto send = dynamic_cast <rai::send_block *> (block_a.get ()))
|
||||
if (auto send = dynamic_cast<rai::send_block *> (block_a.get ()))
|
||||
{
|
||||
pending_account = send->hashables.destination;
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ public:
|
|||
uint64_t generate_work (rai::uint256_union const &);
|
||||
void generate_work (rai::uint256_union const &, std::function<void(uint64_t)>);
|
||||
void add_initial_peers ();
|
||||
void block_confirm (std::shared_ptr <rai::block>);
|
||||
void block_confirm (std::shared_ptr<rai::block>);
|
||||
boost::asio::io_service & service;
|
||||
rai::node_config config;
|
||||
rai::alarm & alarm;
|
||||
|
|
|
@ -2588,7 +2588,7 @@ void rai::rpc_handler::process ()
|
|||
auto account (node.ledger.account (transaction, hash));
|
||||
auto amount (node.ledger.amount (transaction, hash));
|
||||
bool is_state_send (false);
|
||||
if (auto state = dynamic_cast <rai::state_block *> (block_a.get ()))
|
||||
if (auto state = dynamic_cast<rai::state_block *> (block_a.get ()))
|
||||
{
|
||||
rai::transaction transaction (node.store.environment, nullptr, false);
|
||||
is_state_send = node.ledger.is_send (transaction, *state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue