mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
refactor: remove unused locks for ResubmitWalletTransactions
ReacceptWalletTransactions is replaced by ResubmitWalletTransactions which already handles acquiring the necessary locks internally.
This commit is contained in:
parent
c6e8e11fb0
commit
01f3534632
2 changed files with 5 additions and 19 deletions
|
@ -293,10 +293,7 @@ RPCHelpMan importaddress()
|
||||||
if (fRescan)
|
if (fRescan)
|
||||||
{
|
{
|
||||||
RescanWallet(*pwallet, reserver);
|
RescanWallet(*pwallet, reserver);
|
||||||
{
|
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
||||||
LOCK(pwallet->cs_wallet);
|
|
||||||
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UniValue::VNULL;
|
return UniValue::VNULL;
|
||||||
|
@ -474,10 +471,7 @@ RPCHelpMan importpubkey()
|
||||||
if (fRescan)
|
if (fRescan)
|
||||||
{
|
{
|
||||||
RescanWallet(*pwallet, reserver);
|
RescanWallet(*pwallet, reserver);
|
||||||
{
|
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
||||||
LOCK(pwallet->cs_wallet);
|
|
||||||
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UniValue::VNULL;
|
return UniValue::VNULL;
|
||||||
|
@ -1406,10 +1400,7 @@ RPCHelpMan importmulti()
|
||||||
}
|
}
|
||||||
if (fRescan && fRunScan && requests.size()) {
|
if (fRescan && fRunScan && requests.size()) {
|
||||||
int64_t scannedTime = pwallet->RescanFromTime(nLowestTimestamp, reserver, true /* update */);
|
int64_t scannedTime = pwallet->RescanFromTime(nLowestTimestamp, reserver, true /* update */);
|
||||||
{
|
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
||||||
LOCK(pwallet->cs_wallet);
|
|
||||||
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pwallet->IsAbortingRescan()) {
|
if (pwallet->IsAbortingRescan()) {
|
||||||
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
@ -1700,10 +1691,7 @@ RPCHelpMan importdescriptors()
|
||||||
// Rescan the blockchain using the lowest timestamp
|
// Rescan the blockchain using the lowest timestamp
|
||||||
if (rescan) {
|
if (rescan) {
|
||||||
int64_t scanned_time = pwallet->RescanFromTime(lowest_timestamp, reserver, true /* update */);
|
int64_t scanned_time = pwallet->RescanFromTime(lowest_timestamp, reserver, true /* update */);
|
||||||
{
|
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
||||||
LOCK(pwallet->cs_wallet);
|
|
||||||
pwallet->ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pwallet->IsAbortingRescan()) {
|
if (pwallet->IsAbortingRescan()) {
|
||||||
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
|
|
@ -3196,14 +3196,12 @@ bool CWallet::UpgradeWallet(int version, bilingual_str& error)
|
||||||
|
|
||||||
void CWallet::postInitProcess()
|
void CWallet::postInitProcess()
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
|
||||||
|
|
||||||
// Add wallet transactions that aren't already in a block to mempool
|
// Add wallet transactions that aren't already in a block to mempool
|
||||||
// Do this here as mempool requires genesis block to be loaded
|
// Do this here as mempool requires genesis block to be loaded
|
||||||
ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
ResubmitWalletTransactions(/*relay=*/false, /*force=*/true);
|
||||||
|
|
||||||
// Update wallet transactions with current mempool transactions.
|
// Update wallet transactions with current mempool transactions.
|
||||||
chain().requestMempoolTransactions(*this);
|
WITH_LOCK(cs_wallet, chain().requestMempoolTransactions(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::BackupWallet(const std::string& strDest) const
|
bool CWallet::BackupWallet(const std::string& strDest) const
|
||||||
|
|
Loading…
Add table
Reference in a new issue