diff --git a/sql/openmonero.sql b/sql/openmonero.sql index 2b33695..7d15c3e 100755 --- a/sql/openmonero.sql +++ b/sql/openmonero.sql @@ -91,7 +91,7 @@ CREATE TABLE IF NOT EXISTS `Outputs` ( `mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0', `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 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 `account_id` (`account_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/openmonero_test.sql b/sql/openmonero_test.sql index 2329724..fe2cc5d 100755 --- a/sql/openmonero_test.sql +++ b/sql/openmonero_test.sql @@ -190,7 +190,7 @@ CREATE TABLE IF NOT EXISTS `Outputs` ( `mixin` bigint(20) UNSIGNED NOT NULL DEFAULT '0', `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 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 `account_id` (`account_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=140460833003782 DEFAULT CHARSET=utf8; diff --git a/src/CurrentBlockchainStatus.cpp b/src/CurrentBlockchainStatus.cpp index f3d2d3f..97b5ed0 100755 --- a/src/CurrentBlockchainStatus.cpp +++ b/src/CurrentBlockchainStatus.cpp @@ -872,7 +872,7 @@ CurrentBlockchainStatus::get_searched_blk_no(const string& address, bool CurrentBlockchainStatus::get_known_outputs_keys( string const& address, - unordered_map& known_outputs_keys) + known_outputs_t& known_outputs_keys) { std::lock_guard lck (searching_threads_map_mtx); diff --git a/src/CurrentBlockchainStatus.h b/src/CurrentBlockchainStatus.h index 8bc8279..008f309 100755 --- a/src/CurrentBlockchainStatus.h +++ b/src/CurrentBlockchainStatus.h @@ -50,6 +50,8 @@ public: // recieved_time, tx using mempool_txs_t = vector>; + //output_pubk, amount + using known_outputs_t = unordered_multimap; // height , timestamp, is_coinbase using txs_tuple_t @@ -259,8 +261,7 @@ public: virtual bool get_known_outputs_keys(string const& address, - unordered_map& known_outputs_keys); + known_outputs_t& known_outputs_keys); virtual void clean_search_thread_map(); diff --git a/src/OpenMoneroRequests.cpp b/src/OpenMoneroRequests.cpp index 3d99e95..65e1bcf 100755 --- a/src/OpenMoneroRequests.cpp +++ b/src/OpenMoneroRequests.cpp @@ -1452,6 +1452,9 @@ OpenMoneroRequests::import_recent_wallet_request( XmrAccount updated_acc = acc; + //cout << updated_acc.scanned_block_height + //<< ',' << no_blocks_to_import << '\n'; + // make sure scanned_block_height is larger than // no_blocks_to_import so we dont // end up with overflowing uint64_t. @@ -1805,7 +1808,7 @@ OpenMoneroRequests::get_tx( // we have to redo this info from basically from scrach. - unordered_map known_outputs_keys; + CurrentBlockchainStatus::known_outputs_t known_outputs_keys; if (current_bc_status->get_known_outputs_keys( xmr_address, known_outputs_keys)) diff --git a/src/TxSearch.cpp b/src/TxSearch.cpp index 96a730a..bbb4d8d 100755 --- a/src/TxSearch.cpp +++ b/src/TxSearch.cpp @@ -721,7 +721,7 @@ TxSearch::populate_known_outputs() 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}); } } } diff --git a/src/TxSearch.h b/src/TxSearch.h index 257fae0..9b8449e 100755 --- a/src/TxSearch.h +++ b/src/TxSearch.h @@ -30,7 +30,7 @@ class TxSearch public: // out_pk , amount - using known_outputs_t = std::unordered_map; + using known_outputs_t = std::unordered_multimap; using addr_view_t = std::pair; using pool_txs_t = std::vector>; diff --git a/src/xmregcore b/src/xmregcore index 4356c98..b1ac513 160000 --- a/src/xmregcore +++ b/src/xmregcore @@ -1 +1 @@ -Subproject commit 4356c9892b9903da4410f773ea36a6e4c799be5a +Subproject commit b1ac5139d49f190069912d2771be17011f67926e