-
Couldn't load subscription status.
- 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
backport: 0.25 batch 393 #6782
Changes from 4 commits
1e3d0fe
3f8f85d
4a8c861
f1c060d
587294f
2d27f12
9ccf843
a8c09bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -778,7 +778,7 @@ static std::optional<CreatedTransactionResult> CreateTransactionInternal( | |
| } | ||
| if (feeCalc.reason == FeeReason::FALLBACK && !wallet.m_allow_fallback_fee) { | ||
| // eventually allow a fallback fee | ||
| error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee."); | ||
| error = strprintf(_("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable %s."), "-fallbackfee"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 25666 - consider follow-up to apply it for dash's strings; I found several of them: and one extra with forgotten dashification! |
||
| return std::nullopt; | ||
| } | ||
|
|
||
|
|
||
| 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 |
||
| }, | ||
| [&] { | ||
| // Condition to avoid the assertion in GetInputWeight | ||
| if (coin_control.HasInputWeight(out_point)) { | ||
| (void)coin_control.GetInputWeight(out_point); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| } // namespace | ||
| } // namespace wallet | ||
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.
Replace Assert with proper error handling
Using
Assert()at line 266 could cause a crash in production ifGetAncestor()returns nullptr. While the comment suggests this shouldn't happen, defensive programming practices recommend proper error handling.🤖 Prompt for AI Agents