forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: 0.25 batch 393 #6782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PastaPastaPasta
merged 8 commits into
dashpay:develop
from
DashCoreAutoGuix:backport-0.25-batch-393
Jul 31, 2025
Merged
backport: 0.25 batch 393 #6782
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1e3d0fe
Merge bitcoin/bitcoin#23897: refactor: Move calculation logic out fro…
DashCoreAutoGuix 3f8f85d
Merge bitcoin/bitcoin#27221: test: Default timeout factor to 4 under …
DashCoreAutoGuix 4a8c861
Merge bitcoin/bitcoin#25666: refactor: wallet, do not translate init …
fanquake f1c060d
Merge bitcoin/bitcoin#27902: fuzz: wallet, add target for `CoinControl`
PastaPastaPasta 587294f
Merge bitcoin/bitcoin#24851: init: ignore BIP-30 verification in Disc…
PastaPastaPasta 2d27f12
Merge bitcoin/bitcoin#26321: Adjust `.tx/config` for new Transifex CLI
DashCoreAutoGuix 9ccf843
Merge bitcoin/bitcoin#26259: test: Test year 2106 block timestamps
DashCoreAutoGuix a8c09bc
Merge bitcoin/bitcoin#25491: wallet: use Mutex for g_sqlite_mutex ins…
DashCoreAutoGuix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // Copyright (c) 2022 The Bitcoin Core developers | ||
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| #include <test/fuzz/FuzzedDataProvider.h> | ||
| #include <test/fuzz/fuzz.h> | ||
| #include <test/fuzz/util.h> | ||
| #include <test/util/setup_common.h> | ||
| #include <wallet/coincontrol.h> | ||
| #include <wallet/test/util.h> | ||
|
|
||
| namespace wallet { | ||
| namespace { | ||
|
|
||
| const TestingSetup* g_setup; | ||
|
|
||
| void initialize_coincontrol() | ||
| { | ||
| static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(); | ||
| g_setup = testing_setup.get(); | ||
| } | ||
|
|
||
| FUZZ_TARGET(coincontrol, .init = initialize_coincontrol) | ||
| { | ||
| FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); | ||
| const auto& node = g_setup->m_node; | ||
| ArgsManager& args = *node.args; | ||
|
|
||
| // for GetBoolArg to return true sometimes | ||
| args.ForceSetArg("-avoidpartialspends", fuzzed_data_provider.ConsumeBool()?"1":"0"); | ||
|
|
||
| CCoinControl coin_control; | ||
| COutPoint out_point; | ||
|
|
||
| LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) | ||
| { | ||
| CallOneOf( | ||
| fuzzed_data_provider, | ||
| [&] { | ||
| std::optional<COutPoint> optional_out_point = ConsumeDeserializable<COutPoint>(fuzzed_data_provider); | ||
| if (!optional_out_point) { | ||
| return; | ||
| } | ||
| out_point = *optional_out_point; | ||
| }, | ||
| [&] { | ||
| (void)coin_control.HasSelected(); | ||
| }, | ||
| [&] { | ||
| (void)coin_control.IsSelected(out_point); | ||
| }, | ||
| [&] { | ||
| (void)coin_control.IsExternalSelected(out_point); | ||
| }, | ||
| [&] { | ||
| CTxOut txout; | ||
| (void)coin_control.GetExternalOutput(out_point, txout); | ||
| }, | ||
| [&] { | ||
| (void)coin_control.Select(out_point); | ||
| }, | ||
| [&] { | ||
| const CTxOut tx_out{ConsumeMoney(fuzzed_data_provider), ConsumeScript(fuzzed_data_provider)}; | ||
| (void)coin_control.SelectExternal(out_point, tx_out); | ||
| }, | ||
| [&] { | ||
| (void)coin_control.UnSelect(out_point); | ||
| }, | ||
| [&] { | ||
| (void)coin_control.UnSelectAll(); | ||
| }, | ||
| [&] { | ||
| std::vector<COutPoint> selected; | ||
| coin_control.ListSelected(selected); | ||
| }, | ||
| [&] { | ||
| int64_t weight{fuzzed_data_provider.ConsumeIntegral<int64_t>()}; | ||
| (void)coin_control.SetInputWeight(out_point, weight); | ||
| }, | ||
| [&] { | ||
| // Condition to avoid the assertion in GetInputWeight | ||
| if (coin_control.HasInputWeight(out_point)) { | ||
| (void)coin_control.GetInputWeight(out_point); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| } // namespace | ||
| } // namespace wallet | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
27902: should skip this line IMO and next one, because it's segwit related. I will prepare fix to remove GetInputWeight and HasInputWeight from coin_control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? What harm does keeping it do? it seems it just keeps our code closer to upstream w/o downside
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we use everywhere a size of transaction instead of "weight".
Having leftover helpers with
HasInputWeightandGetInpuptWeightcan cause an error in future, if some new (especially backported) code will use it. If these helpers won't exist, freshly backported code will get compilation error -> a developer got a signal to replace "weight" to "size". Otherwise it maybe a silent bug