mirror of
https://github.com/monero-project/monero.git
synced 2025-07-24 04:40:40 -04:00
rct: change the simple flag to a type
for future expansion
This commit is contained in:
parent
c5be4b0bea
commit
3ab2ab3e76
8 changed files with 46 additions and 25 deletions
|
@ -2464,8 +2464,9 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
// from version 2, check ringct signatures
|
||||
// obviously, the original and simple rct APIs use a mixRing that's indexes
|
||||
// in opposite orders, because it'd be too simple otherwise...
|
||||
if (tx.rct_signatures.simple)
|
||||
switch (tx.rct_signatures.type)
|
||||
{
|
||||
case rct::RCTTypeSimple: {
|
||||
rct::ctkeyM reconstructed_mixRing;
|
||||
std::vector<rct::keyV> reconstructed_II;
|
||||
rct::ctkeyV reconstructed_outPk;
|
||||
|
@ -2568,9 +2569,9 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
LOG_PRINT_L1("Failed to check ringct signatures!");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
case rct::RCTTypeFull: {
|
||||
rct::ctkeyM reconstructed_mixRing;
|
||||
rct::keyV reconstructed_II;
|
||||
rct::ctkeyV reconstructed_outPk;
|
||||
|
@ -2674,6 +2675,11 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
|||
LOG_PRINT_L1("Failed to check ringct signatures!");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_PRINT_L1("Unsupported rct type: " << tx.rct_signatures.type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -231,18 +231,21 @@ namespace cryptonote
|
|||
else
|
||||
{
|
||||
FIELD(rct_signatures)
|
||||
if (rct_signatures.simple)
|
||||
switch (rct_signatures.type)
|
||||
{
|
||||
case rct::RCTTypeSimple:
|
||||
if (rct_signatures.mixRing.size() && rct_signatures.mixRing.size() != vin.size())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
case rct::RCTTypeFull:
|
||||
for (size_t i = 0; i < rct_signatures.mixRing.size(); ++i)
|
||||
{
|
||||
if (rct_signatures.mixRing[i].size() != vin.size())
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
END_SERIALIZE()
|
||||
|
|
|
@ -248,15 +248,17 @@ namespace boost
|
|||
template <class Archive>
|
||||
inline void serialize(Archive &a, rct::rctSig &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.simple;
|
||||
a & x.type;
|
||||
if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple)
|
||||
throw boost::archive::archive_exception(boost::archive::archive_exception::other_exception, "Unsupported rct type");
|
||||
// a & x.message; message is not serialized, as it can be reconstructed from the tx data
|
||||
a & x.rangeSigs;
|
||||
if (x.simple)
|
||||
if (x.type == rct::RCTTypeSimple)
|
||||
a & x.MGs;
|
||||
else
|
||||
if (x.type == rct::RCTTypeFull)
|
||||
a & x.MG;
|
||||
// a & x.mixRing; mixRing is not serialized, as it can be reconstructed from the offsets
|
||||
if (x.simple)
|
||||
if (x.type == rct::RCTTypeSimple)
|
||||
a & x.pseudoOuts;
|
||||
a & x.ecdhInfo;
|
||||
serializeOutPk(a, x.outPk, ver);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue