fixed migration of mining from CN to Carrot, including stopping miners from using wrong address pre- and post-Carrot HF
This commit is contained in:
@@ -669,6 +669,7 @@ namespace cryptonote
|
||||
{
|
||||
crypto::public_key m_spend_public_key;
|
||||
crypto::public_key m_view_public_key;
|
||||
bool m_is_carrot;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(m_spend_public_key)
|
||||
@@ -683,7 +684,8 @@ namespace cryptonote
|
||||
bool operator==(const account_public_address& rhs) const
|
||||
{
|
||||
return m_spend_public_key == rhs.m_spend_public_key &&
|
||||
m_view_public_key == rhs.m_view_public_key;
|
||||
m_view_public_key == rhs.m_view_public_key &&
|
||||
m_is_carrot == rhs.m_is_carrot;
|
||||
}
|
||||
|
||||
bool operator!=(const account_public_address& rhs) const
|
||||
|
||||
@@ -285,6 +285,8 @@ namespace cryptonote {
|
||||
LOG_PRINT_L1("Failed to validate address keys");
|
||||
return false;
|
||||
}
|
||||
|
||||
info.address.m_is_carrot = info.is_carrot;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,6 +318,7 @@ namespace cryptonote {
|
||||
|
||||
//we success
|
||||
info.address = blob.m_address;
|
||||
info.address.m_is_carrot = false;
|
||||
info.is_subaddress = false;
|
||||
info.has_payment_id = false;
|
||||
info.is_carrot = false;
|
||||
|
||||
@@ -176,6 +176,7 @@ namespace cryptonote
|
||||
if(!m_phandler->get_block_template(bl, m_mine_address, di, height, expected_reward, extra_nonce, seed_height, seed_hash))
|
||||
{
|
||||
LOG_ERROR("Failed to get_block_template(), stopping mining");
|
||||
stop();
|
||||
return false;
|
||||
}
|
||||
set_block_template(bl, di, height, expected_reward);
|
||||
@@ -185,7 +186,12 @@ namespace cryptonote
|
||||
bool miner::on_idle()
|
||||
{
|
||||
m_update_block_template_interval.do_call([&](){
|
||||
if(is_mining())request_block_template();
|
||||
if(is_mining()) {
|
||||
if (!request_block_template()) {
|
||||
stop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -393,7 +399,10 @@ namespace cryptonote
|
||||
return false;
|
||||
}
|
||||
|
||||
request_block_template();//lets update block template
|
||||
if (!request_block_template()) {
|
||||
LOG_ERROR("Unable to start miner - unknown error");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_stop = false;
|
||||
m_thread_index = 0;
|
||||
|
||||
Reference in New Issue
Block a user