Add CAP exchange protocol, Deadlock fix, Sync stuck fix with retry mechanism

This commit is contained in:
Matt Hess
2025-12-17 00:29:41 +00:00
parent 940f1cabe8
commit 11b545e91b
10 changed files with 1101 additions and 117 deletions
+8 -9
View File
@@ -359,10 +359,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
uint64_t base_reward = get_base_reward(data.already_generated_coins);
// Save the FULL reward before the split
uint64_t full_block_reward = base_reward; // ADD THIS LINE
// Salvium: 20% goes to staking, miners get 80%
base_reward = base_reward - (base_reward / 5); // 80% of total reward
uint64_t full_block_reward = base_reward;
uint64_t total_tx_fees = 0;
uint64_t total_tx_weight = 0;
@@ -551,7 +548,9 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
#endif
}
// Salvium: 1/5 of block reward is burnt, only 4/5 goes to miners
// Salvium: Calculate full reward, then apply 80/20 split
full_block_reward = final_reward; // Full reward including fees
final_reward = final_reward - (final_reward / 5); // 80% to miners
if (!SideChain::split_reward(final_reward, m_shares, m_rewards)) {
use_old_template();
return;
@@ -1246,14 +1245,14 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
// type = MINER (1)
writeVarint(1, m_minerTx);
// amount_burnt = 20% of total block reward = 25% of miner outputs
// amount_burnt = 20% of total block reward
uint64_t miner_total = 0;
for (size_t i = 0; i < num_outputs; ++i) {
miner_total += m_rewards[i];
}
uint64_t stake_amount = full_block_reward / 5;
writeVarint(stake_amount, m_minerTx);
m_poolBlockTemplate->m_amountBurnt = stake_amount;
uint64_t amount_burnt = full_block_reward / 5;
writeVarint(amount_burnt, m_minerTx);
m_poolBlockTemplate->m_amountBurnt = amount_burnt;
// Save prefix size - everything up to here is the transaction prefix
m_minerTxPrefixSize = static_cast<uint32_t>(m_minerTx.size());