mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-03 17:29:24 +00:00
Code cleanup
This commit is contained in:
parent
9e287ab4f0
commit
93cd9a659a
4 changed files with 16 additions and 16 deletions
|
@ -60,8 +60,10 @@ P2PServer::P2PServer(p2pool* pool)
|
|||
|
||||
m_peerId = m_rng();
|
||||
|
||||
set_max_outgoing_peers(pool->params().m_maxOutgoingPeers);
|
||||
set_max_incoming_peers(pool->params().m_maxIncomingPeers);
|
||||
const Params& params = pool->params();
|
||||
|
||||
set_max_outgoing_peers(params.m_maxOutgoingPeers);
|
||||
set_max_incoming_peers(params.m_maxIncomingPeers);
|
||||
|
||||
uv_mutex_init_checked(&m_rngLock);
|
||||
uv_mutex_init_checked(&m_blockLock);
|
||||
|
@ -98,7 +100,7 @@ P2PServer::P2PServer(p2pool* pool)
|
|||
}
|
||||
|
||||
load_peer_list();
|
||||
start_listening(pool->params().m_p2pAddresses);
|
||||
start_listening(params.m_p2pAddresses);
|
||||
}
|
||||
|
||||
P2PServer::~P2PServer()
|
||||
|
@ -676,13 +678,15 @@ void P2PServer::remove_peer_from_list(const raw_ip& ip)
|
|||
|
||||
void P2PServer::broadcast(const PoolBlock& block)
|
||||
{
|
||||
if (block.m_txinGenHeight + 2 < m_pool->miner_data().height) {
|
||||
LOGWARN(3, "Trying to broadcast a stale block " << block.m_sidechainId << " (mainchain height " << block.m_txinGenHeight << ", current height is " << m_pool->miner_data().height << ')');
|
||||
const MinerData& miner_data = m_pool->miner_data();
|
||||
|
||||
if (block.m_txinGenHeight + 2 < miner_data.height) {
|
||||
LOGWARN(3, "Trying to broadcast a stale block " << block.m_sidechainId << " (mainchain height " << block.m_txinGenHeight << ", current height is " << miner_data.height << ')');
|
||||
return;
|
||||
}
|
||||
|
||||
if (block.m_txinGenHeight > m_pool->miner_data().height + 2) {
|
||||
LOGWARN(3, "Trying to broadcast a block " << block.m_sidechainId << " ahead on mainchain (mainchain height " << block.m_txinGenHeight << ", current height is " << m_pool->miner_data().height << ')');
|
||||
if (block.m_txinGenHeight > miner_data.height + 2) {
|
||||
LOGWARN(3, "Trying to broadcast a block " << block.m_sidechainId << " ahead on mainchain (mainchain height " << block.m_txinGenHeight << ", current height is " << miner_data.height << ')');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1100,10 +1100,11 @@ void p2pool::api_update_stats_mod()
|
|||
{
|
||||
MutexLock lock(m_foundBlocksLock);
|
||||
if (!m_foundBlocks.empty()) {
|
||||
last_block_found_time = m_foundBlocks.back().timestamp;
|
||||
last_block_found_height = m_foundBlocks.back().height;
|
||||
last_block_found_hash = m_foundBlocks.back().id;
|
||||
last_block_total_hashes = m_foundBlocks.back().total_hashes;
|
||||
const FoundBlock& b = m_foundBlocks.back();
|
||||
last_block_found_time = b.timestamp;
|
||||
last_block_found_height = b.height;
|
||||
last_block_found_hash = b.id;
|
||||
last_block_total_hashes = b.total_hashes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,6 @@ Wallet::Wallet(const char* address) : m_prefix(0), m_checksum(0), m_type(Network
|
|||
decode(address);
|
||||
}
|
||||
|
||||
Wallet::~Wallet()
|
||||
{
|
||||
}
|
||||
|
||||
Wallet::Wallet(const Wallet& w)
|
||||
{
|
||||
operator=(w);
|
||||
|
|
|
@ -25,7 +25,6 @@ class Wallet
|
|||
{
|
||||
public:
|
||||
explicit Wallet(const char* address);
|
||||
~Wallet();
|
||||
|
||||
Wallet(const Wallet& w);
|
||||
Wallet& operator=(const Wallet& w);
|
||||
|
|
Loading…
Reference in a new issue