updated to newest monero codebase - sort of.

pull/2/head
moneroexamples 7 years ago
parent 614698e1a8
commit d9cddf91f4

@ -30,6 +30,7 @@ set(MONERO_HEADERS_DIR
include_directories(
${MONERO_HEADERS_DIR}/src
${MONERO_HEADERS_DIR}/external
${MONERO_HEADERS_DIR}/external/easylogging++
${MONERO_HEADERS_DIR}/contrib/epee/include
${MONERO_HEADERS_DIR}/external/db_drivers/liblmdb)
@ -60,6 +61,10 @@ add_library(mnemonics STATIC IMPORTED)
set_property(TARGET mnemonics
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libmnemonics.a)
add_library(epee STATIC IMPORTED)
set_property(TARGET epee
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libepee.a)
add_library(blockchain_db STATIC IMPORTED)
set_property(TARGET blockchain_db
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libblockchain_db.a)
@ -110,6 +115,7 @@ target_link_libraries(restbed_xmr
ringct
common
mnemonics
epee
mysqlpp
mysqlclient
${Boost_LIBRARIES}

@ -154,7 +154,28 @@ CurrentBlockchainStatus::get_block_txs(const block &blk, list <transaction> &blk
return true;
}
bool
CurrentBlockchainStatus::tx_exist(const crypto::hash& tx_hash)
{
return core_storage->have_tx(tx_hash);
}
bool
CurrentBlockchainStatus::tx_exist(const string& tx_hash_str)
{
crypto::hash tx_hash;
if (hex_to_pod(tx_hash_str, tx_hash))
{
return tx_exist(tx_hash);
}
throw runtime_error("(hex_to_pod(tx_hash_str, tx_hash) failed!");
}
bool
CurrentBlockchainStatus::get_output_keys(const uint64_t& amount,
const vector<uint64_t>& absolute_offsets,
vector<cryptonote::output_data_t>& outputs)

@ -97,6 +97,12 @@ struct CurrentBlockchainStatus
static bool
get_block_txs(const block &blk, list <transaction> &blk_txs);
static bool
tx_exist(const crypto::hash& tx_hash);
static bool
tx_exist(const string& tx_hash_str);
static bool
get_output_keys(const uint64_t& amount,
const vector<uint64_t>& absolute_offsets,

@ -180,10 +180,22 @@ YourMoneroRequests::get_address_txs(const shared_ptr< Session > session, const B
for (XmrTransaction tx: txs)
{
// first we check if txs stored in db are already spendable
// it means if they are older than 10 blocks. If yes,
// we mark them as spendable, as we assumet that blocks
// older than 10 blocks are permanent, i.e, they wont get
// orphaned.
if (bool {tx.spendable} == false)
{
if (CurrentBlockchainStatus::is_tx_unlocked(tx.height))
{
// this tx was before marked as unspendable, but now
// it is spendable. Meaning, that its older than 10 blocks.
// so mark it as spendable, so that its permanet.
uint64_t no_row_updated = xmr_accounts->mark_tx_spendable(tx.id);
if (no_row_updated != 1)
@ -193,6 +205,15 @@ YourMoneroRequests::get_address_txs(const shared_ptr< Session > session, const B
tx.spendable = true;
}
else
{
// tx was marked as non-spendable, i.e., youger than 10 blocks
// so we still are going to use this txs, but we need to double
// check if its still valid, i.e., it's block did not get orphaned.
// we do this by checking if txs still exists in the blockchain
// and if its in the same block as noted in the database.
}
}
// get inputs associated with a given

@ -163,8 +163,8 @@ get_payment_id(const transaction& tx,
inline void
enable_monero_log() {
uint32_t log_level = 0;
epee::log_space::get_set_log_detalisation_level(true, log_level);
epee::log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
log_space::log_singletone::get_set_log_detalisation_level(true, log_level);
log_space::log_singletone::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
}

Loading…
Cancel
Save