diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-25 21:56:37 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-25 21:56:37 +0000 |
commit | 5eef64578ba1e19c9a6045a25369db19d4136e75 (patch) | |
tree | 20407313f0d4c0ab0dcac8fb427337769abd0f2a /src/blockchain_db | |
parent | Merge pull request #560 (diff) | |
download | monero-5eef64578ba1e19c9a6045a25369db19d4136e75.tar.xz |
db: throw when given a non txout_to_key output to add
The check was explicit in the original version, so it seems
safer to make it explicit here, especially as it is now done
implicitely in a different place, away from the original check.
Diffstat (limited to 'src/blockchain_db')
-rw-r--r-- | src/blockchain_db/berkeleydb/db_bdb.cpp | 4 | ||||
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index 236bc4fe6..4799afebc 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -391,6 +391,10 @@ void BlockchainBDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_out if (m_output_keys->put(DB_DEFAULT_TX, &k, &data, 0)) throw0(DB_ERROR("Failed to add output pubkey to db transaction")); } + else + { + throw0(DB_ERROR("Wrong output type: expected txout_to_key")); + } m_num_outputs++; } diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 4a4550179..b5f76301c 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -695,6 +695,10 @@ void BlockchainLMDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_ou if (mdb_put(*m_write_txn, m_output_keys, &k, &data, 0)) throw0(DB_ERROR("Failed to add output pubkey to db transaction")); } + else + { + throw0(DB_ERROR("Wrong output type: expected txout_to_key")); + } m_num_outputs++; } |