mixable transactions must be rct for v3
This commit is contained in:
parent
1017a75460
commit
c2ec6d35b9
|
@ -2262,6 +2262,15 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
||||||
if (txin.type() == typeid(txin_to_key))
|
if (txin.type() == typeid(txin_to_key))
|
||||||
{
|
{
|
||||||
const txin_to_key& in_to_key = boost::get<txin_to_key>(txin);
|
const txin_to_key& in_to_key = boost::get<txin_to_key>(txin);
|
||||||
|
if (in_to_key.amount == 0)
|
||||||
|
{
|
||||||
|
// always consider rct inputs mixable. Even if there's not enough rct
|
||||||
|
// inputs on the chain to mix with, this is going to be the case for
|
||||||
|
// just a few blocks right after the fork at most
|
||||||
|
++n_mixable;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
uint64_t n_outputs = m_db->get_num_outputs(in_to_key.amount);
|
uint64_t n_outputs = m_db->get_num_outputs(in_to_key.amount);
|
||||||
LOG_PRINT_L2("output size " << print_money(in_to_key.amount) << ": " << n_outputs << " available");
|
LOG_PRINT_L2("output size " << print_money(in_to_key.amount) << ": " << n_outputs << " available");
|
||||||
// n_outputs includes the output we're considering
|
// n_outputs includes the output we're considering
|
||||||
|
@ -2269,10 +2278,23 @@ bool Blockchain::check_tx_inputs(const transaction& tx, tx_verification_context
|
||||||
++n_unmixable;
|
++n_unmixable;
|
||||||
else
|
else
|
||||||
++n_mixable;
|
++n_mixable;
|
||||||
|
}
|
||||||
if (in_to_key.key_offsets.size() - 1 < mixin)
|
if (in_to_key.key_offsets.size() - 1 < mixin)
|
||||||
mixin = in_to_key.key_offsets.size() - 1;
|
mixin = in_to_key.key_offsets.size() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for v3, we force txes with all mixable inputs to be rct
|
||||||
|
if (m_hardfork->get_current_version() >= 3)
|
||||||
|
{
|
||||||
|
if (n_unmixable == 0 && tx.version == 1)
|
||||||
|
{
|
||||||
|
LOG_PRINT_L1("Tx " << get_transaction_hash(tx) << " is not rct and does not have unmixable inputs");
|
||||||
|
tvc.m_not_rct = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mixin < 2)
|
if (mixin < 2)
|
||||||
{
|
{
|
||||||
if (n_unmixable == 0)
|
if (n_unmixable == 0)
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace cryptonote
|
||||||
bool m_too_big;
|
bool m_too_big;
|
||||||
bool m_overspend;
|
bool m_overspend;
|
||||||
bool m_fee_too_low;
|
bool m_fee_too_low;
|
||||||
|
bool m_not_rct;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct block_verification_context
|
struct block_verification_context
|
||||||
|
|
|
@ -483,6 +483,8 @@ namespace cryptonote
|
||||||
res.reason = "overspend";
|
res.reason = "overspend";
|
||||||
if ((res.fee_too_low = tvc.m_fee_too_low))
|
if ((res.fee_too_low = tvc.m_fee_too_low))
|
||||||
res.reason = "fee too low";
|
res.reason = "fee too low";
|
||||||
|
if ((res.not_rct = tvc.m_not_rct))
|
||||||
|
res.reason = "tx is not ringct";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,6 +376,7 @@ namespace cryptonote
|
||||||
bool too_big;
|
bool too_big;
|
||||||
bool overspend;
|
bool overspend;
|
||||||
bool fee_too_low;
|
bool fee_too_low;
|
||||||
|
bool not_rct;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(status)
|
KV_SERIALIZE(status)
|
||||||
|
@ -388,6 +389,7 @@ namespace cryptonote
|
||||||
KV_SERIALIZE(too_big)
|
KV_SERIALIZE(too_big)
|
||||||
KV_SERIALIZE(overspend)
|
KV_SERIALIZE(overspend)
|
||||||
KV_SERIALIZE(fee_too_low)
|
KV_SERIALIZE(fee_too_low)
|
||||||
|
KV_SERIALIZE(not_rct)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue