mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
Change brace formatting
Suggested https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-197915100
This commit is contained in:
parent
a1df1b48a8
commit
f7efd87c8f
3 changed files with 23 additions and 13 deletions
|
@ -157,8 +157,9 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||||
if (!request.params[2].isNull())
|
if (!request.params[2].isNull())
|
||||||
fRescan = request.params[2].get_bool();
|
fRescan = request.params[2].get_bool();
|
||||||
|
|
||||||
if (fRescan && pwallet->chain().getPruneMode())
|
if (fRescan && pwallet->chain().getPruneMode()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
}
|
||||||
|
|
||||||
if (fRescan && !reserver.reserve()) {
|
if (fRescan && !reserver.reserve()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
|
||||||
|
@ -313,8 +314,9 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||||
if (!request.params[2].isNull())
|
if (!request.params[2].isNull())
|
||||||
fRescan = request.params[2].get_bool();
|
fRescan = request.params[2].get_bool();
|
||||||
|
|
||||||
if (fRescan && pwallet->chain().getPruneMode())
|
if (fRescan && pwallet->chain().getPruneMode()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
}
|
||||||
|
|
||||||
WalletRescanReserver reserver(pwallet);
|
WalletRescanReserver reserver(pwallet);
|
||||||
if (fRescan && !reserver.reserve()) {
|
if (fRescan && !reserver.reserve()) {
|
||||||
|
@ -501,8 +503,9 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
||||||
if (!request.params[2].isNull())
|
if (!request.params[2].isNull())
|
||||||
fRescan = request.params[2].get_bool();
|
fRescan = request.params[2].get_bool();
|
||||||
|
|
||||||
if (fRescan && pwallet->chain().getPruneMode())
|
if (fRescan && pwallet->chain().getPruneMode()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
|
||||||
|
}
|
||||||
|
|
||||||
WalletRescanReserver reserver(pwallet);
|
WalletRescanReserver reserver(pwallet);
|
||||||
if (fRescan && !reserver.reserve()) {
|
if (fRescan && !reserver.reserve()) {
|
||||||
|
@ -562,8 +565,9 @@ UniValue importwallet(const JSONRPCRequest& request)
|
||||||
},
|
},
|
||||||
}.ToString());
|
}.ToString());
|
||||||
|
|
||||||
if (pwallet->chain().getPruneMode())
|
if (pwallet->chain().getPruneMode()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
|
||||||
|
}
|
||||||
|
|
||||||
WalletRescanReserver reserver(pwallet);
|
WalletRescanReserver reserver(pwallet);
|
||||||
if (!reserver.reserve()) {
|
if (!reserver.reserve()) {
|
||||||
|
|
|
@ -628,8 +628,9 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
|
||||||
CAmount nAmount = 0;
|
CAmount nAmount = 0;
|
||||||
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
||||||
const CWalletTx& wtx = pairWtx.second;
|
const CWalletTx& wtx = pairWtx.second;
|
||||||
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx))
|
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const CTxOut& txout : wtx.tx->vout)
|
for (const CTxOut& txout : wtx.tx->vout)
|
||||||
if (txout.scriptPubKey == scriptPubKey)
|
if (txout.scriptPubKey == scriptPubKey)
|
||||||
|
@ -693,8 +694,9 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
|
||||||
CAmount nAmount = 0;
|
CAmount nAmount = 0;
|
||||||
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
||||||
const CWalletTx& wtx = pairWtx.second;
|
const CWalletTx& wtx = pairWtx.second;
|
||||||
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx))
|
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (const CTxOut& txout : wtx.tx->vout)
|
for (const CTxOut& txout : wtx.tx->vout)
|
||||||
{
|
{
|
||||||
|
@ -1078,8 +1080,9 @@ static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * co
|
||||||
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
|
||||||
const CWalletTx& wtx = pairWtx.second;
|
const CWalletTx& wtx = pairWtx.second;
|
||||||
|
|
||||||
if (wtx.IsCoinBase() || !locked_chain.checkFinalTx(*wtx.tx))
|
if (wtx.IsCoinBase() || !locked_chain.checkFinalTx(*wtx.tx)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int nDepth = wtx.GetDepthInMainChain(locked_chain);
|
int nDepth = wtx.GetDepthInMainChain(locked_chain);
|
||||||
if (nDepth < nMinDepth)
|
if (nDepth < nMinDepth)
|
||||||
|
@ -2690,8 +2693,9 @@ static UniValue resendwallettransactions(const JSONRPCRequest& request)
|
||||||
}.ToString()
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!pwallet->chain().p2pEnabled())
|
if (!pwallet->chain().p2pEnabled()) {
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
}
|
||||||
|
|
||||||
auto locked_chain = pwallet->chain().lock();
|
auto locked_chain = pwallet->chain().lock();
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
|
|
|
@ -2073,8 +2073,9 @@ bool CWalletTx::InMempool() const
|
||||||
bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
|
bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
|
||||||
{
|
{
|
||||||
// Quick answer in most cases
|
// Quick answer in most cases
|
||||||
if (!locked_chain.checkFinalTx(*tx))
|
if (!locked_chain.checkFinalTx(*tx)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
int nDepth = GetDepthInMainChain(locked_chain);
|
int nDepth = GetDepthInMainChain(locked_chain);
|
||||||
if (nDepth >= 1)
|
if (nDepth >= 1)
|
||||||
return true;
|
return true;
|
||||||
|
@ -2129,9 +2130,10 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(interfaces::Chain::
|
||||||
for (const std::pair<const unsigned int, CWalletTx*>& item : mapSorted)
|
for (const std::pair<const unsigned int, CWalletTx*>& item : mapSorted)
|
||||||
{
|
{
|
||||||
CWalletTx& wtx = *item.second;
|
CWalletTx& wtx = *item.second;
|
||||||
if (wtx.RelayWalletTransaction(locked_chain))
|
if (wtx.RelayWalletTransaction(locked_chain)) {
|
||||||
result.push_back(wtx.GetHash());
|
result.push_back(wtx.GetHash());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2319,8 +2321,9 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
|
||||||
const uint256& wtxid = entry.first;
|
const uint256& wtxid = entry.first;
|
||||||
const CWalletTx* pcoin = &entry.second;
|
const CWalletTx* pcoin = &entry.second;
|
||||||
|
|
||||||
if (!locked_chain.checkFinalTx(*pcoin->tx))
|
if (!locked_chain.checkFinalTx(*pcoin->tx)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (pcoin->IsImmatureCoinBase(locked_chain))
|
if (pcoin->IsImmatureCoinBase(locked_chain))
|
||||||
continue;
|
continue;
|
||||||
|
@ -4331,8 +4334,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
||||||
//We can't rescan beyond non-pruned blocks, stop and throw an error
|
//We can't rescan beyond non-pruned blocks, stop and throw an error
|
||||||
//this might happen if a user uses an old wallet within a pruned node
|
//this might happen if a user uses an old wallet within a pruned node
|
||||||
// or if he ran -disablewallet for a longer time, then decided to re-enable
|
// or if he ran -disablewallet for a longer time, then decided to re-enable
|
||||||
if (chain.getPruneMode())
|
if (chain.getPruneMode()) {
|
||||||
{
|
|
||||||
int block_height = *tip_height;
|
int block_height = *tip_height;
|
||||||
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {
|
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {
|
||||||
--block_height;
|
--block_height;
|
||||||
|
|
Loading…
Add table
Reference in a new issue