mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-05 18:29:23 +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();
|
m_peerId = m_rng();
|
||||||
|
|
||||||
set_max_outgoing_peers(pool->params().m_maxOutgoingPeers);
|
const Params& params = pool->params();
|
||||||
set_max_incoming_peers(pool->params().m_maxIncomingPeers);
|
|
||||||
|
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_rngLock);
|
||||||
uv_mutex_init_checked(&m_blockLock);
|
uv_mutex_init_checked(&m_blockLock);
|
||||||
|
@ -98,7 +100,7 @@ P2PServer::P2PServer(p2pool* pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
load_peer_list();
|
load_peer_list();
|
||||||
start_listening(pool->params().m_p2pAddresses);
|
start_listening(params.m_p2pAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
P2PServer::~P2PServer()
|
P2PServer::~P2PServer()
|
||||||
|
@ -676,13 +678,15 @@ void P2PServer::remove_peer_from_list(const raw_ip& ip)
|
||||||
|
|
||||||
void P2PServer::broadcast(const PoolBlock& block)
|
void P2PServer::broadcast(const PoolBlock& block)
|
||||||
{
|
{
|
||||||
if (block.m_txinGenHeight + 2 < m_pool->miner_data().height) {
|
const MinerData& miner_data = m_pool->miner_data();
|
||||||
LOGWARN(3, "Trying to broadcast a stale block " << block.m_sidechainId << " (mainchain height " << block.m_txinGenHeight << ", current height is " << m_pool->miner_data().height << ')');
|
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.m_txinGenHeight > m_pool->miner_data().height + 2) {
|
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 " << m_pool->miner_data().height << ')');
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1100,10 +1100,11 @@ void p2pool::api_update_stats_mod()
|
||||||
{
|
{
|
||||||
MutexLock lock(m_foundBlocksLock);
|
MutexLock lock(m_foundBlocksLock);
|
||||||
if (!m_foundBlocks.empty()) {
|
if (!m_foundBlocks.empty()) {
|
||||||
last_block_found_time = m_foundBlocks.back().timestamp;
|
const FoundBlock& b = m_foundBlocks.back();
|
||||||
last_block_found_height = m_foundBlocks.back().height;
|
last_block_found_time = b.timestamp;
|
||||||
last_block_found_hash = m_foundBlocks.back().id;
|
last_block_found_height = b.height;
|
||||||
last_block_total_hashes = m_foundBlocks.back().total_hashes;
|
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);
|
decode(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallet::~Wallet()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Wallet::Wallet(const Wallet& w)
|
Wallet::Wallet(const Wallet& w)
|
||||||
{
|
{
|
||||||
operator=(w);
|
operator=(w);
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Wallet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Wallet(const char* address);
|
explicit Wallet(const char* address);
|
||||||
~Wallet();
|
|
||||||
|
|
||||||
Wallet(const Wallet& w);
|
Wallet(const Wallet& w);
|
||||||
Wallet& operator=(const Wallet& w);
|
Wallet& operator=(const Wallet& w);
|
||||||
|
|
Loading…
Reference in a new issue