aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp4
-rw-r--r--src/wallet/CMakeLists.txt7
-rw-r--r--src/wallet/wallet2.cpp11
4 files changed, 23 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 70bb215d0..5a79325ef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -82,8 +82,13 @@ function (bitmonero_add_library name)
FILES
${ARGN})
- add_library("${name}"
- ${ARGN})
+ # Define a ("virtual") object library and an actual library that links those
+ # objects together. The virtual libraries can be arbitrarily combined to link
+ # any subset of objects into one library archive. This is used for releasing
+ # libwallet, which combines multiple components.
+ set(objlib obj_${name})
+ add_library(${objlib} OBJECT ${ARGN})
+ add_library("${name}" STATIC $<TARGET_OBJECTS:${objlib}>)
set_property(TARGET "${name}"
PROPERTY
FOLDER "libs")
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index a0a0a041d..c0cf28dda 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -877,10 +877,12 @@ void BlockchainLMDB::remove_tx_outputs(const uint64_t tx_id, const transaction&
throw0(DB_ERROR("tx has outputs, but no output indices found"));
}
+ bool is_miner_tx = tx.vin.size() == 1 && tx.vin[0].type() == typeid(txin_gen);
for (uint64_t i = tx.vout.size(); i > 0; --i)
{
const tx_out tx_output = tx.vout[i-1];
- remove_output(tx_output.amount, amount_output_indices[i-1]);
+ uint64_t amount = is_miner_tx && tx.version >= 2 ? 0 : tx_output.amount;
+ remove_output(amount, amount_output_indices[i-1]);
}
}
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
index c4585f9ee..48e4b0a23 100644
--- a/src/wallet/CMakeLists.txt
+++ b/src/wallet/CMakeLists.txt
@@ -27,7 +27,6 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# include (${PROJECT_SOURCE_DIR}/cmake/libutils.cmake)
-include (${PROJECT_SOURCE_DIR}/cmake/MergeStaticLibs.cmake)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -76,7 +75,11 @@ target_link_libraries(wallet
${EXTRA_LIBRARIES})
set(libs_to_merge wallet cryptonote_core mnemonics common crypto)
-merge_static_libs(wallet_merged "${libs_to_merge}")
+
+foreach(lib ${libs_to_merge})
+ list(APPEND objlibs $<TARGET_OBJECTS:obj_${lib}>) # matches naming convention in src/CMakeLists.txtA
+endforeach()
+add_library(wallet_merged STATIC ${objlibs})
install(TARGETS wallet_merged
ARCHIVE DESTINATION lib)
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 99866dbeb..d889720af 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2682,8 +2682,8 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr
THROW_WALLET_EXCEPTION_IF(resp_t.result.status != CORE_RPC_STATUS_OK, error::get_histogram_error, resp_t.result.status);
// we ask for more, to have spares if some outputs are still locked
- size_t requested_outputs_count = (size_t)((fake_outputs_count + 1) * 1.5 + 1);
- LOG_PRINT_L2("requested_outputs_count: " << requested_outputs_count);
+ size_t base_requested_outputs_count = (size_t)((fake_outputs_count + 1) * 1.5 + 1);
+ LOG_PRINT_L2("base_requested_outputs_count: " << base_requested_outputs_count);
// generate output indices to request
COMMAND_RPC_GET_OUTPUTS::request req = AUTO_VAL_INIT(req);
@@ -2693,6 +2693,8 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr
{
const uint64_t amount = it->is_rct() ? 0 : it->amount();
std::unordered_set<uint64_t> seen_indices;
+ // request more for rct in base recent (locked) coinbases are picked, since they're locked for longer
+ size_t requested_outputs_count = base_requested_outputs_count + (it->is_rct() ? CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0);
size_t start = req.outputs.size();
// if there are just enough outputs to mix with, use all of them.
@@ -2777,6 +2779,7 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr
outs.reserve(selected_transfers.size());
for(transfer_container::iterator it: selected_transfers)
{
+ size_t requested_outputs_count = base_requested_outputs_count + (it->is_rct() ? CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0);
outs.push_back(std::vector<entry>());
outs.back().reserve(fake_outputs_count + 1);
const rct::key mask = it->is_rct() ? rct::commit(it->amount(), it->m_mask) : rct::zeroCommit(it->amount());
@@ -2792,9 +2795,11 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr
order[n] = n;
std::shuffle(order.begin(), order.end(), std::default_random_engine(crypto::rand<unsigned>()));
+ LOG_PRINT_L2("Looking for " << (fake_outputs_count+1) << " outputs of size " << print_money(it->is_rct() ? 0 : it->amount()));
for (size_t o = 0; o < requested_outputs_count && outs.back().size() < fake_outputs_count + 1; ++o)
{
size_t i = base + order[o];
+ LOG_PRINT_L2("Index " << i << "/" << requested_outputs_count << ": idx " << req.outputs[i].index << " (real " << it->m_global_output_index << "), unlocked " << daemon_resp.outs[i].unlocked << ", key " << daemon_resp.outs[i].key);
if (req.outputs[i].index == it->m_global_output_index) // don't re-add real one
continue;
if (!daemon_resp.outs[i].unlocked) // don't add locked outs
@@ -2805,7 +2810,7 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr
}
if (outs.back().size() < fake_outputs_count + 1)
{
- scanty_outs[it->amount()] = outs.back().size();
+ scanty_outs[it->is_rct() ? 0 : it->amount()] = outs.back().size();
}
else
{