mirror of
https://github.com/monero-project/monero.git
synced 2025-07-22 00:28:48 -04:00
rct: avoid the need for the last II element
This element is used in the generation of the MLSAG, but isn't needed in verification. Also misc changes in the cryptonote code to match, by mooo.
This commit is contained in:
parent
a47ceee83b
commit
c5be4b0bea
6 changed files with 55 additions and 55 deletions
|
@ -2475,12 +2475,12 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
const rct::ctkeyM &mixRing = tx.rct_signatures.mixRing.empty() ? reconstructed_mixRing : tx.rct_signatures.mixRing;
|
||||
// always do II, because it's split in the simple version, and always do outPk
|
||||
|
||||
// all MGs should have the same II size (1)
|
||||
// all MGs should have empty II
|
||||
for (size_t n = 0; n < tx.rct_signatures.MGs.size(); ++n)
|
||||
{
|
||||
if (tx.rct_signatures.MGs[n].II.size() != 1)
|
||||
if (tx.rct_signatures.MGs[n].II.size() != 0)
|
||||
{
|
||||
LOG_PRINT_L1("Failed to check ringct signatures: mismatched MGs II sizes");
|
||||
LOG_PRINT_L1("Failed to check ringct signatures: non empty MGs II");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2489,7 +2489,6 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
for (size_t n = 0; n < tx.vin.size(); ++n)
|
||||
{
|
||||
reconstructed_II[n].push_back(rct::ki2rct(boost::get<txin_to_key>(tx.vin[n]).k_image));
|
||||
reconstructed_II[n].push_back(tx.rct_signatures.MGs[n].II[0]);
|
||||
}
|
||||
|
||||
if (tx.rct_signatures.outPk.size() != tx.vout.size())
|
||||
|
@ -2579,7 +2578,7 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
// if the tx already has a non empty mixRing and/or II, use them,
|
||||
// else reconstruct them. Always do outPk.
|
||||
const rct::ctkeyM &mixRing = tx.rct_signatures.mixRing.empty() ? reconstructed_mixRing : tx.rct_signatures.mixRing;
|
||||
const rct::keyV &II = tx.rct_signatures.MG.II.size() == 1 ? reconstructed_II : tx.rct_signatures.MG.II;
|
||||
const rct::keyV &II = tx.rct_signatures.MG.II.empty() ? reconstructed_II : tx.rct_signatures.MG.II;
|
||||
const rct::ctkeyV outPk = reconstructed_outPk;
|
||||
|
||||
// RCT needs the same mixin for all inputs
|
||||
|
@ -2604,14 +2603,13 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
}
|
||||
}
|
||||
|
||||
if (tx.rct_signatures.MG.II.size() == 1)
|
||||
if (tx.rct_signatures.MG.II.empty())
|
||||
{
|
||||
reconstructed_II.resize(tx.vin.size());
|
||||
for (size_t n = 0; n < tx.vin.size(); ++n)
|
||||
{
|
||||
reconstructed_II[n] = rct::ki2rct(boost::get<txin_to_key>(tx.vin[n]).k_image);
|
||||
}
|
||||
reconstructed_II.push_back(tx.rct_signatures.MG.II.back());
|
||||
}
|
||||
|
||||
if (tx.rct_signatures.outPk.size() != tx.vout.size())
|
||||
|
@ -2657,7 +2655,7 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
}
|
||||
}
|
||||
|
||||
if (II.size() != 1 + tx.vin.size())
|
||||
if (II.size() != tx.vin.size())
|
||||
{
|
||||
LOG_PRINT_L1("Failed to check ringct signatures: mismatched II/vin sizes");
|
||||
return false;
|
||||
|
|
|
@ -209,19 +209,12 @@ namespace boost
|
|||
a & x.s;
|
||||
}
|
||||
|
||||
inline void serialize(boost::archive::binary_iarchive &a, rct::mgSig &x, const boost::serialization::version_type ver)
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, rct::mgSig &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.ss;
|
||||
a & x.cc;
|
||||
x.II.resize(1);
|
||||
a & x.II[0];
|
||||
}
|
||||
|
||||
inline void serialize(boost::archive::binary_oarchive &a, rct::mgSig &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.ss;
|
||||
a & x.cc;
|
||||
a & x.II.back();
|
||||
// a & x.II; // not serialized, we can recover it from the tx vin
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue