From b5d3a04ff077a29b648c514e51674e95d9e1e301 Mon Sep 17 00:00:00 2001 From: jc Date: Wed, 28 Feb 2018 21:13:55 -0500 Subject: [PATCH] lock when selecting anchor --- src/wallet/asyncrpcoperation_shieldcoinbase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 8c8de21e6f2..20d659cc226 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -279,7 +279,12 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj) UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInfo & info) { - uint256 anchor = pcoinsTip->GetBestAnchor(); + uint256 anchor; + { + LOCK(cs_main); + anchor = pcoinsTip->GetBestAnchor(); + } + if (anchor.IsNull()) { throw std::runtime_error("anchor is null"); }