mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
P2Pool and Solo Mining only
This commit is contained in:
commit
633ca6073c
7 changed files with 68 additions and 31 deletions
|
@ -473,8 +473,10 @@ namespace cryptonote
|
||||||
if (major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
if (major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
FIELD(signature)
|
FIELD(signature)
|
||||||
|
if (major_version < HF_VERSION_P2POOL) {
|
||||||
FIELD(vote)
|
FIELD(vote)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,10 @@ namespace boost
|
||||||
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
a & b.signature;
|
a & b.signature;
|
||||||
|
if (b.major_version < HF_VERSION_P2POOL) {
|
||||||
a & b.vote;
|
a & b.vote;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//------------------
|
//------------------
|
||||||
a & b.miner_tx;
|
a & b.miner_tx;
|
||||||
a & b.tx_hashes;
|
a & b.tx_hashes;
|
||||||
|
|
|
@ -627,8 +627,11 @@ namespace cryptonote
|
||||||
crypto::generate_signature(sig_data, eph_pub_key, eph_secret_key, signature);
|
crypto::generate_signature(sig_data, eph_pub_key, eph_secret_key, signature);
|
||||||
// amend signature to block header before PoW hashing
|
// amend signature to block header before PoW hashing
|
||||||
b.signature = signature;
|
b.signature = signature;
|
||||||
|
|
||||||
|
if (b.major_version < HF_VERSION_P2POOL) {
|
||||||
b.vote = m_int_vote;
|
b.vote = m_int_vote;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
crypto::hash h;
|
crypto::hash h;
|
||||||
m_gbh(b, height, NULL, tools::get_max_concurrency(), h);
|
m_gbh(b, height, NULL, tools::get_max_concurrency(), h);
|
||||||
|
|
|
@ -198,6 +198,10 @@
|
||||||
#define HF_VERSION_VIEW_TAGS 20
|
#define HF_VERSION_VIEW_TAGS 20
|
||||||
#define HF_VERSION_2021_SCALING 20
|
#define HF_VERSION_2021_SCALING 20
|
||||||
#define HF_VERSION_BLOCK_HEADER_MINER_SIG 18
|
#define HF_VERSION_BLOCK_HEADER_MINER_SIG 18
|
||||||
|
#define HF_VERSION_P2POOL 20
|
||||||
|
|
||||||
|
#define MIN_MINER_OUTPUTS 5
|
||||||
|
#define MIN_MINER_AMOUNT_FACTOR 500
|
||||||
|
|
||||||
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
|
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
|
||||||
#define CRYPTONOTE_SCALING_2021_FEE_ROUNDING_PLACES 2
|
#define CRYPTONOTE_SCALING_2021_FEE_ROUNDING_PLACES 2
|
||||||
|
|
|
@ -1414,6 +1414,11 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
||||||
// Miner Block Header Signing
|
// Miner Block Header Signing
|
||||||
if (hf_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
if (hf_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
|
// block has been P2Pool mined, no signature required
|
||||||
|
if (hf_version >= HF_VERSION_P2POOL && b.miner_tx.vout.size() >= MIN_MINER_OUTPUTS)
|
||||||
|
{
|
||||||
|
LOG_PRINT_L1("Transaction meets MIN_MINER_OUTPUTS")
|
||||||
|
} else {
|
||||||
// sanity checks
|
// sanity checks
|
||||||
if (b.miner_tx.vout.size() != 1)
|
if (b.miner_tx.vout.size() != 1)
|
||||||
{
|
{
|
||||||
|
@ -1425,7 +1430,7 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
||||||
MWARNING("Wrong txout type");
|
MWARNING("Wrong txout type");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (b.vote > 2)
|
if (hf_version < HF_VERSION_P2POOL && b.vote > 2)
|
||||||
{
|
{
|
||||||
MWARNING("Vote integer must be either 0, 1, or 2");
|
MWARNING("Vote integer must be either 0, 1, or 2");
|
||||||
return false;
|
return false;
|
||||||
|
@ -1441,9 +1446,12 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
LOG_PRINT_L1("Miner signature is good");
|
LOG_PRINT_L1("Miner signature is good");
|
||||||
|
if (hf_version < HF_VERSION_P2POOL) {
|
||||||
LOG_PRINT_L1("Vote: " << b.vote);
|
LOG_PRINT_L1("Vote: " << b.vote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin.size() == 1, false, "coinbase transaction in the block has no inputs");
|
CHECK_AND_ASSERT_MES(b.miner_tx.vin.size() == 1, false, "coinbase transaction in the block has no inputs");
|
||||||
|
@ -1546,6 +1554,20 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
|
||||||
partial_block_reward = true;
|
partial_block_reward = true;
|
||||||
base_reward = money_in_use - fee;
|
base_reward = money_in_use - fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check that each output has minimal amount of WOW
|
||||||
|
if (version >= HF_VERSION_P2POOL) {
|
||||||
|
uint64_t min_miner_amount = base_reward / MIN_MINER_AMOUNT_FACTOR;
|
||||||
|
for (auto &o: b.miner_tx.vout)
|
||||||
|
{
|
||||||
|
if (o.amount+1 < min_miner_amount)
|
||||||
|
{
|
||||||
|
MERROR_VER("Each output must have at least " << print_money(min_miner_amount) << " block reward");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
|
@ -2204,8 +2204,10 @@ namespace cryptonote
|
||||||
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
b.signature = {};
|
b.signature = {};
|
||||||
|
if (b.major_version < HF_VERSION_P2POOL) {
|
||||||
b.vote = 0;
|
b.vote = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
crypto::hash seed_hash = crypto::null_hash;
|
crypto::hash seed_hash = crypto::null_hash;
|
||||||
if (b.major_version >= RX_BLOCK_VERSION && !epee::string_tools::hex_to_pod(template_res.seed_hash, seed_hash))
|
if (b.major_version >= RX_BLOCK_VERSION && !epee::string_tools::hex_to_pod(template_res.seed_hash, seed_hash))
|
||||||
{
|
{
|
||||||
|
|
|
@ -898,8 +898,10 @@ namespace rpc
|
||||||
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= HF_VERSION_BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
header.signature = b.signature;
|
header.signature = b.signature;
|
||||||
|
if (b.major_version < HF_VERSION_P2POOL) {
|
||||||
header.vote = b.vote;
|
header.vote = b.vote;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
header.prev_id = b.prev_id;
|
header.prev_id = b.prev_id;
|
||||||
|
|
||||||
header.depth = m_core.get_current_blockchain_height() - header.height - 1;
|
header.depth = m_core.get_current_blockchain_height() - header.height - 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue