Skip to content

Commit b6b50b0

Browse files
committed
scripted-diff: Uppercase function names
Change `CoinsResult` functions to uppercase to be consistent with the style guide. -BEGIN VERIFY SCRIPT- git grep -l "available_coins" | grep -v mempool_stress.cpp | xargs sed -i "s/available_coins\.\(size\|all\|clear\)/available_coins\.\u\1/" git grep -l AvailableCoins | xargs sed -i "/AvailableCoins/ s/\(all()\|size()\|clear()\)/\u\1/" sed -i "s/\(clear()\|all()\|size()\)/\u&/g" src/wallet/spend.h sed -i "/CoinsResult::/ s/\(clear()\|all()\|size()\)/\u&/" src/wallet/spend.cpp sed -i "s/result.size/result.Size/" src/wallet/spend.cpp sed -i "s/this->size/this->Size/" src/wallet/spend.cpp -END VERIFY SCRIPT-
1 parent 3f27a2a commit b6b50b0

File tree

7 files changed

+72
-72
lines changed

7 files changed

+72
-72
lines changed

src/wallet/rpc/coins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ RPCHelpMan listunspent()
638638
cctl.m_max_depth = nMaxDepth;
639639
cctl.m_include_unsafe_inputs = include_unsafe;
640640
LOCK(pwallet->cs_wallet);
641-
vecOutputs = AvailableCoinsListUnspent(*pwallet, &cctl, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount).all();
641+
vecOutputs = AvailableCoinsListUnspent(*pwallet, &cctl, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount).All();
642642
}
643643

644644
LOCK(pwallet->cs_wallet);

src/wallet/rpc/spend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ RPCHelpMan sendall()
13821382
total_input_value += tx->tx->vout[input.prevout.n].nValue;
13831383
}
13841384
} else {
1385-
for (const COutput& output : AvailableCoins(*pwallet, &coin_control, fee_rate, /*nMinimumAmount=*/0).all()) {
1385+
for (const COutput& output : AvailableCoins(*pwallet, &coin_control, fee_rate, /*nMinimumAmount=*/0).All()) {
13861386
CHECK_NONFATAL(output.input_bytes > 0);
13871387
if (send_max && fee_rate.GetFee(output.input_bytes) > output.txout.nValue) {
13881388
continue;

src/wallet/spend.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *walle
7979
return CalculateMaximumSignedTxSize(tx, wallet, txouts, coin_control);
8080
}
8181

82-
uint64_t CoinsResult::size() const
82+
uint64_t CoinsResult::Size() const
8383
{
8484
return bech32m.size() + bech32.size() + P2SH_segwit.size() + legacy.size() + other.size();
8585
}
8686

87-
std::vector<COutput> CoinsResult::all() const
87+
std::vector<COutput> CoinsResult::All() const
8888
{
8989
std::vector<COutput> all;
90-
all.reserve(this->size());
90+
all.reserve(this->Size());
9191
all.insert(all.end(), bech32m.begin(), bech32m.end());
9292
all.insert(all.end(), bech32.begin(), bech32.end());
9393
all.insert(all.end(), P2SH_segwit.begin(), P2SH_segwit.end());
@@ -96,7 +96,7 @@ std::vector<COutput> CoinsResult::all() const
9696
return all;
9797
}
9898

99-
void CoinsResult::clear()
99+
void CoinsResult::Clear()
100100
{
101101
bech32m.clear();
102102
bech32.clear();
@@ -319,7 +319,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
319319
}
320320

321321
// Checks the maximum number of UTXO's.
322-
if (nMaximumCount > 0 && result.size() >= nMaximumCount) {
322+
if (nMaximumCount > 0 && result.Size() >= nMaximumCount) {
323323
return result;
324324
}
325325
}
@@ -375,7 +375,7 @@ std::map<CTxDestination, std::vector<COutput>> ListCoins(const CWallet& wallet)
375375

376376
std::map<CTxDestination, std::vector<COutput>> result;
377377

378-
for (const COutput& coin : AvailableCoinsListUnspent(wallet).all()) {
378+
for (const COutput& coin : AvailableCoinsListUnspent(wallet).All()) {
379379
CTxDestination address;
380380
if ((coin.spendable || (wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) && coin.solvable)) &&
381381
ExtractDestination(FindNonChangeParentOutput(wallet, coin.outpoint).scriptPubKey, address)) {
@@ -515,7 +515,7 @@ std::optional<SelectionResult> AttemptSelection(const CWallet& wallet, const CAm
515515
// over all available coins, else pick the best solution from the results
516516
if (results.size() == 0) {
517517
if (allow_mixed_output_types) {
518-
if (auto result{ChooseSelectionResult(wallet, nTargetValue, eligibility_filter, available_coins.all(), coin_selection_params)}) {
518+
if (auto result{ChooseSelectionResult(wallet, nTargetValue, eligibility_filter, available_coins.All(), coin_selection_params)}) {
519519
return result;
520520
}
521521
}
@@ -649,7 +649,7 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& a
649649

650650
// form groups from remaining coins; note that preset coins will not
651651
// automatically have their associated (same address) coins included
652-
if (coin_control.m_avoid_partial_spends && available_coins.size() > OUTPUT_GROUP_MAX_ENTRIES) {
652+
if (coin_control.m_avoid_partial_spends && available_coins.Size() > OUTPUT_GROUP_MAX_ENTRIES) {
653653
// Cases where we have 101+ outputs all pointing to the same destination may result in
654654
// privacy leaks as they will potentially be deterministically sorted. We solve that by
655655
// explicitly shuffling the outputs before processing

src/wallet/spend.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction& tx, const CWallet* walle
3434
* This struct is really just a wrapper around OutputType vectors with a convenient
3535
* method for concatenating and returning all COutputs as one vector.
3636
*
37-
* clear(), size() methods are implemented so that one can interact with
37+
* Clear(), Size() methods are implemented so that one can interact with
3838
* the CoinsResult struct as if it was a vector
3939
*/
4040
struct CoinsResult {
@@ -49,12 +49,12 @@ struct CoinsResult {
4949
std::vector<COutput> other;
5050

5151
/** Concatenate and return all COutputs as one vector */
52-
std::vector<COutput> all() const;
52+
std::vector<COutput> All() const;
5353

5454
/** The following methods are provided so that CoinsResult can mimic a vector,
5555
* i.e., methods can work with individual OutputType vectors or on the entire object */
56-
uint64_t size() const;
57-
void clear();
56+
uint64_t Size() const;
57+
void Clear();
5858
void Erase(std::set<COutPoint>& preset_coins);
5959
void Shuffle(FastRandomContext& rng_fast);
6060
void Add(OutputType type, const COutput& out);

src/wallet/test/availablecoins_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ BOOST_FIXTURE_TEST_CASE(BasicOutputTypesTest, AvailableCoinsTestingSetup)
6363
// Verify our wallet has one usable coinbase UTXO before starting
6464
// This UTXO is a P2PK, so it should show up in the Other bucket
6565
available_coins = AvailableCoins(*wallet);
66-
BOOST_CHECK_EQUAL(available_coins.size(), 1U);
66+
BOOST_CHECK_EQUAL(available_coins.Size(), 1U);
6767
BOOST_CHECK_EQUAL(available_coins.other.size(), 1U);
6868

6969
// We will create a self transfer for each of the OutputTypes and

0 commit comments

Comments
 (0)