From 89a7fbee54cd6cfe60cb7536c6732a07c806b96a Mon Sep 17 00:00:00 2001 From: Anthony Fieroni Date: Fri, 22 Oct 2021 16:25:49 +0300 Subject: [PATCH] Don't show untrusted txs in account history (#711) Signed-off-by: Anthony Fieroni --- src/masternodes/rpc_accounts.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/masternodes/rpc_accounts.cpp b/src/masternodes/rpc_accounts.cpp index 262b1456a64..ffddce3b976 100644 --- a/src/masternodes/rpc_accounts.cpp +++ b/src/masternodes/rpc_accounts.cpp @@ -134,7 +134,8 @@ static void searchInWallet(CWallet const * pwallet, std::list listSent; std::list listReceived; - LOCK(pwallet->cs_wallet); + auto locked_chain = pwallet->chain().lock(); + LOCK2(pwallet->cs_wallet, locked_chain->mutex()); const auto& txOrdered = pwallet->mapWallet.get(); @@ -150,6 +151,10 @@ static void searchInWallet(CWallet const * pwallet, continue; } + if (!pwtx->IsTrusted(*locked_chain)) { + continue; + } + pwtx->GetAmounts(listReceived, listSent, nFee, filter); for (auto& sent : listSent) {