mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Pulse: Add testnet soft-fork for tx fee reward change
This commit is contained in:
parent
04f8307af4
commit
197918dbab
|
@ -1346,6 +1346,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
|
|||
loki_block_reward_context block_reward_context = {};
|
||||
block_reward_context.fee = fee;
|
||||
block_reward_context.height = height;
|
||||
block_reward_context.testnet_override = nettype() == TESTNET && height < 386000;
|
||||
if (!calc_batched_governance_reward(height, block_reward_context.batched_governance))
|
||||
{
|
||||
MERROR_VER("Failed to calculate batched governance reward");
|
||||
|
|
|
@ -489,6 +489,7 @@ namespace cryptonote
|
|||
// exceeding the block limit is already removed from base_reward).
|
||||
uint64_t non_miner_amounts = result.governance_due + result.service_node_paid;
|
||||
result.base_miner = base_reward > non_miner_amounts ? base_reward - non_miner_amounts : 0;
|
||||
result.base_miner_fee = loki_context.fee;
|
||||
|
||||
if (hard_fork_version >= cryptonote::network_version_16_pulse)
|
||||
{
|
||||
|
@ -505,20 +506,19 @@ namespace cryptonote
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t const penalty = base_reward_unpenalized - base_reward;
|
||||
if (penalty > loki_context.fee)
|
||||
if (!loki_context.testnet_override)
|
||||
{
|
||||
MERROR("Block reward penalty is greater than the fee that would be received, penalty "
|
||||
<< cryptonote::print_money(penalty) << ", fee "
|
||||
<< cryptonote::print_money(loki_context.fee));
|
||||
return false;
|
||||
}
|
||||
uint64_t const penalty = base_reward_unpenalized - base_reward;
|
||||
if (penalty > loki_context.fee)
|
||||
{
|
||||
MERROR("Block reward penalty is greater than the fee that would be received, penalty "
|
||||
<< cryptonote::print_money(penalty) << ", fee "
|
||||
<< cryptonote::print_money(loki_context.fee));
|
||||
return false;
|
||||
}
|
||||
|
||||
result.base_miner_fee = loki_context.fee - penalty;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.base_miner_fee = loki_context.fee;
|
||||
result.base_miner_fee = loki_context.fee - penalty;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -116,9 +116,10 @@ namespace cryptonote
|
|||
struct loki_block_reward_context
|
||||
{
|
||||
using portions = uint64_t;
|
||||
uint64_t height;
|
||||
uint64_t fee;
|
||||
uint64_t batched_governance; // Optional: 0 hardfork v10, then must be calculated using blockchain::calc_batched_governance_reward
|
||||
bool testnet_override;
|
||||
uint64_t height;
|
||||
uint64_t fee;
|
||||
uint64_t batched_governance; // Optional: 0 hardfork v10, then must be calculated using blockchain::calc_batched_governance_reward
|
||||
std::vector<service_nodes::payout_entry> block_leader_payouts = {service_nodes::null_payout_entry};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue