aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-02 21:48:09 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-11 14:35:27 +0100
commit11dc091464a6cef41434a0bb9f8604f6151c8dc5 (patch)
tree73d1477b6d788dce5ee60502306f6a56cde53045 /src/cryptonote_core/blockchain.cpp
parentnew unlocked parameter to output_histogram (diff)
downloadmonero-11dc091464a6cef41434a0bb9f8604f6151c8dc5.tar.xz
Fake outs set is now decided by the wallet
This plugs a privacy leak from the wallet to the daemon, as the daemon could previously see what input is included as a transaction input, which the daemon hadn't previously supplied. Now, the wallet requests a particular set of outputs, including the real one. This can result in transactions that can't be accepted if the wallet happens to select too many outputs with non standard unlock times. The daemon could know this and select another output, but the wallet is blind to it. It's currently very unlikely since I don't think anything uses non default unlock times. The wallet requests more outputs than necessary so it can use spares if any of the returns outputs are still locked. If there are not enough spares to reach the desired mixin, the transaction will fail.
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 36a233ee7..cc6b48b6b 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1597,6 +1597,25 @@ bool Blockchain::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUT
return true;
}
//------------------------------------------------------------------
+bool Blockchain::get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res) const
+{
+ LOG_PRINT_L3("Blockchain::" << __func__);
+ CRITICAL_REGION_LOCAL(m_blockchain_lock);
+
+ res.outs.clear();
+ res.outs.reserve(req.outputs.size());
+ for (const auto &i: req.outputs)
+ {
+ // get tx_hash, tx_out_index from DB
+ crypto::public_key key = m_db->get_output_key(i.amount, i.index).pubkey;
+ tx_out_index toi = m_db->get_output_tx_and_index(i.amount, i.index);
+ bool unlocked = is_tx_spendtime_unlocked(m_db->get_tx_unlock_time(toi.first));
+
+ res.outs.push_back({key, unlocked});
+ }
+ return true;
+}
+//------------------------------------------------------------------
// This function takes a list of block hashes from another node
// on the network to find where the split point is between us and them.
// This is used to see what to send another node that needs to sync.