Update which lock to synchronize on when calling GetBestAnchor().
This commit is contained in:
parent
6e4ce0dfa2
commit
b85008e786
|
@ -878,7 +878,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info
|
||||||
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
std::vector<boost::optional < ZCIncrementalWitness>> witnesses;
|
||||||
uint256 anchor;
|
uint256 anchor;
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
LOCK(cs_main);
|
||||||
anchor = pcoinsTip->GetBestAnchor(); // As there are no inputs, ask the wallet for the best anchor
|
anchor = pcoinsTip->GetBestAnchor(); // As there are no inputs, ask the wallet for the best anchor
|
||||||
}
|
}
|
||||||
return perform_joinsplit(info, witnesses, anchor);
|
return perform_joinsplit(info, witnesses, anchor);
|
||||||
|
|
|
@ -279,7 +279,12 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj)
|
||||||
|
|
||||||
|
|
||||||
UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInfo & info) {
|
UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInfo & info) {
|
||||||
uint256 anchor = pcoinsTip->GetBestAnchor();
|
uint256 anchor;
|
||||||
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
|
anchor = pcoinsTip->GetBestAnchor();
|
||||||
|
}
|
||||||
|
|
||||||
if (anchor.IsNull()) {
|
if (anchor.IsNull()) {
|
||||||
throw std::runtime_error("anchor is null");
|
throw std::runtime_error("anchor is null");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue