Getting work factors to function.
This commit is contained in:
parent
918006153b
commit
961600d5c7
4 changed files with 22 additions and 14 deletions
|
@ -83,10 +83,13 @@ add_executable (qt_system
|
|||
SET (GENESIS_KEY rai_test_address CACHE STRING "Select whether the genesis address is the test or live address")
|
||||
set_property (CACHE GENESIS_KEY PROPERTY STRINGS rai_test_address rai_live_address)
|
||||
|
||||
SET (WORK_FACTOR rai_test_work CACHE STRING "Selects whether full or test work is performed")
|
||||
set_property (CACHE WORK_FACTOR PROPERTY STRINGS rai_test_work rai_full_work)
|
||||
SET (KDF_WORK_FACTOR kdf_test_work CACHE STRING "Selects whether full or test kdf work is performed")
|
||||
set_property (CACHE KDF_WORK_FACTOR PROPERTY STRINGS kdf_test_work kdf_full_work)
|
||||
|
||||
set_target_properties (secure core test qt_test cli qt qt_client qt_system PROPERTIES COMPILE_FLAGS "-std=c++11 -Werror=switch ${PLATFORM_COMPILE_FLAGS} -DQT_NO_KEYWORDS -DGENESIS_KEY=${GENESIS_KEY} -DWORK_FACTOR=${WORK_FACTOR} -DED25519_CUSTOMHASH -DED25519_CUSTOMRNG")
|
||||
SET (PUBLISH_WORK_FACTOR publish_test_work CACHE STRING "Selects whether full or test publish work is performed")
|
||||
set_property (CACHE PUBLISH_WORK_FACTOR PROPERTY STRINGS publish_test_work publish_full_work)
|
||||
|
||||
set_target_properties (secure core test qt_test cli qt qt_client qt_system PROPERTIES COMPILE_FLAGS "-std=c++11 -Werror=switch ${PLATFORM_COMPILE_FLAGS} -DQT_NO_KEYWORDS -DGENESIS_KEY=${GENESIS_KEY} -DKDF_WORK_FACTOR=${KDF_WORK_FACTOR} -DPUBLISH_WORK_FACTOR=${PUBLISH_WORK_FACTOR} -DED25519_CUSTOMHASH -DED25519_CUSTOMRNG")
|
||||
set_target_properties (qt_client qt_test PROPERTIES LINK_FLAGS "${PLATFORM_GUI_EXE_LINK_FLAGS}")
|
||||
|
||||
if (WIN32)
|
||||
|
|
|
@ -141,7 +141,7 @@ int main (int argc, char * const * argv)
|
|||
auto begin1 (std::chrono::high_resolution_clock::now ());
|
||||
auto value (work.create (source));
|
||||
auto end1 (std::chrono::high_resolution_clock::now ());
|
||||
(void)work.validate (source, value);
|
||||
work.validate (source, value);
|
||||
auto end2 (std::chrono::high_resolution_clock::now ());
|
||||
std::cerr << boost::str (boost::format ("Generation time: %1%us validation time: %2%us\n") % std::chrono::duration_cast <std::chrono::microseconds> (end1 - begin1).count () % std::chrono::duration_cast <std::chrono::microseconds> (end2 - end1).count ());
|
||||
}
|
||||
|
|
|
@ -3897,9 +3897,9 @@ namespace
|
|||
class kdf
|
||||
{
|
||||
public:
|
||||
size_t static constexpr rai_full_work = 8 * 1024 * 1024;
|
||||
size_t static constexpr rai_test_work = 8 * 1024;
|
||||
size_t static constexpr entry_count = WORK_FACTOR;
|
||||
size_t static constexpr kdf_full_work = 8 * 1024 * 1024;
|
||||
size_t static constexpr kdf_test_work = 8 * 1024;
|
||||
size_t static constexpr entry_count = KDF_WORK_FACTOR;
|
||||
kdf (std::string const & password_a, rai::uint256_union const & salt_a)
|
||||
{
|
||||
auto entries (entry_count);
|
||||
|
@ -3950,13 +3950,18 @@ bool rai::publish::operator == (rai::publish const & other_a) const
|
|||
return work == other_a.work && *block == *other_a.block;
|
||||
}
|
||||
|
||||
rai::work::work () :
|
||||
entry_requirement (8 * 1024),
|
||||
iteration_requirement (8 * 1024)
|
||||
namespace
|
||||
{
|
||||
size_t publish_test_work (1024);
|
||||
size_t publish_full_work (128 * 1024);
|
||||
size_t publish_work (PUBLISH_WORK_FACTOR);
|
||||
}
|
||||
|
||||
rai::work::work () :
|
||||
threshold_requirement ("fe00000000000000000000000000000000000000000000000000000000000000"),
|
||||
entry_requirement (publish_work),
|
||||
iteration_requirement (publish_work)
|
||||
{
|
||||
auto error (threshold_requirement.decode_hex ("ff00000000000000000000000000000000000000000000000000000000000000"));
|
||||
//auto error (threshold_requirement.decode_hex ("8000000000000000000000000000000000000000000000000000000000000000"));
|
||||
assert (!error);
|
||||
entries.resize (entry_requirement);
|
||||
}
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ peers_model (new QStringListModel),
|
|||
peers_view (new QListView),
|
||||
peers_refresh (new QPushButton ("Refresh")),
|
||||
peers_back (new QPushButton ("Back")),
|
||||
scale ("100000000000000000000"),
|
||||
scale ("100000000000000000000"), // 10 ^ 20
|
||||
client (client_a)
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue