mirror of https://github.com/SChernykh/p2pool
pub/sec tx key cleanup
parent
647319b731
commit
11e4c459c9
|
@ -55,8 +55,6 @@ BlockTemplate::BlockTemplate(SideChain* sidechain, RandomX_Hasher_Base* hasher)
|
||||||
, m_difficulty{}
|
, m_difficulty{}
|
||||||
, m_seedHash{}
|
, m_seedHash{}
|
||||||
, m_timestamp(0)
|
, m_timestamp(0)
|
||||||
, m_txkeyPub{}
|
|
||||||
, m_txkeySec{}
|
|
||||||
, m_poolBlockTemplate(new PoolBlock())
|
, m_poolBlockTemplate(new PoolBlock())
|
||||||
, m_finalReward(0)
|
, m_finalReward(0)
|
||||||
, m_minerTxKeccakState{}
|
, m_minerTxKeccakState{}
|
||||||
|
@ -139,8 +137,6 @@ BlockTemplate& BlockTemplate::operator=(const BlockTemplate& b)
|
||||||
m_difficulty = b.m_difficulty;
|
m_difficulty = b.m_difficulty;
|
||||||
m_seedHash = b.m_seedHash;
|
m_seedHash = b.m_seedHash;
|
||||||
m_timestamp = b.m_timestamp;
|
m_timestamp = b.m_timestamp;
|
||||||
m_txkeyPub = b.m_txkeyPub;
|
|
||||||
m_txkeySec = b.m_txkeySec;
|
|
||||||
*m_poolBlockTemplate = *b.m_poolBlockTemplate;
|
*m_poolBlockTemplate = *b.m_poolBlockTemplate;
|
||||||
m_finalReward = b.m_finalReward;
|
m_finalReward = b.m_finalReward;
|
||||||
|
|
||||||
|
@ -235,8 +231,6 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet
|
||||||
*this = *m_oldTemplates[id % array_size(&BlockTemplate::m_oldTemplates)];
|
*this = *m_oldTemplates[id % array_size(&BlockTemplate::m_oldTemplates)];
|
||||||
};
|
};
|
||||||
|
|
||||||
get_tx_keys(m_txkeyPub, m_txkeySec, miner_wallet->spend_public_key(), data.prev_id);
|
|
||||||
|
|
||||||
m_height = data.height;
|
m_height = data.height;
|
||||||
m_difficulty = data.difficulty;
|
m_difficulty = data.difficulty;
|
||||||
m_seedHash = data.seed_hash;
|
m_seedHash = data.seed_hash;
|
||||||
|
@ -272,7 +266,10 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet
|
||||||
|
|
||||||
m_blockHeaderSize = m_blockHeader.size();
|
m_blockHeaderSize = m_blockHeader.size();
|
||||||
|
|
||||||
m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, miner_wallet, m_txkeySec, m_shares);
|
get_tx_keys(m_poolBlockTemplate->m_txkeyPub, m_poolBlockTemplate->m_txkeySec, miner_wallet->spend_public_key(), data.prev_id);
|
||||||
|
m_poolBlockTemplate->m_minerWallet = *miner_wallet;
|
||||||
|
|
||||||
|
m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, m_shares);
|
||||||
|
|
||||||
// Only choose transactions that were received 10 or more seconds ago, or high fee (>= 0.006 XMR) transactions
|
// Only choose transactions that were received 10 or more seconds ago, or high fee (>= 0.006 XMR) transactions
|
||||||
size_t total_mempool_transactions;
|
size_t total_mempool_transactions;
|
||||||
|
@ -822,7 +819,7 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hash eph_public_key;
|
hash eph_public_key;
|
||||||
if (!shares[i].m_wallet->get_eph_public_key(m_txkeySec, i, eph_public_key, view_tag)) {
|
if (!shares[i].m_wallet->get_eph_public_key(m_poolBlockTemplate->m_txkeySec, i, eph_public_key, view_tag)) {
|
||||||
LOGERR(1, "get_eph_public_key failed at index " << i);
|
LOGERR(1, "get_eph_public_key failed at index " << i);
|
||||||
}
|
}
|
||||||
m_minerTx.insert(m_minerTx.end(), eph_public_key.h, eph_public_key.h + HASH_SIZE);
|
m_minerTx.insert(m_minerTx.end(), eph_public_key.h, eph_public_key.h + HASH_SIZE);
|
||||||
|
@ -845,14 +842,11 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_poolBlockTemplate->m_txkeyPub = m_txkeyPub;
|
|
||||||
m_poolBlockTemplate->m_txkeySec = m_txkeySec;
|
|
||||||
|
|
||||||
// TX_EXTRA begin
|
// TX_EXTRA begin
|
||||||
m_minerTxExtra.clear();
|
m_minerTxExtra.clear();
|
||||||
|
|
||||||
m_minerTxExtra.push_back(TX_EXTRA_TAG_PUBKEY);
|
m_minerTxExtra.push_back(TX_EXTRA_TAG_PUBKEY);
|
||||||
m_minerTxExtra.insert(m_minerTxExtra.end(), m_txkeyPub.h, m_txkeyPub.h + HASH_SIZE);
|
m_minerTxExtra.insert(m_minerTxExtra.end(), m_poolBlockTemplate->m_txkeyPub.h, m_poolBlockTemplate->m_txkeyPub.h + HASH_SIZE);
|
||||||
|
|
||||||
m_minerTxExtra.push_back(TX_EXTRA_NONCE);
|
m_minerTxExtra.push_back(TX_EXTRA_NONCE);
|
||||||
|
|
||||||
|
|
|
@ -97,9 +97,6 @@ private:
|
||||||
|
|
||||||
uint64_t m_timestamp;
|
uint64_t m_timestamp;
|
||||||
|
|
||||||
hash m_txkeyPub;
|
|
||||||
hash m_txkeySec;
|
|
||||||
|
|
||||||
PoolBlock* m_poolBlockTemplate;
|
PoolBlock* m_poolBlockTemplate;
|
||||||
|
|
||||||
BlockTemplate* m_oldTemplates[4] = {};
|
BlockTemplate* m_oldTemplates[4] = {};
|
||||||
|
|
|
@ -201,14 +201,12 @@ SideChain::~SideChain()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideChain::fill_sidechain_data(PoolBlock& block, const Wallet* w, const hash& txkeySec, std::vector<MinerShare>& shares) const
|
void SideChain::fill_sidechain_data(PoolBlock& block, std::vector<MinerShare>& shares) const
|
||||||
{
|
{
|
||||||
ReadLock lock(m_sidechainLock);
|
|
||||||
|
|
||||||
block.m_minerWallet = *w;
|
|
||||||
block.m_txkeySec = txkeySec;
|
|
||||||
block.m_uncles.clear();
|
block.m_uncles.clear();
|
||||||
|
|
||||||
|
ReadLock lock(m_sidechainLock);
|
||||||
|
|
||||||
const PoolBlock* tip = m_chainTip;
|
const PoolBlock* tip = m_chainTip;
|
||||||
|
|
||||||
if (!tip) {
|
if (!tip) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
SideChain(p2pool* pool, NetworkType type, const char* pool_name = nullptr);
|
SideChain(p2pool* pool, NetworkType type, const char* pool_name = nullptr);
|
||||||
~SideChain();
|
~SideChain();
|
||||||
|
|
||||||
void fill_sidechain_data(PoolBlock& block, const Wallet* w, const hash& txkeySec, std::vector<MinerShare>& shares) const;
|
void fill_sidechain_data(PoolBlock& block, std::vector<MinerShare>& shares) const;
|
||||||
|
|
||||||
bool block_seen(const PoolBlock& block);
|
bool block_seen(const PoolBlock& block);
|
||||||
void unsee_block(const PoolBlock& block);
|
void unsee_block(const PoolBlock& block);
|
||||||
|
|
Loading…
Reference in New Issue