Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update confirmation height in another thread #1877

Merged
merged 56 commits into from Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
cd22e82
Move confirmation height updating to another thread
wezrule Apr 2, 2019
150082d
Fix Linux/gcc build
wezrule Apr 2, 2019
f8e4b83
Formatting
wezrule Apr 2, 2019
7acea75
Re-add equal comparison
wezrule Apr 3, 2019
1055438
Use pessimistic approach for updating confirmation heights
wezrule Apr 3, 2019
f451dee
Pop pending confirmation before using it (like previously)
wezrule Apr 4, 2019
2f90cbf
Add confirmation height stats
wezrule Apr 4, 2019
c4450ad
Add to memory stats RPC
wezrule Apr 4, 2019
cbe91bf
Rename confirmation_height_processor.hpp/cpp to remove underscores
wezrule Apr 6, 2019
988e671
Add minor optimization to reuse a potential unncessary read
wezrule Apr 6, 2019
26a8029
Fix build removing underscores when including the files
wezrule Apr 6, 2019
df2df50
Change open_receive to receive to improve readability
wezrule Apr 7, 2019
dda6ca3
Check if processor is stopped and exit early in inner do-while loop
wezrule Apr 7, 2019
457154a
Revert to checking active roots by default if ledger.blocks_confirmed…
wezrule Apr 8, 2019
eaa63ae
Use node store not wallet in wallet_pending
wezrule Apr 8, 2019
f1ee514
Change back to using underscores for filenames
wezrule Apr 8, 2019
fcdf2c2
Only start confirming frontiers when there aren't many confirmations …
wezrule Apr 9, 2019
5f65cdd
Merge branch 'master' into confirmation_height_processor
wezrule Apr 9, 2019
fd7b66c
Formatting
wezrule Apr 9, 2019
52be111
Forgot to add the newly extracted pending_confirmation_height to the …
wezrule Apr 9, 2019
074cc5e
Memory stats RPC can take a while if the confirmation height processo…
wezrule Apr 9, 2019
787d22e
Merge branch 'master' into confirmation_height_processor
wezrule Apr 11, 2019
24eeb43
Merge branch 'confirmation_height_processor' of https://github.com/we…
wezrule Apr 11, 2019
bebfddd
Merge with master
wezrule Apr 12, 2019
dd242e0
Add CLI --debug_block_cemented_count
wezrule Apr 13, 2019
6f0e262
Add break to confirmation_height_processing thread name setting
wezrule Apr 13, 2019
6ae949c
Check confirmation height processing queue in RPCs block_info and blo…
wezrule Apr 13, 2019
d841aad
Write in batches
wezrule Apr 14, 2019
a155d1d
Merge master
wezrule Apr 14, 2019
1495228
Fix assert build issue
wezrule Apr 15, 2019
099ebd2
Add "include_only_confirmed" option to rpc tests
wezrule Apr 15, 2019
638ced5
Fix num_blocks_process issue
wezrule Apr 16, 2019
f8beca9
Add tests for recursive chains, long chains and all block types
wezrule Apr 16, 2019
61e9fda
Formatting
wezrule Apr 16, 2019
1e6464b
Use new helper function in various places to check whether a block ha…
wezrule Apr 16, 2019
25815d8
Merge branch 'confirmation_height_processor' of https://github.com/we…
wezrule Apr 16, 2019
792653f
Review comments
wezrule Apr 17, 2019
0f4442a
Formatting
wezrule Apr 17, 2019
ed6a856
Protect the current hash
wezrule Apr 17, 2019
83eaf6d
Update comment placement
wezrule Apr 17, 2019
dd518e5
Correctly confirm all the blocks before the first encountered receive…
wezrule Apr 18, 2019
f371ef8
Make sure lock () is always set when exiting do while loop
wezrule Apr 18, 2019
a425679
Replace std::mutex for receive_source_pairs with a cached atomic with…
wezrule Apr 19, 2019
8fc3f4f
Remove ledger dependency
wezrule Apr 19, 2019
0c69de0
Add unstable/debug RPC command confirmation_height_currently_processi…
wezrule Apr 19, 2019
ced1c1b
Send intentionally unpocketed transactions to a new account to preven…
wezrule Apr 19, 2019
9d8f038
Make the last confirmation part of the do-while loop
wezrule Apr 19, 2019
d8f2a5b
Check for is_zero and epoch link
wezrule Apr 19, 2019
c2b2068
Make sure the confirmation height processing is done before sending t…
wezrule Apr 19, 2019
796bed7
Give all parameters _a suffix
wezrule Apr 19, 2019
f1da573
Make block_confirmed in rpc_handler have a single return at end
wezrule Apr 20, 2019
2ad4bd3
Make receive_source_pairs_size == 0 an assert instead of release_assert
wezrule Apr 20, 2019
a5114fb
Merge with master
wezrule Apr 22, 2019
58f8573
Formatting
wezrule Apr 22, 2019
f323606
Merge with master
wezrule Apr 24, 2019
c4674c5
Formatting
wezrule Apr 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
256 changes: 240 additions & 16 deletions nano/core_test/network.cpp

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions nano/lib/errors.cpp
Expand Up @@ -146,6 +146,8 @@ std::string nano::error_rpc_messages::message (int ev) const
return "Representative account and previous hash required";
case nano::error_rpc::block_create_requirements_send:
return "Destination account, previous hash, current balance and amount required";
case nano::error_rpc::confirmation_height_not_processing:
return "There are no blocks currently being processed for adding confirmation height";
case nano::error_rpc::confirmation_not_found:
return "Active confirmation not found";
case nano::error_rpc::difficulty_limit:
Expand Down
1 change: 1 addition & 0 deletions nano/lib/errors.hpp
Expand Up @@ -89,6 +89,7 @@ enum class error_rpc
block_create_requirements_receive,
block_create_requirements_change,
block_create_requirements_send,
confirmation_height_not_processing,
confirmation_not_found,
difficulty_limit,
invalid_balance,
Expand Down
3 changes: 3 additions & 0 deletions nano/lib/utility.cpp
Expand Up @@ -102,6 +102,9 @@ namespace thread_role
case nano::thread_role::name::rpc_process_container:
thread_role_name_string = "RPC process";
break;
case nano::thread_role::name::confirmation_height_processing:
thread_role_name_string = "Conf height";
wezrule marked this conversation as resolved.
Show resolved Hide resolved
break;
}

/*
Expand Down
3 changes: 2 additions & 1 deletion nano/lib/utility.hpp
Expand Up @@ -87,7 +87,8 @@ namespace thread_role
voting,
signature_checking,
rpc_request_processor,
rpc_process_container
rpc_process_container,
confirmation_height_processing
};
/*
* Get/Set the identifier for the current thread
Expand Down
15 changes: 14 additions & 1 deletion nano/nano_node/entry.cpp
Expand Up @@ -98,7 +98,7 @@ int main (int argc, char * const * argv)
("debug_random_feed", "Generates output to RNG test suites")
("debug_validate_blocks", "Check all blocks for correct hash, signature, work value")
("debug_peers", "Display peer IPv6:port connections")
("debug_ipc", "Read an IPC command in JSON from stdin and invoke it. Network operations will have no effect")
("debug_cemented_block_count", "Displays the number of cemented (confirmed) blocks")
("platform", boost::program_options::value<std::string> (), "Defines the <platform> for OpenCL commands")
("device", boost::program_options::value<std::string> (), "Defines <device> for OpenCL command")
("threads", boost::program_options::value<std::string> (), "Defines <threads> count for OpenCL command")
Expand Down Expand Up @@ -960,6 +960,19 @@ int main (int argc, char * const * argv)
std::cout << boost::str (boost::format ("%1%\n") % nano::endpoint (boost::asio::ip::address_v6 (i->first.address_bytes ()), i->first.port ()));
}
}
else if (vm.count ("debug_cemented_block_count"))
{
nano::inactive_node node (data_path);
auto transaction (node.node->store.tx_begin ());

uint64_t sum = 0;
for (auto i (node.node->store.latest_begin (transaction)), n (node.node->store.latest_end ()); i != n; ++i)
{
nano::account_info info (i->second);
sum += info.confirmation_height;
}
std::cout << "Total cemented block count: " << sum << std::endl;
}
else if (vm.count ("version"))
{
if (NANO_VERSION_PATCH == 0)
Expand Down
7 changes: 6 additions & 1 deletion nano/node/CMakeLists.txt
Expand Up @@ -12,6 +12,9 @@ endif ()

add_library (node
${platform_sources}
active_transactions.hpp
active_transactions.cpp
blockprocessor.cpp
blockprocessor.hpp
blockprocessor.cpp
bootstrap.hpp
Expand All @@ -20,8 +23,10 @@ add_library (node
cli.cpp
common.hpp
common.cpp
daemonconfig.cpp
confirmation_height_processor.hpp
wezrule marked this conversation as resolved.
Show resolved Hide resolved
confirmation_height_processor.cpp
daemonconfig.hpp
daemonconfig.cpp
ipc.hpp
ipc.cpp
ipcconfig.hpp
Expand Down