aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-03-24 21:42:09 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-03-24 21:43:57 +0000
commitf6e2636493970f3cf3279fd9773efe211868ffb4 (patch)
treee7bf67726a09ef6236f760b7b4edc61994afa218 /src
parentMerge pull request #7619 (diff)
downloadmonero-f6e2636493970f3cf3279fd9773efe211868ffb4.tar.xz
blockchain_db: harden code against invalid input types
If an invalid input type were to get to this, the code could remove key images that might be present already in the chain, which could allow a double spend, even if this is impossible with the current code. Reported by KeyboardWarrior.
Diffstat (limited to 'src')
-rw-r--r--src/blockchain_db/blockchain_db.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index 5e12fa8ec..a84a4148d 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -216,15 +216,8 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair
}
else
{
- LOG_PRINT_L1("Unsupported input type, removing key images and aborting transaction addition");
- for (const txin_v& tx_input : tx.vin)
- {
- if (tx_input.type() == typeid(txin_to_key))
- {
- remove_spent_key(boost::get<txin_to_key>(tx_input).k_image);
- }
- }
- return;
+ LOG_PRINT_L1("Unsupported input type, aborting transaction addition");
+ throw std::runtime_error("Unexpected input type, aborting");
}
}