mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Add extra lock check for OSX build
Apparently my upstream checkpoint was in the middle of a series of commits by ianofsky separating wallet from the main code. This means that I have to add this main lock which will be replaced by the locked_chain interface in a subsequence catchup.
This commit is contained in:
parent
872d39fbe8
commit
ad3d496d78
2 changed files with 7 additions and 5 deletions
|
|
@ -5493,6 +5493,7 @@ UniValue claimpegin(const JSONRPCRequest& request)
|
|||
|
||||
// To check if it's not double spending an existing pegin UTXO, we check mempool acceptance.
|
||||
CValidationState acceptState;
|
||||
LockAnnotation lock(::cs_main); //TODO(stevenroose) replace with locked_chain later
|
||||
bool accepted = ::AcceptToMemoryPool(mempool, acceptState, MakeTransactionRef(mtx), nullptr /* pfMissingInputs */,
|
||||
nullptr /* plTxnReplaced */, false /* bypass_limits */, maxTxFee, true /* test_accept */);
|
||||
if (!accepted) {
|
||||
|
|
|
|||
|
|
@ -2510,6 +2510,7 @@ bool CWallet::SelectCoinsMinConf(const CAmountMap& mapTargetValue, const CoinEli
|
|||
|
||||
bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAmountMap& mapTargetValue, std::set<CInputCoin>& setCoinsRet, CAmountMap& mapValueRet, const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const
|
||||
{
|
||||
AssertLockHeld(cs_wallet); // mapWallet
|
||||
std::vector<COutput> vCoins(vAvailableCoins);
|
||||
|
||||
// coin control -> return all selected outputs (we want all selected to go into the transaction for sure)
|
||||
|
|
@ -2684,6 +2685,11 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
|
|||
coinControl.Select(txin.prevout);
|
||||
}
|
||||
|
||||
// Acquire the locks to prevent races to the new locked unspents between the
|
||||
// CreateTransaction call and LockCoin calls (when lockUnspents is true).
|
||||
auto locked_chain = chain().lock();
|
||||
LOCK(cs_wallet);
|
||||
|
||||
// Also account for the assets in the preset inputs.
|
||||
std::vector<COutPoint> vPresetInputs;
|
||||
coinControl.ListSelected(vPresetInputs);
|
||||
|
|
@ -2700,11 +2706,6 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
|
|||
vChangeKey.push_back(std::unique_ptr<CReserveKey>(new CReserveKey(this)));
|
||||
}
|
||||
|
||||
// Acquire the locks to prevent races to the new locked unspents between the
|
||||
// CreateTransaction call and LockCoin calls (when lockUnspents is true).
|
||||
auto locked_chain = chain().lock();
|
||||
LOCK(cs_wallet);
|
||||
|
||||
CTransactionRef tx_new;
|
||||
BlindDetails* blind_details = g_con_elementsmode ? new BlindDetails() : NULL;
|
||||
if (!CreateTransaction(*locked_chain, vecSend, tx_new, vChangeKey, nFeeRet, nChangePosInOut, strFailReason, coinControl, false, blind_details)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue