Compare commits

..

4 Commits

Author SHA1 Message Date
moneroexamples d2d6504dd0 fix mysql_tests
5 years ago
moneroexamples 66047b9dc6 dont require inputs and outputs_id to be unique
5 years ago
moneroexamples 9087478ea3 upgrade xmregcore
5 years ago
moneroexamples 174b934501 Output table and known_outputs_t modified
5 years ago

3
.gitmodules vendored

@ -1,3 +1,4 @@
[submodule "src/xmregcore"] [submodule "src/xmregcore"]
path = src/xmregcore path = src/xmregcore
url = https://git.wownero.com/asymptotically/xmregcore url = https://github.com/moneroexamples/xmregcore
branch = release_v13

@ -1,4 +1,4 @@
# Generated by YCM Generator at 2019-11-20 22:37:52.132783 # Generated by YCM Generator at 2019-02-04 16:43:28.957650
# This file is NOT licensed under the GPLv3, which is the license for the rest # This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe. # of YouCompleteMe.
@ -36,27 +36,28 @@ import ycm_core
flags = [ flags = [
'-x', '-x',
'c++', 'c++',
'-DBOOST_ALL_NO_LIB', '-DASIO_STANDALONE=YES',
'-DBOOST_CHRONO_DYN_LINK', '-DBUILD_SSL=TRUE',
'-DBOOST_DATE_TIME_DYN_LINK', '-I/home/mwo2/monero/build',
'-DBOOST_FILESYSTEM_DYN_LINK', '-I/home/mwo2/monero/contrib/epee/include',
'-DBOOST_PROGRAM_OPTIONS_DYN_LINK', '-I/home/mwo2/monero/external',
'-DBOOST_REGEX_DYN_LINK', '-I/home/mwo2/monero/external/db_drivers/liblmdb',
'-DBOOST_SERIALIZATION_DYN_LINK', '-I/home/mwo2/monero/external/easylogging++',
'-DBOOST_SYSTEM_DYN_LINK', '-I/home/mwo2/monero/src',
'-DBOOST_THREAD_DYN_LINK', '-I/home/mwo2/openmonero/ext/restbed/source',
'-I/home/mwo2/openmonero/src/xmregcore', '-I/home/mwo2/openmonero/src/xmregcore',
'-I/tmp/tmpaV0i5C/distribution/include',
'-I/tmp/tmpaV0i5C/gen',
'-I/usr/include/mysql', '-I/usr/include/mysql',
'-I/usr/include/mysql++', '-I/usr/local/include',
'-I/usr/local/include/mysql',
'-I/usr/local/opt/openssl/include',
'-Wall',
'-Weffc++',
'-Wextra',
'-Wno-unknown-pragmas',
'-std=c++14',
'-std=gnu++14', '-std=gnu++14',
'-isystem', '/home/mwo2/monero/build', '-isystem', '/home/mwo2/openmonero/ext/restbed/dependency/asio/asio/include',
'-isystem', '/home/mwo2/monero/contrib/epee/include', '-isystem', '/home/mwo2/openmonero/ext/restbed/dependency/kashmir',
'-isystem', '/home/mwo2/monero/external',
'-isystem', '/home/mwo2/monero/external/db_drivers/liblmdb',
'-isystem', '/home/mwo2/monero/external/easylogging++',
'-isystem', '/home/mwo2/monero/src',
] ]
@ -156,11 +157,3 @@ def FlagsForFile( filename, **kwargs ):
'do_cache': True 'do_cache': True
} }
def Settings( **kwargs ):
language = kwargs[ 'language' ]
if language == 'cfamily':
return {
'flags': flags
}
return {}

@ -29,8 +29,8 @@ to MyMonero. They include:
## Live stagenet version ## Live stagenet version
- [http://139.162.60.17:81](http://139.162.60.17:81) - down for now. - [http://139.162.60.17:81](http://139.162.60.17:81)
- [http://139.162.60.17:8100](http://139.162.60.17:8100) - MyMonero frontend - down for now. - [http://139.162.60.17:8100](http://139.162.60.17:8100) - MyMonero frontend
This is OpenMonero running on stagnet network. You can use it to play around with it. This is OpenMonero running on stagnet network. You can use it to play around with it.
Please note that the live version is running on cheap VPS, which may result in Please note that the live version is running on cheap VPS, which may result in

@ -2,7 +2,7 @@
"daemon-url" : "daemon-url" :
{ {
"_comment" : "RPC urls to monero deamon", "_comment" : "RPC urls to monero deamon",
"mainnet" : "http://127.0.0.1:34568", "mainnet" : "http://127.0.0.1:18081",
"testnet" : "http://127.0.0.1:28081", "testnet" : "http://127.0.0.1:28081",
"stagenet" : "http://127.0.0.1:38081" "stagenet" : "http://127.0.0.1:38081"
}, },
@ -43,8 +43,8 @@
"mainnet" : "mainnet" :
{ {
"_comment": "these are official monero project donation address and viewkey. change it to yours", "_comment": "these are official monero project donation address and viewkey. change it to yours",
"address" : "Wo3MWeKwtA918DU4c69hVSNgejdWFCRCuWjShRY66mJkU2Hv58eygJWDJS1MNa2Ge5M1WjUkGHuLqHkweDxwZZU42d16v94mP", "address" : "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
"viewkey" : "e62e40bfd5ca7e3a7f199602a3c97df511780489e1c1861884b00c28abaea406" "viewkey" : "f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501"
}, },
"stagenet" : "stagenet" :
{ {

@ -1,19 +1,19 @@
var config = { var config = {
apiUrl: "https://hodl.wowbux.org/api/", apiUrl: "http://127.0.0.1:1984/",
mainnetExplorerUrl: "https://explore.wownero.com/", mainnetExplorerUrl: "https://xmrchain.com/",
testnetExplorerUrl: "https://testnet.xmrchain.com/", testnetExplorerUrl: "https://testnet.xmrchain.com/",
stagenetExplorerUrl: "http://139.162.60.17:8082/", stagenetExplorerUrl: "http://139.162.60.17:8082/",
nettype: 0, /* 0 - MAINNET, 1 - TESTNET, 2 - STAGENET */ nettype: 2, /* 0 - MAINNET, 1 - TESTNET, 2 - STAGENET */
coinUnitPlaces: 11, coinUnitPlaces: 12,
txMinConfirms: 4, // corresponds to CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE in Monero txMinConfirms: 10, // corresponds to CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE in Monero
txCoinbaseMinConfirms: 60, // corresponds to CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW in Monero txCoinbaseMinConfirms: 60, // corresponds to CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW in Monero
coinSymbol: 'WOW', coinSymbol: 'XMR',
openAliasPrefix: "wow", openAliasPrefix: "xmr",
coinName: 'wownero', coinName: 'Monero',
coinUriPrefix: 'wownero:', coinUriPrefix: 'monero:',
addressPrefix: 4146, addressPrefix: 18,
integratedAddressPrefix: 6810, integratedAddressPrefix: 19,
subAddressPrefix: 12208, subAddressPrefix: 42,
addressPrefixTestnet: 53, addressPrefixTestnet: 53,
integratedAddressPrefixTestnet: 54, integratedAddressPrefixTestnet: 54,
subAddressPrefixTestnet: 63, subAddressPrefixTestnet: 63,
@ -23,11 +23,11 @@ var config = {
feePerKB: new JSBigInt('2000000000'),//20^10 - not used anymore, as fee is dynamic. feePerKB: new JSBigInt('2000000000'),//20^10 - not used anymore, as fee is dynamic.
dustThreshold: new JSBigInt('1000000000'),//10^10 used for choosing outputs/change - we decompose all the way down if the receiver wants now regardless of threshold dustThreshold: new JSBigInt('1000000000'),//10^10 used for choosing outputs/change - we decompose all the way down if the receiver wants now regardless of threshold
txChargeRatio: 0.5, txChargeRatio: 0.5,
defaultMixin: 20, // minimum mixin for hardfork v8 is 10 (ring size 11) defaultMixin: 10, // minimum mixin for hardfork v8 is 10 (ring size 11)
txChargeAddress: '', txChargeAddress: '',
idleTimeout: 30, idleTimeout: 30,
idleWarningDuration: 20, idleWarningDuration: 20,
maxBlockNumber: 500000000, maxBlockNumber: 500000000,
avgBlockTime: 300, avgBlockTime: 120,
debugMode: false debugMode: false
}; };

File diff suppressed because one or more lines are too long

@ -16,6 +16,7 @@ import monero
# openmonero backend url # openmonero backend url
om_url = "http://127.0.0.1:1984/" om_url = "http://127.0.0.1:1984/"
#om_url = "http://139.162.60.17:1984/"
async def make_request(url, payload=""): async def make_request(url, payload=""):

@ -35,7 +35,7 @@ USE `openmonero`;
DROP TABLE IF EXISTS `Accounts`; DROP TABLE IF EXISTS `Accounts`;
CREATE TABLE IF NOT EXISTS `Accounts` ( CREATE TABLE IF NOT EXISTS `Accounts` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`address` varchar(100) NOT NULL, `address` varchar(95) NOT NULL,
`viewkey_hash` char(64) NOT NULL, `viewkey_hash` char(64) NOT NULL,
`scanned_block_height` int(10) UNSIGNED NOT NULL DEFAULT '0', `scanned_block_height` int(10) UNSIGNED NOT NULL DEFAULT '0',
`scanned_block_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `scanned_block_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
@ -63,7 +63,6 @@ CREATE TABLE IF NOT EXISTS `Inputs` (
`amount` bigint(20) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000000000000000000', `amount` bigint(20) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000000000000000000',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `output_id` (`output_id`,`key_image`),
KEY `account_id2` (`account_id`), KEY `account_id2` (`account_id`),
KEY `tx_id2` (`tx_id`), KEY `tx_id2` (`tx_id`),
KEY `output_id2` (`output_id`) KEY `output_id2` (`output_id`)
@ -91,7 +90,7 @@ CREATE TABLE IF NOT EXISTS `Outputs` (
`mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0', `mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `out_pub_key` (`out_pub_key`), UNIQUE KEY `out_pub_key` (`out_pub_key`, `tx_id`),
KEY `tx_id` (`tx_id`), KEY `tx_id` (`tx_id`),
KEY `account_id` (`account_id`) USING BTREE KEY `account_id` (`account_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@ -35,7 +35,7 @@ USE `openmonero_test`;
DROP TABLE IF EXISTS `Accounts`; DROP TABLE IF EXISTS `Accounts`;
CREATE TABLE IF NOT EXISTS `Accounts` ( CREATE TABLE IF NOT EXISTS `Accounts` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`address` varchar(100) NOT NULL, `address` varchar(95) NOT NULL,
`viewkey_hash` char(64) NOT NULL, `viewkey_hash` char(64) NOT NULL,
`scanned_block_height` int(10) UNSIGNED NOT NULL DEFAULT '0', `scanned_block_height` int(10) UNSIGNED NOT NULL DEFAULT '0',
`scanned_block_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `scanned_block_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
@ -80,7 +80,6 @@ CREATE TABLE IF NOT EXISTS `Inputs` (
`amount` bigint(20) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000000000000000000', `amount` bigint(20) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000000000000000000',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `output_id` (`output_id`,`key_image`),
KEY `account_id2` (`account_id`), KEY `account_id2` (`account_id`),
KEY `tx_id2` (`tx_id`), KEY `tx_id2` (`tx_id`),
KEY `output_id2` (`output_id`) KEY `output_id2` (`output_id`)
@ -190,7 +189,7 @@ CREATE TABLE IF NOT EXISTS `Outputs` (
`mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0', `mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `out_pub_key` (`out_pub_key`), UNIQUE KEY `out_pub_key` (`out_pub_key`, `tx_id`),
KEY `tx_id` (`tx_id`), KEY `tx_id` (`tx_id`),
KEY `account_id` (`account_id`) USING BTREE KEY `account_id` (`account_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=140460833003782 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=140460833003782 DEFAULT CHARSET=utf8;

@ -46,8 +46,7 @@ CurrentBlockchainStatus::monitor_blockchain()
break; break;
} }
//OMVLOG1 << "PoolQueue size: " OMVLOG1 << "PoolQueue size: "
OMINFO << "PoolQueue size: "
<< TP::DefaultThreadPool::queueSize(); << TP::DefaultThreadPool::queueSize();
update_current_blockchain_height(); update_current_blockchain_height();
@ -590,51 +589,62 @@ bool
CurrentBlockchainStatus::read_mempool() CurrentBlockchainStatus::read_mempool()
{ {
// get txs in the mempool // get txs in the mempool
std::vector<tx_info> mempool_tx_info;
mempool_txs_t local_mempool_txs; vector<spent_key_image_info> key_image_infos;
auto future_result = thread_pool->submit( auto future_result = thread_pool->submit(
[this](auto& local_mempool_txs) [this](auto& mempool_tx_info, auto& key_image_infos)
-> bool -> bool
{ {
if (!this->mcore->get_mempool_txs(
std::vector<transaction> txs; mempool_tx_info, key_image_infos))
if (!this->mcore->get_mempool_txs(txs))
{ {
OMERROR << "Getting mempool failed "; OMERROR << "Getting mempool failed ";
return false; return false;
} }
return true;
for (size_t i = 0; i < txs.size(); ++i) }, std::ref(mempool_tx_info),
{ std::ref(key_image_infos));
// get transaction info of the tx in the mempool
auto const& tx = txs.at(i);
tx_memory_pool::tx_details txd; if (!future_result.get())
return false;
txpool_tx_meta_t meta; // not using this info at present
(void) key_image_infos;
if (!this->mcore->get_core().get_txpool_tx_meta(tx.hash, meta)) std::lock_guard<std::mutex> lck (getting_mempool_txs);
{
OMERROR << "Failed to find tx in txpool";
return false;
}
local_mempool_txs.emplace_back(meta.receive_time, tx); // clear current mempool txs vector
// repopulate it with each execution of read_mempool()
// not very efficient but good enough for now.
mempool_txs.clear();
} // for (size_t i = 0; i < mempool_tx_info.size(); ++i) // if dont have tx_blob member, construct tx
// from json obtained from the rpc call
return true; for (size_t i = 0; i < mempool_tx_info.size(); ++i)
{
// get transaction info of the tx in the mempool
tx_info const& _tx_info = mempool_tx_info.at(i);
}, std::ref(local_mempool_txs)); transaction tx;
crypto::hash tx_hash;
crypto::hash tx_prefix_hash;
if (!future_result.get()) if (!parse_and_validate_tx_from_blob(
return false; _tx_info.tx_blob, tx, tx_hash, tx_prefix_hash))
{
OMERROR << "Cant make tx from _tx_info.tx_blob";
return false;
}
std::lock_guard<std::mutex> lck (getting_mempool_txs); (void) tx_hash;
(void) tx_prefix_hash;
mempool_txs.emplace_back(_tx_info.receive_time, tx);
mempool_txs = std::move(local_mempool_txs); } // for (size_t i = 0; i < mempool_tx_info.size(); ++i)
return true; return true;
} }
@ -862,7 +872,7 @@ CurrentBlockchainStatus::get_searched_blk_no(const string& address,
bool bool
CurrentBlockchainStatus::get_known_outputs_keys( CurrentBlockchainStatus::get_known_outputs_keys(
string const& address, string const& address,
unordered_map<public_key, uint64_t>& known_outputs_keys) known_outputs_t& known_outputs_keys)
{ {
std::lock_guard<std::mutex> lck (searching_threads_map_mtx); std::lock_guard<std::mutex> lck (searching_threads_map_mtx);

@ -50,6 +50,8 @@ public:
// recieved_time, tx // recieved_time, tx
using mempool_txs_t = vector<pair<uint64_t, transaction>>; using mempool_txs_t = vector<pair<uint64_t, transaction>>;
//output_pubk, amount
using known_outputs_t = unordered_multimap<public_key, uint64_t>;
// height , timestamp, is_coinbase // height , timestamp, is_coinbase
using txs_tuple_t using txs_tuple_t
@ -259,8 +261,7 @@ public:
virtual bool virtual bool
get_known_outputs_keys(string const& address, get_known_outputs_keys(string const& address,
unordered_map<public_key, known_outputs_t& known_outputs_keys);
uint64_t>& known_outputs_keys);
virtual void virtual void
clean_search_thread_map(); clean_search_thread_map();

@ -1452,6 +1452,9 @@ OpenMoneroRequests::import_recent_wallet_request(
XmrAccount updated_acc = acc; XmrAccount updated_acc = acc;
//cout << updated_acc.scanned_block_height
//<< ',' << no_blocks_to_import << '\n';
// make sure scanned_block_height is larger than // make sure scanned_block_height is larger than
// no_blocks_to_import so we dont // no_blocks_to_import so we dont
// end up with overflowing uint64_t. // end up with overflowing uint64_t.
@ -1710,19 +1713,9 @@ OpenMoneroRequests::get_tx(
if (current_bc_status->get_xmr_address_viewkey( if (current_bc_status->get_xmr_address_viewkey(
xmr_address, address_info, viewkey)) xmr_address, address_info, viewkey))
{ {
auto coreacc = make_account(xmr_address, view_key);
if (!coreacc)
{
// if creation failed, just close the session
session_close(session, j_response, UNPROCESSABLE_ENTITY,
"Cant create coreacc for " + xmr_address);
return;
}
auto identifier = make_identifier( auto identifier = make_identifier(tx,
tx, make_unique<Output>(&address_info, &viewkey));
make_unique<Output>(coreacc.get()));
identifier.identify(); identifier.identify();
@ -1749,7 +1742,6 @@ OpenMoneroRequests::get_tx(
// a placeholder for exciting or new account data // a placeholder for exciting or new account data
XmrAccount acc; XmrAccount acc;
// select this account if its existing one // select this account if its existing one
if (xmr_accounts->select(xmr_address, acc)) if (xmr_accounts->select(xmr_address, acc))
{ {
@ -1816,7 +1808,7 @@ OpenMoneroRequests::get_tx(
// we have to redo this info from basically from scrach. // we have to redo this info from basically from scrach.
unordered_map<public_key, uint64_t> known_outputs_keys; CurrentBlockchainStatus::known_outputs_t known_outputs_keys;
if (current_bc_status->get_known_outputs_keys( if (current_bc_status->get_known_outputs_keys(
xmr_address, known_outputs_keys)) xmr_address, known_outputs_keys))
@ -1830,7 +1822,7 @@ OpenMoneroRequests::get_tx(
// and inputs in a given tx. // and inputs in a given tx.
auto identifier = make_identifier(tx, auto identifier = make_identifier(tx,
make_unique<Input>(coreacc.get(), make_unique<Input>(&address_info, &viewkey,
&known_outputs_keys, &known_outputs_keys,
&mcore_addapter)); &mcore_addapter));
identifier.identify(); identifier.identify();
@ -2170,8 +2162,7 @@ OpenMoneroRequests::create_account(
// in a moment we will try to get last block timestamp // in a moment we will try to get last block timestamp
// to replace this value. But if it fails, we just use current // to replace this value. But if it fails, we just use current
// timestamp // timestamp
uint64_t current_blockchain_timestamp uint64_t current_blockchain_timestamp = std::time(nullptr);
= std::time(nullptr);
// get last block so we have its timestamp when // get last block so we have its timestamp when
// createing the account // createing the account
@ -2179,14 +2170,14 @@ OpenMoneroRequests::create_account(
if (current_bc_status->get_block(current_blockchain_height, last_blk)) if (current_bc_status->get_block(current_blockchain_height, last_blk))
{ {
if (last_blk.timestamp != 0) current_blockchain_timestamp = last_blk.timestamp;
current_blockchain_timestamp = last_blk.timestamp;
} }
DateTime blk_timestamp_mysql_format DateTime blk_timestamp_mysql_format
= XmrTransaction::timestamp_to_DateTime( = XmrTransaction::timestamp_to_DateTime(
current_blockchain_timestamp); current_blockchain_timestamp);
//@todo setting up start_height and scanned_block_height //@todo setting up start_height and scanned_block_height
//needs to be revisited as they are needed for importing //needs to be revisited as they are needed for importing
//wallets. The simples way is when import is free and this //wallets. The simples way is when import is free and this

@ -396,9 +396,8 @@ for (auto const& tx_tuple: txs_data)
<< " in tx " << tx_hash_str << " in blk " << blk_height << " in tx " << tx_hash_str << " in blk " << blk_height
<< ' ' << outputs_found; << ' ' << outputs_found;
continue; throw TxSearchException("insert output_found: "
//throw TxSearchException("insert output_found: " "no_rows_inserted is zero!");
// "no_rows_inserted is zero!");
} }
} // if (!found_mine_outputs.empty()) } // if (!found_mine_outputs.empty())
@ -587,9 +586,8 @@ for (auto const& tx_tuple: txs_data)
<< " in tx " << tx_hash_str << " in blk " << blk_height << " in tx " << tx_hash_str << " in blk " << blk_height
<< ' ' << inputs_found; << ' ' << inputs_found;
continue; throw TxSearchException(
//throw TxSearchException( "insert inputs_found: no_rows_inserted is zero!");
//"insert inputs_found: no_rows_inserted is zero!");
} }
} // if (!inputs_found.empty()) } // if (!inputs_found.empty())
@ -723,7 +721,7 @@ TxSearch::populate_known_outputs()
hex_to_pod(out.out_pub_key, out_pub_key); hex_to_pod(out.out_pub_key, out_pub_key);
known_outputs_keys[out_pub_key] = out.amount; known_outputs_keys.insert({out_pub_key, out.amount});
} }
} }
} }

@ -30,7 +30,7 @@ class TxSearch
public: public:
// out_pk , amount // out_pk , amount
using known_outputs_t = std::unordered_map<public_key, uint64_t>; using known_outputs_t = std::unordered_multimap<public_key, uint64_t>;
using addr_view_t = std::pair<address_parse_info, secret_key>; using addr_view_t = std::pair<address_parse_info, secret_key>;
using pool_txs_t = std::vector<pair<uint64_t, transaction>>; using pool_txs_t = std::vector<pair<uint64_t, transaction>>;

@ -27,6 +27,8 @@ public:
virtual string table_name() const = 0; virtual string table_name() const = 0;
virtual json to_json() const = 0; virtual json to_json() const = 0;
virtual ~Table() = default;
friend std::ostream& operator<< (std::ostream& stream, const Table& data); friend std::ostream& operator<< (std::ostream& stream, const Table& data);
}; };

@ -7,15 +7,10 @@
#define OMWARN CLOG(WARNING, OPENMONERO_LOG_CATEGORY) #define OMWARN CLOG(WARNING, OPENMONERO_LOG_CATEGORY)
#define OMERROR CLOG(ERROR, OPENMONERO_LOG_CATEGORY) #define OMERROR CLOG(ERROR, OPENMONERO_LOG_CATEGORY)
//#define OMVLOG1 CVLOG(1, OPENMONERO_LOG_CATEGORY) #define OMVLOG1 CVLOG(1, OPENMONERO_LOG_CATEGORY)
//#define OMVLOG2 CVLOG(2, OPENMONERO_LOG_CATEGORY) #define OMVLOG2 CVLOG(2, OPENMONERO_LOG_CATEGORY)
//#define OMVLOG3 CVLOG(3, OPENMONERO_LOG_CATEGORY) #define OMVLOG3 CVLOG(3, OPENMONERO_LOG_CATEGORY)
//#define OMVLOG4 CVLOG(4, OPENMONERO_LOG_CATEGORY) #define OMVLOG4 CVLOG(4, OPENMONERO_LOG_CATEGORY)
#define OMVLOG1 CLOG(INFO, OPENMONERO_LOG_CATEGORY)
#define OMVLOG2 CLOG(INFO, OPENMONERO_LOG_CATEGORY)
#define OMVLOG3 CLOG(INFO, OPENMONERO_LOG_CATEGORY)
#define OMVLOG4 CLOG(INFO, OPENMONERO_LOG_CATEGORY)
#define OMINFO_IF(cond) CLOG_IF(cond, INFO, OPENMONERO_LOG_CATEGORY) #define OMINFO_IF(cond) CLOG_IF(cond, INFO, OPENMONERO_LOG_CATEGORY)
#define OMWARN_IF(cond) CLOG_IF(cond, WARNING, OPENMONERO_LOG_CATEGORY) #define OMWARN_IF(cond) CLOG_IF(cond, WARNING, OPENMONERO_LOG_CATEGORY)

@ -1240,7 +1240,7 @@ blocks_and_txs_from_complete_blocks(
{ {
transaction tx; transaction tx;
if (!parse_and_validate_tx_from_blob(tx_blob.blob, tx)) if (!parse_and_validate_tx_from_blob(tx_blob, tx))
return false; return false;
txs.push_back(tx); txs.push_back(tx);

@ -1 +1 @@
Subproject commit 6e0c9e4b9fa1d2ce1182e61290ff5190608c8b6a Subproject commit 20c9de37cfa5b199bd36e0a2e12fcb01337ef779

@ -925,10 +925,32 @@ TEST_F(MYSQL_TEST, SelectInputsForOutput)
ASSERT_TRUE(xmr_accounts->select_inputs_for_out(output_id, inputs)); ASSERT_TRUE(xmr_accounts->select_inputs_for_out(output_id, inputs));
for (auto&& in: inputs)
{
cout << in << 'n';
}
EXPECT_EQ(inputs.size(), 3); EXPECT_EQ(inputs.size(), 3);
EXPECT_EQ(inputs.front().key_image, "00dd88b3a16b3616d342faec2bc47b24add433407ef79b9a00b55b75d96239a4"); auto it= std::find_if(
EXPECT_EQ(inputs.back().key_image, "abc529357f90641d501d5108f822617049c19461569eafa45cb5400ee45bef33"); inputs.begin(), inputs.end(),
[](auto const& input)
{
return input.key_image
== "00dd88b3a16b3616d342faec2bc47b24add433407ef79b9a00b55b75d96239a4";
});
EXPECT_TRUE(it != inputs.end());
it= std::find_if(
inputs.begin(), inputs.end(),
[](auto const& input)
{
return input.key_image
== "abc529357f90641d501d5108f822617049c19461569eafa45cb5400ee45bef33";
});
EXPECT_TRUE(it != inputs.end());
inputs.clear(); inputs.clear();
@ -1035,7 +1057,9 @@ TEST_F(MYSQL_TEST, InsertSeverlInputsAtOnce)
TEST_F(MYSQL_TEST, TryToInsertSameInputTwice) TEST_F(MYSQL_TEST, TryToInsertSameInputTwice)
{ {
// the input table requires a row to be unique for pair // the input table requires a row to be unique for pair
// of key_image + output_id // of key_image + output_id. UPDATE. This is no longer
// the case as output public keys are not garanteed to
// be unique
ACC_FROM_HEX(owner_addr_5Ajfk); ACC_FROM_HEX(owner_addr_5Ajfk);
@ -1048,10 +1072,10 @@ TEST_F(MYSQL_TEST, TryToInsertSameInputTwice)
EXPECT_GT(inserted_id, 0); EXPECT_GT(inserted_id, 0);
// second insert should fail and result in 0 // second insert should also be fine
inserted_id = xmr_accounts->insert(mock_data); inserted_id = xmr_accounts->insert(mock_data);
EXPECT_EQ(inserted_id, 0); EXPECT_GT(inserted_id, 0);
} }

@ -1,15 +0,0 @@
[Unit]
Description=Wownero Full Node
After=wownero.service
Wants=wownero.service
[Service]
User=openmonero
Group=openmonero
LogsDirectory=openmonero
Type=simple
ExecStart=/usr/local/bin/openmonero --config-file /etc/openmonero.json \
--log-file /var/log/openmonero/openmonero.log
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save