mirror of
https://github.com/monero-project/monero.git
synced 2025-01-28 18:56:31 +02:00
Rename function for clarity
As BlockchainDB::get_output_key was changed to return a struct containing the output key along with two other pieces of metadata for the output, the function name is now changed to be get_output_data. In addition, the database handles in db_bdb and db_lmdb were renamed from m_output_keys to m_output_data to mirror this.
This commit is contained in:
parent
c399dcefd5
commit
204ed981b0
@ -388,7 +388,7 @@ void BlockchainBDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_out
|
|||||||
od.height = m_height;
|
od.height = m_height;
|
||||||
|
|
||||||
Dbt_copy<output_data_t> data(od);
|
Dbt_copy<output_data_t> data(od);
|
||||||
if (m_output_keys->put(DB_DEFAULT_TX, &k, &data, 0))
|
if (m_output_data->put(DB_DEFAULT_TX, &k, &data, 0))
|
||||||
throw0(DB_ERROR("Failed to add output pubkey to db transaction"));
|
throw0(DB_ERROR("Failed to add output pubkey to db transaction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,10 +468,10 @@ void BlockchainBDB::remove_output(const uint64_t& out_index, const uint64_t amou
|
|||||||
throw1(DB_ERROR("Error adding removal of output tx hash to db transaction"));
|
throw1(DB_ERROR("Error adding removal of output tx hash to db transaction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = m_output_keys->del(DB_DEFAULT_TX, &k, 0);
|
result = m_output_data->del(DB_DEFAULT_TX, &k, 0);
|
||||||
if (result == DB_NOTFOUND)
|
if (result == DB_NOTFOUND)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Unexpected: global output index not found in m_output_keys");
|
LOG_PRINT_L0("Unexpected: global output index not found in m_output_data");
|
||||||
}
|
}
|
||||||
else if (result)
|
else if (result)
|
||||||
throw1(DB_ERROR("Error adding removal of output pubkey to db transaction"));
|
throw1(DB_ERROR("Error adding removal of output pubkey to db transaction"));
|
||||||
@ -808,7 +808,7 @@ void BlockchainBDB::open(const std::string& filename, const int db_flags)
|
|||||||
m_output_txs = new Db(m_env, 0);
|
m_output_txs = new Db(m_env, 0);
|
||||||
m_output_indices = new Db(m_env, 0);
|
m_output_indices = new Db(m_env, 0);
|
||||||
m_output_amounts = new Db(m_env, 0);
|
m_output_amounts = new Db(m_env, 0);
|
||||||
m_output_keys = new Db(m_env, 0);
|
m_output_data = new Db(m_env, 0);
|
||||||
|
|
||||||
m_spent_keys = new Db(m_env, 0);
|
m_spent_keys = new Db(m_env, 0);
|
||||||
|
|
||||||
@ -832,7 +832,7 @@ void BlockchainBDB::open(const std::string& filename, const int db_flags)
|
|||||||
|
|
||||||
m_output_txs->set_re_len(sizeof(crypto::hash));
|
m_output_txs->set_re_len(sizeof(crypto::hash));
|
||||||
m_output_indices->set_re_len(sizeof(uint64_t));
|
m_output_indices->set_re_len(sizeof(uint64_t));
|
||||||
m_output_keys->set_re_len(sizeof(output_data_t));
|
m_output_data->set_re_len(sizeof(output_data_t));
|
||||||
|
|
||||||
m_hf_starting_heights->set_re_len(sizeof(uint64_t));
|
m_hf_starting_heights->set_re_len(sizeof(uint64_t));
|
||||||
m_hf_versions->set_re_len(sizeof(uint8_t));
|
m_hf_versions->set_re_len(sizeof(uint8_t));
|
||||||
@ -862,7 +862,7 @@ void BlockchainBDB::open(const std::string& filename, const int db_flags)
|
|||||||
m_output_txs->open(txn, BDB_OUTPUT_TXS, NULL, DB_RECNO, DB_CREATE, 0);
|
m_output_txs->open(txn, BDB_OUTPUT_TXS, NULL, DB_RECNO, DB_CREATE, 0);
|
||||||
m_output_indices->open(txn, BDB_OUTPUT_INDICES, NULL, DB_RECNO, DB_CREATE, 0);
|
m_output_indices->open(txn, BDB_OUTPUT_INDICES, NULL, DB_RECNO, DB_CREATE, 0);
|
||||||
m_output_amounts->open(txn, BDB_OUTPUT_AMOUNTS, NULL, DB_HASH, DB_CREATE, 0);
|
m_output_amounts->open(txn, BDB_OUTPUT_AMOUNTS, NULL, DB_HASH, DB_CREATE, 0);
|
||||||
m_output_keys->open(txn, BDB_OUTPUT_KEYS, NULL, DB_RECNO, DB_CREATE, 0);
|
m_output_data->open(txn, BDB_OUTPUT_KEYS, NULL, DB_RECNO, DB_CREATE, 0);
|
||||||
|
|
||||||
m_spent_keys->open(txn, BDB_SPENT_KEYS, NULL, DB_HASH, DB_CREATE, 0);
|
m_spent_keys->open(txn, BDB_SPENT_KEYS, NULL, DB_HASH, DB_CREATE, 0);
|
||||||
|
|
||||||
@ -990,7 +990,7 @@ void BlockchainBDB::sync()
|
|||||||
m_output_txs->sync(0);
|
m_output_txs->sync(0);
|
||||||
m_output_indices->sync(0);
|
m_output_indices->sync(0);
|
||||||
m_output_amounts->sync(0);
|
m_output_amounts->sync(0);
|
||||||
m_output_keys->sync(0);
|
m_output_data->sync(0);
|
||||||
|
|
||||||
m_spent_keys->sync(0);
|
m_spent_keys->sync(0);
|
||||||
|
|
||||||
@ -1066,7 +1066,7 @@ std::vector<std::string> BlockchainBDB::get_filenames() const
|
|||||||
m_output_amounts->get_dbname(pfname, pdbname);
|
m_output_amounts->get_dbname(pfname, pdbname);
|
||||||
filenames.push_back(fname);
|
filenames.push_back(fname);
|
||||||
|
|
||||||
m_output_keys->get_dbname(pfname, pdbname);
|
m_output_data->get_dbname(pfname, pdbname);
|
||||||
filenames.push_back(fname);
|
filenames.push_back(fname);
|
||||||
|
|
||||||
m_spent_keys->get_dbname(pfname, pdbname);
|
m_spent_keys->get_dbname(pfname, pdbname);
|
||||||
@ -1511,14 +1511,14 @@ uint64_t BlockchainBDB::get_num_outputs(const uint64_t& amount) const
|
|||||||
return num_elems;
|
return num_elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_data_t BlockchainBDB::get_output_key(const uint64_t& global_index) const
|
output_data_t BlockchainBDB::get_output_data(const uint64_t& global_index) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
Dbt_copy<uint32_t> k(global_index + 1);
|
Dbt_copy<uint32_t> k(global_index + 1);
|
||||||
Dbt_copy<output_data_t> v;
|
Dbt_copy<output_data_t> v;
|
||||||
auto get_result = m_output_keys->get(DB_DEFAULT_TX, &k, &v, 0);
|
auto get_result = m_output_data->get(DB_DEFAULT_TX, &k, &v, 0);
|
||||||
if (get_result == DB_NOTFOUND)
|
if (get_result == DB_NOTFOUND)
|
||||||
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
||||||
else if (get_result)
|
else if (get_result)
|
||||||
@ -1527,13 +1527,13 @@ output_data_t BlockchainBDB::get_output_key(const uint64_t& global_index) const
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_data_t BlockchainBDB::get_output_key(const uint64_t& amount, const uint64_t& index)
|
output_data_t BlockchainBDB::get_output_data(const uint64_t& amount, const uint64_t& index)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
uint64_t glob_index = get_output_global_index(amount, index);
|
uint64_t glob_index = get_output_global_index(amount, index);
|
||||||
return get_output_key(glob_index);
|
return get_output_data(glob_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
tx_out_index BlockchainBDB::get_output_tx_and_index(const uint64_t& amount, const uint64_t& index)
|
tx_out_index BlockchainBDB::get_output_tx_and_index(const uint64_t& amount, const uint64_t& index)
|
||||||
@ -1996,7 +1996,7 @@ void BlockchainBDB::get_output_global_indices(const uint64_t& amount, const std:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockchainBDB::get_output_key(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs)
|
void BlockchainBDB::get_output_data(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
LOG_PRINT_L3("BlockchainBDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
@ -2014,7 +2014,7 @@ void BlockchainBDB::get_output_key(const uint64_t &amount, const std::vector<uin
|
|||||||
Dbt_copy<uint32_t> k(index + 1);
|
Dbt_copy<uint32_t> k(index + 1);
|
||||||
Dbt_copy<output_data_t> v;
|
Dbt_copy<output_data_t> v;
|
||||||
|
|
||||||
auto get_result = m_output_keys->get(DB_DEFAULT_TX, &k, &v, 0);
|
auto get_result = m_output_data->get(DB_DEFAULT_TX, &k, &v, 0);
|
||||||
if (get_result == DB_NOTFOUND)
|
if (get_result == DB_NOTFOUND)
|
||||||
throw1(OUTPUT_DNE("output with given index not in db"));
|
throw1(OUTPUT_DNE("output with given index not in db"));
|
||||||
else if (get_result)
|
else if (get_result)
|
||||||
|
@ -297,9 +297,9 @@ public:
|
|||||||
|
|
||||||
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
||||||
|
|
||||||
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index);
|
virtual output_data_t get_output_data(const uint64_t& amount, const uint64_t& index);
|
||||||
virtual output_data_t get_output_key(const uint64_t& global_index) const;
|
virtual output_data_t get_output_data(const uint64_t& global_index) const;
|
||||||
virtual void get_output_key(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs);
|
virtual void get_output_data(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs);
|
||||||
|
|
||||||
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
||||||
virtual void get_output_tx_and_index_from_global(const std::vector<uint64_t> &global_indices,
|
virtual void get_output_tx_and_index_from_global(const std::vector<uint64_t> &global_indices,
|
||||||
@ -426,7 +426,7 @@ private:
|
|||||||
Db* m_output_txs;
|
Db* m_output_txs;
|
||||||
Db* m_output_indices;
|
Db* m_output_indices;
|
||||||
Db* m_output_amounts;
|
Db* m_output_amounts;
|
||||||
Db* m_output_keys;
|
Db* m_output_data;
|
||||||
|
|
||||||
Db* m_spent_keys;
|
Db* m_spent_keys;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
*
|
*
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* uint64_t get_num_outputs(amount)
|
* uint64_t get_num_outputs(amount)
|
||||||
* pub_key get_output_key(amount, index)
|
* pub_key get_output_data(amount, index)
|
||||||
* hash,index get_output_tx_and_index_from_global(index)
|
* hash,index get_output_tx_and_index_from_global(index)
|
||||||
* hash,index get_output_tx_and_index(amount, index)
|
* hash,index get_output_tx_and_index(amount, index)
|
||||||
* vec<uint64> get_tx_output_indices(tx_hash)
|
* vec<uint64> get_tx_output_indices(tx_hash)
|
||||||
@ -465,8 +465,8 @@ public:
|
|||||||
virtual uint64_t get_num_outputs(const uint64_t& amount) const = 0;
|
virtual uint64_t get_num_outputs(const uint64_t& amount) const = 0;
|
||||||
|
|
||||||
// return public key for output with global output amount <amount> and index <index>
|
// return public key for output with global output amount <amount> and index <index>
|
||||||
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index) = 0;
|
virtual output_data_t get_output_data(const uint64_t& amount, const uint64_t& index) = 0;
|
||||||
virtual output_data_t get_output_key(const uint64_t& global_index) const = 0;
|
virtual output_data_t get_output_data(const uint64_t& global_index) const = 0;
|
||||||
|
|
||||||
// returns the tx hash associated with an output, referenced by global output index
|
// returns the tx hash associated with an output, referenced by global output index
|
||||||
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const = 0;
|
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const = 0;
|
||||||
@ -475,7 +475,7 @@ public:
|
|||||||
// return type is pair of tx hash and index
|
// return type is pair of tx hash and index
|
||||||
virtual tx_out_index get_output_tx_and_index(const uint64_t& amount, const uint64_t& index) = 0;
|
virtual tx_out_index get_output_tx_and_index(const uint64_t& amount, const uint64_t& index) = 0;
|
||||||
virtual void get_output_tx_and_index(const uint64_t& amount, const std::vector<uint64_t> &offsets, std::vector<tx_out_index> &indices) = 0;
|
virtual void get_output_tx_and_index(const uint64_t& amount, const std::vector<uint64_t> &offsets, std::vector<tx_out_index> &indices) = 0;
|
||||||
virtual void get_output_key(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs) = 0;
|
virtual void get_output_data(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs) = 0;
|
||||||
|
|
||||||
virtual bool can_thread_bulk_indices() const = 0;
|
virtual bool can_thread_bulk_indices() const = 0;
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ void BlockchainLMDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_ou
|
|||||||
|
|
||||||
MDB_val_copy<output_data_t> data(od);
|
MDB_val_copy<output_data_t> data(od);
|
||||||
//MDB_val_copy<crypto::public_key> val_pubkey(boost::get<txout_to_key>(tx_output.target).key);
|
//MDB_val_copy<crypto::public_key> val_pubkey(boost::get<txout_to_key>(tx_output.target).key);
|
||||||
if (mdb_put(*m_write_txn, m_output_keys, &k, &data, 0))
|
if (mdb_put(*m_write_txn, m_output_data, &k, &data, 0))
|
||||||
throw0(DB_ERROR("Failed to add output pubkey to db transaction"));
|
throw0(DB_ERROR("Failed to add output pubkey to db transaction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,10 +767,10 @@ void BlockchainLMDB::remove_output(const uint64_t& out_index, const uint64_t amo
|
|||||||
throw1(DB_ERROR("Error adding removal of output tx hash to db transaction"));
|
throw1(DB_ERROR("Error adding removal of output tx hash to db transaction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = mdb_del(*m_write_txn, m_output_keys, &k, NULL);
|
result = mdb_del(*m_write_txn, m_output_data, &k, NULL);
|
||||||
if (result == MDB_NOTFOUND)
|
if (result == MDB_NOTFOUND)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Unexpected: global output index not found in m_output_keys");
|
LOG_PRINT_L0("Unexpected: global output index not found in m_output_data");
|
||||||
}
|
}
|
||||||
else if (result)
|
else if (result)
|
||||||
throw1(DB_ERROR("Error adding removal of output pubkey to db transaction"));
|
throw1(DB_ERROR("Error adding removal of output pubkey to db transaction"));
|
||||||
@ -1016,7 +1016,7 @@ void BlockchainLMDB::open(const std::string& filename, const int mdb_flags)
|
|||||||
lmdb_db_open(txn, LMDB_OUTPUT_TXS, MDB_INTEGERKEY | MDB_CREATE, m_output_txs, "Failed to open db handle for m_output_txs");
|
lmdb_db_open(txn, LMDB_OUTPUT_TXS, MDB_INTEGERKEY | MDB_CREATE, m_output_txs, "Failed to open db handle for m_output_txs");
|
||||||
lmdb_db_open(txn, LMDB_OUTPUT_INDICES, MDB_INTEGERKEY | MDB_CREATE, m_output_indices, "Failed to open db handle for m_output_indices");
|
lmdb_db_open(txn, LMDB_OUTPUT_INDICES, MDB_INTEGERKEY | MDB_CREATE, m_output_indices, "Failed to open db handle for m_output_indices");
|
||||||
lmdb_db_open(txn, LMDB_OUTPUT_AMOUNTS, MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED | MDB_CREATE, m_output_amounts, "Failed to open db handle for m_output_amounts");
|
lmdb_db_open(txn, LMDB_OUTPUT_AMOUNTS, MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED | MDB_CREATE, m_output_amounts, "Failed to open db handle for m_output_amounts");
|
||||||
lmdb_db_open(txn, LMDB_OUTPUT_KEYS, MDB_INTEGERKEY | MDB_CREATE, m_output_keys, "Failed to open db handle for m_output_keys");
|
lmdb_db_open(txn, LMDB_OUTPUT_KEYS, MDB_INTEGERKEY | MDB_CREATE, m_output_data, "Failed to open db handle for m_output_data");
|
||||||
|
|
||||||
lmdb_db_open(txn, LMDB_SPENT_KEYS, MDB_CREATE, m_spent_keys, "Failed to open db handle for m_spent_keys");
|
lmdb_db_open(txn, LMDB_SPENT_KEYS, MDB_CREATE, m_spent_keys, "Failed to open db handle for m_spent_keys");
|
||||||
|
|
||||||
@ -1058,7 +1058,7 @@ void BlockchainLMDB::open(const std::string& filename, const int mdb_flags)
|
|||||||
{
|
{
|
||||||
MDB_val_copy<uint64_t> k(0);
|
MDB_val_copy<uint64_t> k(0);
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
auto get_result = mdb_get(txn, m_output_keys, &k, &v);
|
auto get_result = mdb_get(txn, m_output_data, &k, &v);
|
||||||
if(get_result != MDB_SUCCESS)
|
if(get_result != MDB_SUCCESS)
|
||||||
{
|
{
|
||||||
txn.abort();
|
txn.abort();
|
||||||
@ -1718,7 +1718,7 @@ uint64_t BlockchainLMDB::get_num_outputs(const uint64_t& amount) const
|
|||||||
return num_elems;
|
return num_elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_data_t BlockchainLMDB::get_output_key(const uint64_t &global_index) const
|
output_data_t BlockchainLMDB::get_output_data(const uint64_t &global_index) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
@ -1729,7 +1729,7 @@ output_data_t BlockchainLMDB::get_output_key(const uint64_t &global_index) const
|
|||||||
|
|
||||||
MDB_val_copy<uint64_t> k(global_index);
|
MDB_val_copy<uint64_t> k(global_index);
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
auto get_result = mdb_get(txn, m_output_keys, &k, &v);
|
auto get_result = mdb_get(txn, m_output_data, &k, &v);
|
||||||
if (get_result == MDB_NOTFOUND)
|
if (get_result == MDB_NOTFOUND)
|
||||||
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
||||||
else if (get_result)
|
else if (get_result)
|
||||||
@ -1738,13 +1738,13 @@ output_data_t BlockchainLMDB::get_output_key(const uint64_t &global_index) const
|
|||||||
return *(output_data_t *) v.mv_data;
|
return *(output_data_t *) v.mv_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_data_t BlockchainLMDB::get_output_key(const uint64_t& amount, const uint64_t& index)
|
output_data_t BlockchainLMDB::get_output_data(const uint64_t& amount, const uint64_t& index)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
uint64_t glob_index = get_output_global_index(amount, index);
|
uint64_t glob_index = get_output_global_index(amount, index);
|
||||||
return get_output_key(glob_index);
|
return get_output_data(glob_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
tx_out_index BlockchainLMDB::get_output_tx_and_index_from_global(const uint64_t& index) const
|
tx_out_index BlockchainLMDB::get_output_tx_and_index_from_global(const uint64_t& index) const
|
||||||
@ -2427,7 +2427,7 @@ void BlockchainLMDB::get_output_global_indices(const uint64_t& amount, const std
|
|||||||
LOG_PRINT_L3("txx: " << txx << " db1: " << t_dbmul << " db2: " << t_dbscan);
|
LOG_PRINT_L3("txx: " << txx << " db1: " << t_dbmul << " db2: " << t_dbscan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockchainLMDB::get_output_key(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs)
|
void BlockchainLMDB::get_output_data(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
TIME_MEASURE_START(db3);
|
TIME_MEASURE_START(db3);
|
||||||
@ -2453,7 +2453,7 @@ void BlockchainLMDB::get_output_key(const uint64_t &amount, const std::vector<ui
|
|||||||
MDB_val_copy<uint64_t> k(index);
|
MDB_val_copy<uint64_t> k(index);
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
|
|
||||||
auto get_result = mdb_get(*txn_ptr, m_output_keys, &k, &v);
|
auto get_result = mdb_get(*txn_ptr, m_output_data, &k, &v);
|
||||||
if (get_result == MDB_NOTFOUND)
|
if (get_result == MDB_NOTFOUND)
|
||||||
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
throw1(OUTPUT_DNE("Attempting to get output pubkey by global index, but key does not exist"));
|
||||||
else if (get_result)
|
else if (get_result)
|
||||||
|
@ -159,9 +159,9 @@ public:
|
|||||||
|
|
||||||
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
||||||
|
|
||||||
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index);
|
virtual output_data_t get_output_data(const uint64_t& amount, const uint64_t& index);
|
||||||
virtual output_data_t get_output_key(const uint64_t& global_index) const;
|
virtual output_data_t get_output_data(const uint64_t& global_index) const;
|
||||||
virtual void get_output_key(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs);
|
virtual void get_output_data(const uint64_t &amount, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs);
|
||||||
|
|
||||||
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
||||||
virtual void get_output_tx_and_index_from_global(const std::vector<uint64_t> &global_indices,
|
virtual void get_output_tx_and_index_from_global(const std::vector<uint64_t> &global_indices,
|
||||||
@ -284,7 +284,7 @@ private:
|
|||||||
MDB_dbi m_output_txs;
|
MDB_dbi m_output_txs;
|
||||||
MDB_dbi m_output_indices;
|
MDB_dbi m_output_indices;
|
||||||
MDB_dbi m_output_amounts;
|
MDB_dbi m_output_amounts;
|
||||||
MDB_dbi m_output_keys;
|
MDB_dbi m_output_data;
|
||||||
|
|
||||||
MDB_dbi m_spent_keys;
|
MDB_dbi m_spent_keys;
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
output_data_t od = db->get_output_key(idx);
|
output_data_t od = db->get_output_data(idx);
|
||||||
start_struct(d, boost::lexical_cast<std::string>(idx));
|
start_struct(d, boost::lexical_cast<std::string>(idx));
|
||||||
write_pod(d, "pubkey", string_tools::pod_to_hex(od.pubkey));
|
write_pod(d, "pubkey", string_tools::pod_to_hex(od.pubkey));
|
||||||
write_pod(d, "unlock_time", od.unlock_time);
|
write_pod(d, "unlock_time", od.unlock_time);
|
||||||
|
@ -150,7 +150,7 @@ bool Blockchain::scan_outputkeys_for_indexes(const txin_to_key& tx_in_to_key, vi
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
m_db->get_output_key(tx_in_to_key.amount, absolute_offsets, outputs);
|
m_db->get_output_data(tx_in_to_key.amount, absolute_offsets, outputs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ bool Blockchain::scan_outputkeys_for_indexes(const txin_to_key& tx_in_to_key, vi
|
|||||||
std::vector<output_data_t> add_outputs;
|
std::vector<output_data_t> add_outputs;
|
||||||
for (size_t i = outputs.size(); i < absolute_offsets.size(); i++)
|
for (size_t i = outputs.size(); i < absolute_offsets.size(); i++)
|
||||||
add_offsets.push_back(absolute_offsets[i]);
|
add_offsets.push_back(absolute_offsets[i]);
|
||||||
m_db->get_output_key(tx_in_to_key.amount, add_offsets, add_outputs);
|
m_db->get_output_data(tx_in_to_key.amount, add_offsets, add_outputs);
|
||||||
outputs.insert(outputs.end(), add_outputs.begin(), add_outputs.end());
|
outputs.insert(outputs.end(), add_outputs.begin(), add_outputs.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ bool Blockchain::scan_outputkeys_for_indexes(const txin_to_key& tx_in_to_key, vi
|
|||||||
if (count < outputs.size())
|
if (count < outputs.size())
|
||||||
output_index = outputs.at(count);
|
output_index = outputs.at(count);
|
||||||
else
|
else
|
||||||
output_index = m_db->get_output_key(tx_in_to_key.amount, i);
|
output_index = m_db->get_output_data(tx_in_to_key.amount, i);
|
||||||
|
|
||||||
// call to the passed boost visitor to grab the public key for the output
|
// call to the passed boost visitor to grab the public key for the output
|
||||||
if (!vis.handle_output(output_index.unlock_time, output_index.pubkey))
|
if (!vis.handle_output(output_index.unlock_time, output_index.pubkey))
|
||||||
@ -1402,7 +1402,7 @@ void Blockchain::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_A
|
|||||||
|
|
||||||
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& oen = *result_outs.outs.insert(result_outs.outs.end(), COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry());
|
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& oen = *result_outs.outs.insert(result_outs.outs.end(), COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry());
|
||||||
oen.global_amount_index = i;
|
oen.global_amount_index = i;
|
||||||
output_data_t data = m_db->get_output_key(amount, i);
|
output_data_t data = m_db->get_output_data(amount, i);
|
||||||
oen.out_key = data.pubkey;
|
oen.out_key = data.pubkey;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
@ -2815,7 +2815,7 @@ void Blockchain::output_scan_worker(const uint64_t amount, const std::vector<uin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_db->get_output_key(amount, offsets, outputs);
|
m_db->get_output_data(amount, offsets, outputs);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user