Added more tests

This commit is contained in:
SChernykh
2021-09-06 15:49:39 +02:00
parent 6dd5dcec39
commit d3dc4c731f
10 changed files with 153 additions and 9 deletions
+2 -1
View File
@@ -1011,7 +1011,8 @@ int p2pool::run()
LOGINFO(1, "uv_run exited, result = " << rc);
}
catch (const std::exception& e) {
LOGERR(1, "exception " << e.what());
const char* s = e.what();
LOGERR(1, "exception " << s);
panic();
}
+1 -1
View File
@@ -38,7 +38,7 @@ RandomX_Hasher::RandomX_Hasher(p2pool* pool)
{
uint64_t memory_allocated = 0;
if (!m_pool->params().m_lightMode) {
if (m_pool && !m_pool->params().m_lightMode) {
m_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
if (!m_dataset) {
LOGWARN(1, "couldn't allocate RandomX dataset using large pages");
+2 -1
View File
@@ -34,12 +34,13 @@ public:
~RandomX_Hasher();
void set_seed_async(const hash& seed);
void set_seed(const hash& seed);
void set_old_seed(const hash& seed);
bool calculate(const void* data, size_t size, const hash& seed, hash& result);
private:
void set_seed(const hash& seed);
struct ThreadSafeVM
{
+3 -3
View File
@@ -51,11 +51,11 @@ static_assert(1 <= UNCLE_BLOCK_DEPTH && UNCLE_BLOCK_DEPTH <= 10, "Invalid UNCLE_
namespace p2pool {
SideChain::SideChain(p2pool* pool, NetworkType type)
SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
: m_pool(pool)
, m_networkType(type)
, m_chainTip(nullptr)
, m_poolName("mainnet test 2")
, m_poolName(pool_name ? pool_name : "mainnet test 2")
, m_targetBlockTime(10)
, m_minDifficulty(MIN_DIFFICULTY, 0)
, m_chainWindowSize(2160)
@@ -64,7 +64,7 @@ SideChain::SideChain(p2pool* pool, NetworkType type)
{
LOGINFO(1, log::LightCyan() << "network type = " << m_networkType);
if (!load_config(m_pool->params().m_config)) {
if (m_pool && !load_config(m_pool->params().m_config)) {
panic();
}
+1 -1
View File
@@ -41,7 +41,7 @@ struct MinerShare
class SideChain
{
public:
SideChain(p2pool* pool, NetworkType type);
SideChain(p2pool* pool, NetworkType type, const char* pool_name = nullptr);
~SideChain();
void fill_sidechain_data(PoolBlock& block, Wallet* w, const hash& txkeySec, std::vector<MinerShare>& shares);