@@ -115,13 +115,25 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command)
115
115
tfm::format (std::cerr, " The -dumpfile option can only be used with the \" dump\" and \" createfromdump\" commands.\n " );
116
116
return false ;
117
117
}
118
- if (args.IsArgSet (" -descriptors" ) && command != " create" ) {
119
- tfm::format (std::cerr, " The -descriptors option can only be used with the 'create' command.\n " );
120
- return false ;
118
+ if (args.IsArgSet (" -descriptors" )) {
119
+ if (command != " create" ) {
120
+ tfm::format (std::cerr, " The -descriptors option can only be used with the 'create' command.\n " );
121
+ return false ;
122
+ }
123
+ if (!args.GetBoolArg (" -descriptors" , true )) {
124
+ tfm::format (std::cerr, " The -descriptors option must be set to \" true\"\n " );
125
+ return false ;
126
+ }
121
127
}
122
- if (args.IsArgSet (" -legacy" ) && command != " create" ) {
123
- tfm::format (std::cerr, " The -legacy option can only be used with the 'create' command.\n " );
124
- return false ;
128
+ if (args.IsArgSet (" -legacy" )) {
129
+ if (command != " create" ) {
130
+ tfm::format (std::cerr, " The -legacy option can only be used with the 'create' command.\n " );
131
+ return false ;
132
+ }
133
+ if (args.GetBoolArg (" -legacy" , true )) {
134
+ tfm::format (std::cerr, " The -legacy option must be set to \" false\" " );
135
+ return false ;
136
+ }
125
137
}
126
138
if (command == " create" && !args.IsArgSet (" -wallet" )) {
127
139
tfm::format (std::cerr, " Wallet name must be provided when creating a new wallet.\n " );
@@ -134,22 +146,8 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command)
134
146
DatabaseOptions options;
135
147
ReadDatabaseArgs (args, options);
136
148
options.require_create = true ;
137
- // If -legacy is set, use it. Otherwise default to false.
138
- bool make_legacy = args.GetBoolArg (" -legacy" , false );
139
- // If neither -legacy nor -descriptors is set, default to true. If -descriptors is set, use its value.
140
- bool make_descriptors = (!args.IsArgSet (" -descriptors" ) && !args.IsArgSet (" -legacy" )) || (args.IsArgSet (" -descriptors" ) && args.GetBoolArg (" -descriptors" , true ));
141
- if (make_legacy && make_descriptors) {
142
- tfm::format (std::cerr, " Only one of -legacy or -descriptors can be set to true, not both\n " );
143
- return false ;
144
- }
145
- if (!make_legacy && !make_descriptors) {
146
- tfm::format (std::cerr, " One of -legacy or -descriptors must be set to true (or omitted)\n " );
147
- return false ;
148
- }
149
- if (make_descriptors) {
150
- options.create_flags |= WALLET_FLAG_DESCRIPTORS;
151
- options.require_format = DatabaseFormat::SQLITE;
152
- }
149
+ options.create_flags |= WALLET_FLAG_DESCRIPTORS;
150
+ options.require_format = DatabaseFormat::SQLITE;
153
151
154
152
const std::shared_ptr<CWallet> wallet_instance = MakeWallet (name, path, options);
155
153
if (wallet_instance) {
0 commit comments