Style fix, pass transaction as first argument. (#4592)

This commit is contained in:
clemahieu 2024-04-30 15:32:06 +01:00 committed by GitHub
commit ec636fa9f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 31 additions and 31 deletions

View file

@ -432,7 +432,7 @@ TEST (inactive_votes_cache, multiple_votes)
ASSERT_TIMELY_EQ (5s, node.vote_cache.find (send1->hash ()).size (), 2);
ASSERT_EQ (1, node.vote_cache.size ());
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
std::shared_ptr<nano::election> election;
ASSERT_TIMELY (5s, election = node.active.election (send1->qualified_root ()));
ASSERT_EQ (3, election->votes ().size ()); // 2 votes and 1 default not_an_acount
@ -1018,7 +1018,7 @@ TEST (active_transactions, confirmation_consistency)
system.deadline_set (5s);
while (!node.ledger.confirmed.block_exists_or_pruned (node.ledger.tx_begin_read (), block->hash ()))
{
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_NO_ERROR (system.poll (5ms));
}
ASSERT_NO_ERROR (system.poll_until_true (1s, [&node, &block, i] {
@ -1160,19 +1160,19 @@ TEST (active_transactions, activate_account_chain)
ASSERT_EQ (nano::block_status::progress, node.process (open));
ASSERT_EQ (nano::block_status::progress, node.process (receive));
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, node.active.election (send->qualified_root ()));
auto election1 = node.active.election (send->qualified_root ());
ASSERT_EQ (1, node.active.size ());
ASSERT_EQ (1, election1->blocks ().count (send->hash ()));
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
auto election2 = node.active.election (send->qualified_root ());
ASSERT_EQ (election2, election1);
election1->force_confirm ();
ASSERT_TIMELY (3s, node.block_confirmed (send->hash ()));
// On cementing, the next election is started
ASSERT_TIMELY (3s, node.active.active (send2->qualified_root ()));
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
auto election3 = node.active.election (send2->qualified_root ());
ASSERT_NE (nullptr, election3);
ASSERT_EQ (1, election3->blocks ().count (send2->hash ()));
@ -1181,11 +1181,11 @@ TEST (active_transactions, activate_account_chain)
// On cementing, the next election is started
ASSERT_TIMELY (3s, node.active.active (open->qualified_root ()));
ASSERT_TIMELY (3s, node.active.active (send3->qualified_root ()));
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
auto election4 = node.active.election (send3->qualified_root ());
ASSERT_NE (nullptr, election4);
ASSERT_EQ (1, election4->blocks ().count (send3->hash ()));
node.scheduler.priority.activate (key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), key.pub);
auto election5 = node.active.election (open->qualified_root ());
ASSERT_NE (nullptr, election5);
ASSERT_EQ (1, election5->blocks ().count (open->hash ()));
@ -1193,7 +1193,7 @@ TEST (active_transactions, activate_account_chain)
ASSERT_TIMELY (3s, node.block_confirmed (open->hash ()));
// Until send3 is also confirmed, the receive block should not activate
std::this_thread::sleep_for (200ms);
node.scheduler.priority.activate (key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), key.pub);
election4->force_confirm ();
ASSERT_TIMELY (3s, node.block_confirmed (send3->hash ()));
ASSERT_TIMELY (3s, node.active.active (receive->qualified_root ()));
@ -1334,7 +1334,7 @@ TEST (active_transactions, vacancy)
ASSERT_EQ (nano::block_status::progress, node.process (send));
ASSERT_EQ (1, node.active.vacancy ());
ASSERT_EQ (0, node.active.size ());
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (1s, updated);
updated = false;
ASSERT_EQ (0, node.active.vacancy ());
@ -1524,7 +1524,7 @@ TEST (active_transactions, allow_limited_overflow)
// Insert the first part of the blocks into normal election scheduler
for (auto const & block : blocks1)
{
node.scheduler.priority.activate (block->account (), node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), block->account ());
}
// Ensure number of active elections reaches AEC limit and there is no overfill
@ -1586,7 +1586,7 @@ TEST (active_transactions, allow_limited_overflow_adapt)
// Insert the first part of the blocks into normal election scheduler
for (auto const & block : blocks1)
{
node.scheduler.priority.activate (block->account (), node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), block->account ());
}
// Ensure number of active elections reaches AEC limit and there is no overfill

View file

@ -31,7 +31,7 @@ TEST (conflicts, start_stop)
node1.work_generate_blocking (*send1);
ASSERT_EQ (nano::block_status::progress, node1.process (send1));
ASSERT_EQ (0, node1.active.size ());
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ()));
auto election1 = node1.active.election (send1->qualified_root ());
ASSERT_EQ (1, node1.active.size ());
@ -64,7 +64,7 @@ TEST (conflicts, add_existing)
ASSERT_TIMELY (5s, node1.block (send1->hash ()));
// instruct the election scheduler to trigger an election for send1
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
// wait for election to be started before processing send2
ASSERT_TIMELY (5s, node1.active.active (*send1));

View file

@ -151,7 +151,7 @@ TEST (election, quorum_minimum_confirm_success)
.build ();
node1.work_generate_blocking (*send1);
node1.process_active (send1);
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ()));
auto election = node1.active.election (send1->qualified_root ());
ASSERT_NE (nullptr, election);

View file

@ -32,7 +32,7 @@ TEST (election_scheduler, activate_one_timely)
.work (*system.work.generate (nano::dev::genesis->hash ()))
.build ();
system.nodes[0]->ledger.process (system.nodes[0]->ledger.tx_begin_write (), send1);
system.nodes[0]->scheduler.priority.activate (nano::dev::genesis_key.pub, system.nodes[0]->ledger.tx_begin_read ());
system.nodes[0]->scheduler.priority.activate (system.nodes[0]->ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, system.nodes[0]->active.election (send1->qualified_root ()));
}
@ -50,7 +50,7 @@ TEST (election_scheduler, activate_one_flush)
.work (*system.work.generate (nano::dev::genesis->hash ()))
.build ();
system.nodes[0]->ledger.process (system.nodes[0]->ledger.tx_begin_write (), send1);
system.nodes[0]->scheduler.priority.activate (nano::dev::genesis_key.pub, system.nodes[0]->ledger.tx_begin_read ());
system.nodes[0]->scheduler.priority.activate (system.nodes[0]->ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, system.nodes[0]->active.election (send1->qualified_root ()));
}
@ -121,7 +121,7 @@ TEST (election_scheduler, no_vacancy)
ASSERT_EQ (nano::block_status::progress, node.process (block1));
// There is vacancy so it should be inserted
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
std::shared_ptr<nano::election> election{};
ASSERT_TIMELY (5s, (election = node.active.election (block1->qualified_root ())) != nullptr);
@ -137,7 +137,7 @@ TEST (election_scheduler, no_vacancy)
ASSERT_EQ (nano::block_status::progress, node.process (block2));
// There is no vacancy so it should stay queued
node.scheduler.priority.activate (key.pub, node.ledger.tx_begin_read ());
node.scheduler.priority.activate (node.ledger.tx_begin_read (), key.pub);
ASSERT_TIMELY_EQ (5s, node.scheduler.priority.size (), 1);
ASSERT_EQ (node.active.election (block2->qualified_root ()), nullptr);

View file

@ -963,7 +963,7 @@ TEST (votes, check_signature)
auto transaction = node1.ledger.tx_begin_write ();
ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1));
}
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ()));
auto election1 = node1.active.election (send1->qualified_root ());
ASSERT_EQ (1, election1->votes ().size ());
@ -1034,7 +1034,7 @@ TEST (votes, add_existing)
.build ();
node1.work_generate_blocking (*send1);
ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.ledger.tx_begin_write (), send1));
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ()));
auto election1 = node1.active.election (send1->qualified_root ());
auto vote1 = nano::test::make_vote (nano::dev::genesis_key, { send1 }, nano::vote::timestamp_min * 1, 0);

View file

@ -370,7 +370,7 @@ TEST (receivable_processor, confirm_insufficient_pos)
.build ();
node1.work_generate_blocking (*block1);
ASSERT_EQ (nano::block_status::progress, node1.process (block1));
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
nano::keypair key1;
auto vote = nano::test::make_vote (key1, { block1 }, 0, 0);
nano::confirm_ack con1{ nano::dev::network_params.network, vote };
@ -393,7 +393,7 @@ TEST (receivable_processor, confirm_sufficient_pos)
.build ();
node1.work_generate_blocking (*block1);
ASSERT_EQ (nano::block_status::progress, node1.process (block1));
node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.ledger.tx_begin_read ());
node1.scheduler.priority.activate (node1.ledger.tx_begin_read (), nano::dev::genesis_key.pub);
auto vote = nano::test::make_vote (nano::dev::genesis_key, { block1 }, 0, 0);
nano::confirm_ack con1{ nano::dev::network_params.network, vote };
auto channel1 = std::make_shared<nano::transport::inproc::channel> (node1, node1);

View file

@ -1362,7 +1362,7 @@ TEST (node, rep_self_vote)
ASSERT_EQ (nano::block_status::progress, node0->process (block0));
auto & active = node0->active;
auto & scheduler = node0->scheduler;
scheduler.priority.activate (nano::dev::genesis_key.pub, node0->ledger.tx_begin_read ());
scheduler.priority.activate (node0->ledger.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_TIMELY (5s, active.election (block0->qualified_root ()));
auto election1 = active.election (block0->qualified_root ());
ASSERT_NE (nullptr, election1);
@ -3897,4 +3897,4 @@ TEST (node, port_mapping)
nano::test::system system;
auto node = system.add_node ();
node->port_mapping.refresh_devices ();
}
}

View file

@ -144,12 +144,12 @@ void nano::active_transactions::notify_observers (nano::secure::read_transaction
void nano::active_transactions::activate_successors (nano::secure::read_transaction const & transaction, std::shared_ptr<nano::block> const & block)
{
node.scheduler.priority.activate (block->account (), transaction);
node.scheduler.priority.activate (transaction, block->account ());
// Start or vote for the next unconfirmed block in the destination account
if (block->is_send () && !block->destination ().is_zero () && block->destination () != block->account ())
{
node.scheduler.priority.activate (block->destination (), transaction);
node.scheduler.priority.activate (transaction, block->destination ());
}
}

View file

@ -222,7 +222,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
};
backlog.activate_callback.add ([this] (secure::transaction const & transaction, nano::account const & account) {
scheduler.priority.activate (account, transaction);
scheduler.priority.activate (transaction, account);
scheduler.optimistic.activate (transaction, account);
});

View file

@ -46,7 +46,7 @@ void nano::process_live_dispatcher::process_live (nano::block const & block, sec
// Start collecting quorum on block
if (ledger.dependents_confirmed (transaction, block))
{
scheduler.activate (block.account (), transaction);
scheduler.activate (transaction, block.account ());
}
if (websocket.server && websocket.server->any_subscriber (nano::websocket::topic::new_unconfirmed_block))

View file

@ -41,7 +41,7 @@ void nano::scheduler::priority::stop ()
nano::join_or_pass (thread);
}
bool nano::scheduler::priority::activate (nano::account const & account, secure::transaction const & transaction)
bool nano::scheduler::priority::activate (secure::transaction const & transaction, nano::account const & account)
{
debug_assert (!account.is_zero ());
auto head = node.ledger.confirmed.account_head (transaction, account);

View file

@ -38,7 +38,7 @@ public:
* Activates the first unconfirmed block of \p account_a
* @return true if account was activated
*/
bool activate (nano::account const &, secure::transaction const &);
bool activate (secure::transaction const &, nano::account const &);
void notify ();
std::size_t size () const;
bool empty () const;

View file

@ -2456,7 +2456,7 @@ TEST (rpc, account_representative_set_epoch_2_insufficient_work)
ASSERT_NE (nullptr, system.upgrade_genesis_epoch (*node, nano::epoch::epoch_2));
// speed up the cementing process, otherwise the node waits for frontiers confirmation to notice the unconfirmed epoch blocks, which takes time
node->scheduler.priority.activate (nano::dev::genesis_key.pub, node->ledger.tx_begin_read ());
node->scheduler.priority.activate (node->ledger.tx_begin_read (), nano::dev::genesis_key.pub);
// wait for the epoch blocks to be cemented
ASSERT_TIMELY_EQ (5s, node->ledger.confirmed.account_height (node->ledger.tx_begin_read (), nano::dev::genesis_key.pub), 3);