diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-01-22 11:42:15 -0500 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-01-22 11:42:15 -0500 |
commit | ee45b7a6dbdef6f8c1216443d3e9787992c24f97 (patch) | |
tree | 5d83569f914e2b6cac8109724d9ade8a2d664091 | |
parent | Merge pull request #1604 (diff) | |
parent | core: early out in handle_incoming_tx if already in pool or blockchain (diff) | |
download | monero-ee45b7a6dbdef6f8c1216443d3e9787992c24f97.tar.xz |
Merge pull request #1605
7c3f79cb core: early out in handle_incoming_tx if already in pool or blockchain (moneromooo-monero)
6cc7d261 ringct: reorder a bit to check quicker tests first (moneromooo-monero)
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 12 | ||||
-rw-r--r-- | src/ringct/rctSigs.cpp | 34 |
2 files changed, 29 insertions, 17 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 5294431d6..5be25a410 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -496,6 +496,18 @@ namespace cryptonote return false; } + if(m_mempool.have_tx(tx_hash)) + { + LOG_PRINT_L2("tx " << tx_hash << "already have transaction in tx_pool"); + return true; + } + + if(m_blockchain_storage.have_tx(tx_hash)) + { + LOG_PRINT_L2("tx " << tx_hash << " already have transaction in blockchain"); + return true; + } + if(!check_tx_syntax(tx)) { LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " syntax, rejected"); diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 74fed0ede..b8f3596e8 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -797,23 +797,6 @@ namespace rct { tools::thread_group threadpool(tools::thread_group::optimal_with_max(threads)); if (semantics) { - results.clear(); - results.resize(rv.outPk.size()); - tools::task_region(threadpool, [&] (tools::task_region_handle& region) { - for (size_t i = 0; i < rv.outPk.size(); i++) { - region.run([&, i] { - results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); - }); - } - }); - - for (size_t i = 0; i < results.size(); ++i) { - if (!results[i]) { - LOG_PRINT_L1("Range proof verified failed for output " << i); - return false; - } - } - key sumOutpks = identity(); for (size_t i = 0; i < rv.outPk.size(); i++) { addKeys(sumOutpks, sumOutpks, rv.outPk[i].mask); @@ -833,6 +816,23 @@ namespace rct { LOG_PRINT_L1("Sum check failed"); return false; } + + results.clear(); + results.resize(rv.outPk.size()); + tools::task_region(threadpool, [&] (tools::task_region_handle& region) { + for (size_t i = 0; i < rv.outPk.size(); i++) { + region.run([&, i] { + results[i] = verRange(rv.outPk[i].mask, rv.p.rangeSigs[i]); + }); + } + }); + + for (size_t i = 0; i < results.size(); ++i) { + if (!results[i]) { + LOG_PRINT_L1("Range proof verified failed for output " << i); + return false; + } + } } else { const key message = get_pre_mlsag_hash(rv); |