mirror of
https://github.com/monero-project/monero.git
synced 2025-08-08 12:12:24 -04:00
blockchain: enforce 10 block age for spending outputs
Some custom wallet code apparently ignores this, which causes users of that code to be fingerprinted
This commit is contained in:
parent
2c171a9b02
commit
a444f06e53
5 changed files with 51 additions and 6 deletions
|
@ -2982,6 +2982,9 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
|||
const auto waiter_guard = epee::misc_utils::create_scope_leave_handler([&]() { waiter.wait(&tpool); });
|
||||
int threads = tpool.get_max_concurrency();
|
||||
|
||||
uint64_t max_used_block_height = 0;
|
||||
if (!pmax_used_block_height)
|
||||
pmax_used_block_height = &max_used_block_height;
|
||||
for (const auto& txin : tx.vin)
|
||||
{
|
||||
// make sure output being spent is of type txin_to_key, rather than
|
||||
|
@ -3048,6 +3051,13 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
|||
if (tx.version == 1 && threads > 1)
|
||||
waiter.wait(&tpool);
|
||||
|
||||
// enforce min output age
|
||||
if (hf_version >= HF_VERSION_ENFORCE_MIN_AGE)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(*pmax_used_block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE <= m_db->height(),
|
||||
false, "Transaction spends at least one output which is too young");
|
||||
}
|
||||
|
||||
if (tx.version == 1)
|
||||
{
|
||||
if (threads > 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue