Skip to content

Commit

Permalink
Removing logging.
Browse files Browse the repository at this point in the history
Copy accounts locally within signature verification.
  • Loading branch information
clemahieu committed Feb 5, 2023
1 parent 2c8c34b commit 80205a0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,6 @@ TEST (ledger, epoch_open_pending)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*pool.generate (key1.pub))
.build_shared ();
std::cerr << boost::str (boost::format ("epoch open: %1%\n") % epoch_open->hash ().to_string ());
auto process_result = node1.ledger.process (node1.store.tx_begin_write (), *epoch_open);
ASSERT_EQ (nano::process_result::gap_epoch_open_pending, process_result.code);
node1.block_processor.add (epoch_open);
Expand Down
4 changes: 2 additions & 2 deletions nano/node/block_pipeline/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ nano::block_hash nano::block_pipeline::context::source () const
return 0;
}

nano::account const & nano::block_pipeline::context::signer (nano::epochs const & epochs) const
nano::account nano::block_pipeline::context::signer (nano::epochs const & epochs) const
{
debug_assert (block != nullptr);
switch (block->type ())
Expand Down Expand Up @@ -102,7 +102,7 @@ nano::account const & nano::block_pipeline::context::signer (nano::epochs const
break;
}
// std::unreachable (); c++23
return account_one; // Return an account that cannot be signed for.
return 1; // Return an account that cannot be signed for.
}

bool nano::block_pipeline::context::gap_previous () const
Expand Down
2 changes: 1 addition & 1 deletion nano/node/block_pipeline/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace block_pipeline
bool is_send () const;
nano::account account () const;
nano::block_hash source () const;
nano::account const & signer (nano::epochs const & epochs) const;
nano::account signer (nano::epochs const & epochs) const;
bool gap_previous () const;
std::shared_ptr<nano::block> block;
std::shared_ptr<nano::block> previous;
Expand Down
4 changes: 0 additions & 4 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ nano::block_processor::block_processor (nano::node & node_a, nano::write_databas
{
metastable.sink (items[i]);
}
else
{
std::cerr << "Signature failure\n";
}
}
};
metastable.pass = [this] (block_pipeline::context & context) {
Expand Down
6 changes: 4 additions & 2 deletions nano/node/state_block_signature_verification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ void nano::state_block_signature_verification::verify_state_blocks (std::deque<v
messages.reserve (size);
std::vector<std::size_t> lengths;
lengths.reserve (size);
std::vector<nano::account> accounts;
accounts.reserve (size);
std::vector<unsigned char const *> pub_keys;
pub_keys.reserve (size);
std::vector<nano::signature> blocks_signatures;
Expand All @@ -132,11 +134,11 @@ void nano::state_block_signature_verification::verify_state_blocks (std::deque<v
for (auto const & item : items)
{
auto const & block = item.block;
auto const & signer = item.signer (epochs);
hashes.push_back (block->hash ());
messages.push_back (hashes.back ().bytes.data ());
lengths.push_back (sizeof (decltype (hashes)::value_type));
pub_keys.push_back (signer.bytes.data ());
accounts.push_back (item.signer (epochs));
pub_keys.push_back (accounts.back ().bytes.data ());
blocks_signatures.push_back (block->block_signature ());
signatures.push_back (blocks_signatures.back ().bytes.data ());
}
Expand Down

0 comments on commit 80205a0

Please sign in to comment.