mirror of
https://github.com/monero-project/monero.git
synced 2025-07-23 06:20:50 -04:00
from hard fork 2, all outputs must be decomposed
The wallet decomposes fully as of now too.
This commit is contained in:
parent
90ccad1236
commit
ac90d488e7
6 changed files with 67 additions and 48 deletions
|
@ -1972,6 +1972,23 @@ bool Blockchain::check_tx_inputs(const transaction& tx, uint64_t& max_used_block
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool Blockchain::check_tx_outputs(const transaction& tx)
|
||||
{
|
||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||
|
||||
// from hard fork 2, we forbid dust and compound outputs
|
||||
if (m_hardfork->get_current_version() >= 2) {
|
||||
BOOST_FOREACH(auto &o, tx.vout) {
|
||||
if (!is_valid_decomposed_amount(o.amount)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool Blockchain::have_tx_keyimges_as_spent(const transaction &tx) const
|
||||
{
|
||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace cryptonote
|
|||
bool store_blockchain();
|
||||
|
||||
bool check_tx_inputs(const transaction& tx, uint64_t& pmax_used_block_height, crypto::hash& max_used_block_id, bool kept_by_block = false);
|
||||
bool check_tx_outputs(const transaction& tx);
|
||||
uint64_t get_current_cumulative_blocksize_limit() const;
|
||||
bool is_storing_blockchain()const{return m_is_blockchain_storing;}
|
||||
uint64_t block_difficulty(uint64_t i) const;
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace cryptonote
|
|||
block_reward += fee;
|
||||
|
||||
std::vector<uint64_t> out_amounts;
|
||||
decompose_amount_into_digits(block_reward, ::config::DEFAULT_DUST_THRESHOLD,
|
||||
decompose_amount_into_digits(block_reward, hard_fork_version >= 2 ? 0 : ::config::DEFAULT_DUST_THRESHOLD,
|
||||
[&out_amounts](uint64_t a_chunk) { out_amounts.push_back(a_chunk); },
|
||||
[&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); });
|
||||
|
||||
|
|
|
@ -125,6 +125,12 @@ namespace cryptonote
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_blockchain.check_tx_outputs(tx))
|
||||
{
|
||||
LOG_PRINT_L1("Transaction with id= "<< id << " has at least one invalid outout");
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash max_used_block_id = null_hash;
|
||||
uint64_t max_used_block_height = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue