aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-12 18:45:07 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:30:26 +0100
commitc3b3260ae5b5acde445fa88a6f0909f582903754 (patch)
tree7b8b6977d84045568980b8d01169281c4a79c073 /src/wallet
parentrct: log why verification fails (diff)
downloadmonero-c3b3260ae5b5acde445fa88a6f0909f582903754.tar.xz
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.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp17
-rw-r--r--src/wallet/wallet2.h19
2 files changed, 34 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index b3b8e6561..985ebe778 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -489,10 +489,17 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, const s
{
td.m_mask = mask[o];
td.m_amount = amount[o];
+ td.m_rct = true;
+ }
+ else if (miner_tx && tx.version == 2)
+ {
+ td.m_mask = rct::identity();
+ td.m_rct = true;
}
else
{
td.m_mask = rct::identity();
+ td.m_rct = false;
}
set_unspent(td);
m_key_images[td.m_key_image] = m_transfers.size()-1;
@@ -529,10 +536,17 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, const s
{
td.m_mask = mask[o];
td.m_amount = amount[o];
+ td.m_rct = true;
+ }
+ else if (miner_tx && tx.version == 2)
+ {
+ td.m_mask = rct::identity();
+ td.m_rct = true;
}
else
{
td.m_mask = rct::identity();
+ td.m_rct = false;
}
THROW_WALLET_EXCEPTION_IF(td.m_key_image != ki[o], error::wallet_internal_error, "Inconsistent key images");
THROW_WALLET_EXCEPTION_IF(td.m_spent, error::wallet_internal_error, "Inconsistent spent status");
@@ -2847,6 +2861,7 @@ void wallet2::transfer_selected(const std::vector<cryptonote::tx_destination_ent
cryptonote::tx_source_entry& src = sources.back();
transfer_details& td = *it;
src.amount = td.amount();
+ src.rct = td.is_rct();
//paste keys (fake and real)
for (size_t n = 0; n < fake_outputs_count + 1; ++n)
@@ -3037,6 +3052,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
cryptonote::tx_source_entry& src = sources.back();
transfer_details& td = *it;
src.amount = td.amount();
+ src.rct = td.is_rct();
//paste mixin transaction
if(it->is_rct())
{
@@ -3732,6 +3748,7 @@ void wallet2::transfer_from(const std::vector<size_t> &outs, size_t num_outputs,
cryptonote::tx_source_entry& src = sources.back();
transfer_details& td = *it;
src.amount = td.amount();
+ src.rct = td.is_rct();
//paste real transaction to the random index
auto it_to_insert = std::find_if(src.outputs.begin(), src.outputs.end(), [&](const tx_output_entry& a)
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 0d61f90e2..259f7aca7 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -108,8 +108,9 @@ namespace tools
crypto::key_image m_key_image; //TODO: key_image stored twice :(
rct::key m_mask;
uint64_t m_amount;
+ bool m_rct;
- bool is_rct() const { return m_tx.vout[m_internal_output_index].amount == 0; }
+ bool is_rct() const { return m_rct; }
uint64_t amount() const { return m_amount; }
};
@@ -502,7 +503,7 @@ namespace tools
};
}
BOOST_CLASS_VERSION(tools::wallet2, 14)
-BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 3)
+BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 4)
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 1)
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 5)
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 2)
@@ -527,6 +528,10 @@ namespace boost
{
x.m_spent_height = 0;
}
+ if (ver < 4)
+ {
+ x.m_rct = x.m_tx.vout[x.m_internal_output_index].amount == 0;
+ }
}
template <class Archive>
@@ -563,8 +568,17 @@ namespace boost
}
a & x.m_spent_height;
if (ver < 3)
+ {
+ initialize_transfer_details(a, x, ver);
return;
+ }
a & x.m_txid;
+ if (ver < 4)
+ {
+ initialize_transfer_details(a, x, ver);
+ return;
+ }
+ a & x.m_rct;
}
template <class Archive>
@@ -770,6 +784,7 @@ namespace tools
cryptonote::tx_source_entry& src = sources.back();
transfer_details& td = *it;
src.amount = td.amount();
+ src.rct = false;
//paste mixin transaction
if(daemon_resp.outs.size())
{