mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-09 12:19:26 +00:00
Code cleanup and fixes
This commit is contained in:
parent
975679ef87
commit
1cfacf4118
4 changed files with 12 additions and 7 deletions
|
@ -309,6 +309,11 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet
|
|||
FORCEINLINE Precalc(Precalc&& rhs) noexcept : txKeySec(rhs.txKeySec), counter(rhs.counter.load()), shares(rhs.shares) { rhs.shares = nullptr; }
|
||||
FORCEINLINE ~Precalc() { free_hook(shares); }
|
||||
|
||||
// Disable any other way of copying/moving Precalc
|
||||
Precalc(const Precalc&) = delete;
|
||||
Precalc& operator=(const Precalc&) = delete;
|
||||
Precalc& operator=(Precalc&&) = delete;
|
||||
|
||||
FORCEINLINE void operator()()
|
||||
{
|
||||
if (shares) {
|
||||
|
|
|
@ -871,7 +871,7 @@ void P2PServer::on_broadcast()
|
|||
}
|
||||
|
||||
for (Broadcast* data : broadcast_queue) {
|
||||
send(client, [client, data](void* buf, size_t buf_size) -> size_t
|
||||
const bool result = send(client, [client, data](void* buf, size_t buf_size) -> size_t
|
||||
{
|
||||
uint8_t* p0 = reinterpret_cast<uint8_t*>(buf);
|
||||
uint8_t* p = p0;
|
||||
|
@ -930,6 +930,11 @@ void P2PServer::on_broadcast()
|
|||
|
||||
return p - p0;
|
||||
});
|
||||
if (!result) {
|
||||
LOGWARN(5, "failed to broadcast to " << static_cast<char*>(client->m_addrString) << ", disconnecting");
|
||||
client->close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,10 +106,6 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
PoolBlock::~PoolBlock()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, size_t* miner_tx_size, int* outputs_offset, int* outputs_blob_size, const uint32_t* nonce, const uint32_t* extra_nonce) const
|
||||
{
|
||||
std::vector<uint8_t> data;
|
||||
|
@ -206,7 +202,7 @@ std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, si
|
|||
data.insert(data.end(), t + HASH_SIZE, t + m_transactions.size() * HASH_SIZE);
|
||||
|
||||
#if POOL_BLOCK_DEBUG
|
||||
if (!nonce && !extra_nonce && !m_mainChainDataDebug.empty() && (data != m_mainChainDataDebug)) {
|
||||
if ((nonce == &m_nonce) && (extra_nonce == &m_extraNonce) && !m_mainChainDataDebug.empty() && (data != m_mainChainDataDebug)) {
|
||||
LOGERR(1, "serialize_mainchain_data() has a bug, fix it!");
|
||||
PANIC_STOP();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ struct DifficultyData
|
|||
struct PoolBlock
|
||||
{
|
||||
PoolBlock();
|
||||
~PoolBlock();
|
||||
|
||||
PoolBlock(const PoolBlock& b);
|
||||
PoolBlock& operator=(const PoolBlock& b);
|
||||
|
|
Loading…
Reference in a new issue