aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain_db.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-10-28 22:25:03 -0400
committerwarptangent <warptangent@inbox.com>2015-01-04 19:31:19 -0800
commit1a546e32227492cec4238ff0634e7c59b23ce9bb (patch)
tree3423e06af2ba4d96fb3c4bea628807d9f755d8a2 /src/cryptonote_core/blockchain_db.cpp
parentMinor bug fixes and debug prints (diff)
downloadmonero-1a546e32227492cec4238ff0634e7c59b23ce9bb.tar.xz
some bug fixes, but still needs work
There are quite a few debug prints in this commit that will need removed later, but for posterity (in case someone wants to debug this while I'm away), I left them in. Currently errors when syncing on the first block that has a "real" transaction. Seems to not be able to validate the ring signature, but I can't for the life of me figure out what's going wrong.
Diffstat (limited to 'src/cryptonote_core/blockchain_db.cpp')
-rw-r--r--src/cryptonote_core/blockchain_db.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/cryptonote_core/blockchain_db.cpp b/src/cryptonote_core/blockchain_db.cpp
index 02912be10..c7109dd20 100644
--- a/src/cryptonote_core/blockchain_db.cpp
+++ b/src/cryptonote_core/blockchain_db.cpp
@@ -29,6 +29,8 @@
#include "cryptonote_core/blockchain_db.h"
#include "cryptonote_format_utils.h"
+using epee::string_tools::pod_to_hex;
+
namespace cryptonote
{
@@ -43,20 +45,31 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti
{
crypto::hash tx_hash = get_transaction_hash(tx);
+ LOG_PRINT_L0("Adding tx with hash " << pod_to_hex(tx_hash) << " to BlockchainDB instance");
+ LOG_PRINT_L0("Included in block with hash " << pod_to_hex(blk_hash));
+ LOG_PRINT_L0("Unlock time == " << tx.unlock_time);
+
add_transaction_data(blk_hash, tx);
// iterate tx.vout using indices instead of C++11 foreach syntax because
// we need the index
- for (uint64_t i = 0; i < tx.vout.size(); ++i)
+ if (tx.vout.size() != 0) // it may be technically possible for a tx to have no outputs
{
- add_output(tx_hash, tx.vout[i], i);
- }
+ for (uint64_t i = 0; i < tx.vout.size(); ++i)
+ {
+ add_output(tx_hash, tx.vout[i], i);
+ }
- for (const txin_v& tx_input : tx.vin)
- {
- if (tx_input.type() == typeid(txin_to_key))
+ for (const txin_v& tx_input : tx.vin)
{
- add_spent_key(boost::get<txin_to_key>(tx_input).k_image);
+ if (tx_input.type() == typeid(txin_to_key))
+ {
+ add_spent_key(boost::get<txin_to_key>(tx_input).k_image);
+ }
+ else
+ {
+ LOG_PRINT_L0("Is miner tx");
+ }
}
}
}
@@ -68,10 +81,12 @@ uint64_t BlockchainDB::add_block( const block& blk
, const std::vector<transaction>& txs
)
{
+ crypto::hash blk_hash = get_block_hash(blk);
+ LOG_PRINT_L0("Adding block with hash " << pod_to_hex(blk_hash) << " to BlockchainDB instance.");
+
// call out to subclass implementation to add the block & metadata
add_block(blk, block_size, cumulative_difficulty, coins_generated);
- crypto::hash blk_hash = get_block_hash(blk);
// call out to add the transactions
add_transaction(blk_hash, blk.miner_tx);