New "Halfway RingCT" outputs for coinbase transactions
When RingCT is enabled, outputs from coinbase transactions are created as a single output, and stored as RingCT output, with a fake mask. Their amount is not hidden on the blockchain itself, but they are then able to be used as fake inputs in a RingCT ring. Since the output amounts are hidden, their "dustiness" is not an obstacle anymore to mixing, and this makes the coinbase transactions a lot smaller, as well as helping the TXO set to grow more slowly. Also add a new "Null" type of rct signature, which decreases the size required when no signatures are to be stored, as in a coinbase tx.
This commit is contained in:
parent
6f526cdff8
commit
c3b3260ae5
19 changed files with 120 additions and 36 deletions
|
@ -136,7 +136,10 @@ namespace cryptonote
|
|||
// from hard fork 2, we cut out the low significant digits. This makes the tx smaller, and
|
||||
// keeps the paid amount almost the same. The unpaid remainder gets pushed back to the
|
||||
// emission schedule
|
||||
if (hard_fork_version >= 2) {
|
||||
// from hard fork 4, we use a single "dusty" output. This makes the tx even smaller,
|
||||
// and avoids the quantization. These outputs will be added as rct outputs with identity
|
||||
// masks, to they can be used as rct inputs.
|
||||
if (hard_fork_version >= 2 && hard_fork_version < 4) {
|
||||
block_reward = block_reward - block_reward % ::config::BASE_REWARD_CLAMP_THRESHOLD;
|
||||
}
|
||||
|
||||
|
@ -146,12 +149,16 @@ namespace cryptonote
|
|||
[&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); });
|
||||
|
||||
CHECK_AND_ASSERT_MES(1 <= max_outs, false, "max_out must be non-zero");
|
||||
if (height == 0)
|
||||
if (height == 0 || hard_fork_version >= 4)
|
||||
{
|
||||
// the genesis block was not decomposed, for unknown reasons
|
||||
while (max_outs < out_amounts.size())
|
||||
{
|
||||
out_amounts[out_amounts.size() - 2] += out_amounts.back();
|
||||
//out_amounts[out_amounts.size() - 2] += out_amounts.back();
|
||||
//out_amounts.resize(out_amounts.size() - 1);
|
||||
out_amounts[1] += out_amounts[0];
|
||||
for (size_t n = 1; n < out_amounts.size(); ++n)
|
||||
out_amounts[n - 1] = out_amounts[n];
|
||||
out_amounts.resize(out_amounts.size() - 1);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +189,11 @@ namespace cryptonote
|
|||
|
||||
CHECK_AND_ASSERT_MES(summary_amounts == block_reward, false, "Failed to construct miner tx, summary_amounts = " << summary_amounts << " not equal block_reward = " << block_reward);
|
||||
|
||||
tx.version = 1;
|
||||
if (hard_fork_version >= 4)
|
||||
tx.version = 2;
|
||||
else
|
||||
tx.version = 1;
|
||||
|
||||
//lock
|
||||
tx.unlock_time = height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
|
||||
tx.vin.push_back(in);
|
||||
|
@ -726,7 +737,7 @@ namespace cryptonote
|
|||
// zero out all amounts to mask rct outputs, real amounts are now encrypted
|
||||
for (size_t i = 0; i < tx.vin.size(); ++i)
|
||||
{
|
||||
if (!(sources[i].mask == rct::identity()))
|
||||
if (sources[i].rct)
|
||||
boost::get<txin_to_key>(tx.vin[i]).amount = 0;
|
||||
}
|
||||
for (size_t i = 0; i < tx.vout.size(); ++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue