aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-09 19:26:36 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-09 19:26:36 +0100
commit533acc30eda7792c802ea8b6417917fa99b8bc2b (patch)
tree9dccf0d21e1767cf97ecc866c93615510baeb1c0 /src/blockchain_db/blockchain_db.cpp
parentMerge pull request #358 (diff)
downloadmonero-533acc30eda7792c802ea8b6417917fa99b8bc2b.tar.xz
blockchain_db: store key images for tx without outputs too
Diffstat (limited to 'src/blockchain_db/blockchain_db.cpp')
-rw-r--r--src/blockchain_db/blockchain_db.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index f07f30088..41fee5dc7 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -60,19 +60,16 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti
// iterate tx.vout using indices instead of C++11 foreach syntax because
// we need the index
- if (tx.vout.size() != 0) // it may be technically possible for a tx to have no outputs
+ for (uint64_t i = 0; i < tx.vout.size(); ++i)
{
- for (uint64_t i = 0; i < tx.vout.size(); ++i)
- {
- add_output(tx_hash, tx.vout[i], i, tx.unlock_time);
- }
+ add_output(tx_hash, tx.vout[i], i, tx.unlock_time);
+ }
- for (const txin_v& tx_input : tx.vin)
+ for (const txin_v& tx_input : tx.vin)
+ {
+ if (tx_input.type() == typeid(txin_to_key))
{
- if (tx_input.type() == typeid(txin_to_key))
- {
- add_spent_key(boost::get<txin_to_key>(tx_input).k_image);
- }
+ add_spent_key(boost::get<txin_to_key>(tx_input).k_image);
}
}
}