Skip to content

Commit

Permalink
Temporary disable stake transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
LenyKholodov committed Apr 13, 2019
1 parent 80a38c4 commit 2542518
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
24 changes: 12 additions & 12 deletions src/cryptonote_core/cryptonote_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ namespace cryptonote
core::core(i_cryptonote_protocol* pprotocol):
m_mempool(m_blockchain_storage),
m_blockchain_storage(m_mempool),
m_graft_stake_transaction_processor(m_blockchain_storage),
//m_graft_stake_transaction_processor(m_blockchain_storage),
m_miner(this),
m_miner_address(boost::value_initialized<account_public_address>()),
m_starter_message_showed(false),
Expand Down Expand Up @@ -450,8 +450,8 @@ namespace cryptonote
// folder might not be a directory, etc, etc
catch (...) { }

MGINFO("Initialize stake transaction processor");
m_graft_stake_transaction_processor.init_storages(folder.string());
//MGINFO("Initialize stake transaction processor");
//m_graft_stake_transaction_processor.init_storages(folder.string());

std::unique_ptr<BlockchainDB> db(new_db(db_type));

Expand Down Expand Up @@ -587,13 +587,13 @@ namespace cryptonote
const difficulty_type fixed_difficulty = command_line::get_arg(vm, arg_fixed_difficulty);
r = m_blockchain_storage.init(db.release(), m_nettype, m_offline, regtest ? &regtest_test_options : test_options, fixed_difficulty);

m_mempool.set_stake_transaction_processor(&m_graft_stake_transaction_processor);
//m_mempool.set_stake_transaction_processor(&m_graft_stake_transaction_processor);

r = m_mempool.init(max_txpool_weight);

CHECK_AND_ASSERT_MES(r, false, "Failed to initialize memory pool");

m_graft_stake_transaction_processor.synchronize();
//m_graft_stake_transaction_processor.synchronize();

// now that we have a valid m_blockchain_storage, we can clean out any
// transactions in the pool that do not conform to the current fork
Expand Down Expand Up @@ -1331,30 +1331,30 @@ namespace cryptonote
if (!m_blockchain_storage.add_new_block(b, bvc))
return false;

m_graft_stake_transaction_processor.synchronize();
//m_graft_stake_transaction_processor.synchronize();

return true;
}
//-----------------------------------------------------------------------------------------------
void core::set_update_stakes_handler(const supernode_stakes_update_handler& handler)
{
m_graft_stake_transaction_processor.set_on_update_stakes_handler(handler);
//m_graft_stake_transaction_processor.set_on_update_stakes_handler(handler);
}
//-----------------------------------------------------------------------------------------------
void core::invoke_update_stakes_handler()
{
m_graft_stake_transaction_processor.invoke_update_stakes_handler(true);
//m_graft_stake_transaction_processor.invoke_update_stakes_handler(true);
}
//-----------------------------------------------------------------------------------------------
void core::set_update_blockchain_based_list_handler(const blockchain_based_list_update_handler& handler)
{
m_graft_stake_transaction_processor.set_on_update_blockchain_based_list_handler(handler);
//m_graft_stake_transaction_processor.set_on_update_blockchain_based_list_handler(handler);
}
//-----------------------------------------------------------------------------------------------
void core::invoke_update_blockchain_based_list_handler(uint64_t last_received_block_height)
{
uint64_t depth = m_blockchain_storage.get_current_blockchain_height() - last_received_block_height;
m_graft_stake_transaction_processor.invoke_update_blockchain_based_list_handler(true, depth);
//uint64_t depth = m_blockchain_storage.get_current_blockchain_height() - last_received_block_height;
//m_graft_stake_transaction_processor.invoke_update_blockchain_based_list_handler(true, depth);
}
//-----------------------------------------------------------------------------------------------
bool core::prepare_handle_incoming_blocks(const std::vector<block_complete_entry> &blocks)
Expand Down Expand Up @@ -1546,7 +1546,7 @@ namespace cryptonote
m_check_disk_space_interval.do_call(boost::bind(&core::check_disk_space, this));
m_miner.on_idle();
m_mempool.on_idle();
m_graft_stake_transaction_processor.synchronize();
//m_graft_stake_transaction_processor.synchronize();
return true;
}
//-----------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_core/cryptonote_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ namespace cryptonote

tx_memory_pool m_mempool; //!< transaction pool instance
Blockchain m_blockchain_storage; //!< Blockchain instance
StakeTransactionProcessor m_graft_stake_transaction_processor; //<! StakeTransactionProcessor instance
//StakeTransactionProcessor m_graft_stake_transaction_processor; //<! StakeTransactionProcessor instance

i_cryptonote_protocol* m_pprotocol; //!< cryptonote protocol instance

Expand Down
5 changes: 3 additions & 2 deletions src/cryptonote_core/tx_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,8 @@ namespace cryptonote

bool tx_memory_pool::validate_supernode(uint64_t height, const public_key &id) const
{
supernode_stake * stake = const_cast<supernode_stake*>(m_stp->find_supernode_stake(height, epee::string_tools::pod_to_hex(id)));
return stake ? stake->amount >= config::graft::TIER1_STAKE_AMOUNT : false;
return true; //TODO: remove debug code
//supernode_stake * stake = const_cast<supernode_stake*>(m_stp->find_supernode_stake(height, epee::string_tools::pod_to_hex(id)));
//return stake ? stake->amount >= config::graft::TIER1_STAKE_AMOUNT : false;
};
}
10 changes: 5 additions & 5 deletions src/cryptonote_core/tx_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ namespace cryptonote
*/
void set_txpool_max_weight(size_t bytes);

void set_stake_transaction_processor(StakeTransactionProcessor * arg)
{
m_stp = arg;
}
//void set_stake_transaction_processor(StakeTransactionProcessor * arg)
//{
// m_stp = arg;
//}

#define CURRENT_MEMPOOL_ARCHIVE_VER 11
#define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER 13
Expand Down Expand Up @@ -595,7 +595,7 @@ namespace cryptonote

mutable std::unordered_map<crypto::hash, std::tuple<bool, tx_verification_context, uint64_t, crypto::hash>> m_input_cache;

StakeTransactionProcessor * m_stp = nullptr;
//StakeTransactionProcessor * m_stp = nullptr;
};
}

Expand Down

0 comments on commit 2542518

Please sign in to comment.