@@ -36,15 +36,9 @@ static void WalletCreate(CWallet* wallet_instance)
36
36
wallet_instance->TopUpKeyPool ();
37
37
}
38
38
39
- static std::shared_ptr<CWallet> MakeWallet (const std::string& name, const fs::path& path, bool create )
39
+ static std::shared_ptr<CWallet> MakeWallet (const std::string& name, const fs::path& path, DatabaseOptions options )
40
40
{
41
- DatabaseOptions options;
42
41
DatabaseStatus status;
43
- if (create) {
44
- options.require_create = true ;
45
- } else {
46
- options.require_existing = true ;
47
- }
48
42
bilingual_str error;
49
43
std::unique_ptr<WalletDatabase> database = MakeDatabase (path, options, status, error);
50
44
if (!database) {
@@ -85,7 +79,7 @@ static std::shared_ptr<CWallet> MakeWallet(const std::string& name, const fs::pa
85
79
}
86
80
}
87
81
88
- if (create ) WalletCreate (wallet_instance.get ());
82
+ if (options. require_create ) WalletCreate (wallet_instance.get ());
89
83
90
84
return wallet_instance;
91
85
}
@@ -110,14 +104,18 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
110
104
fs::path path = fs::absolute (name, GetWalletDir ());
111
105
112
106
if (command == " create" ) {
113
- std::shared_ptr<CWallet> wallet_instance = MakeWallet (name, path, /* create= */ true );
107
+ DatabaseOptions options;
108
+ options.require_create = true ;
109
+ std::shared_ptr<CWallet> wallet_instance = MakeWallet (name, path, options);
114
110
if (wallet_instance) {
115
111
WalletShowInfo (wallet_instance.get ());
116
112
wallet_instance->Close ();
117
113
}
118
114
} else if (command == " info" || command == " salvage" ) {
119
115
if (command == " info" ) {
120
- std::shared_ptr<CWallet> wallet_instance = MakeWallet (name, path, /* create= */ false );
116
+ DatabaseOptions options;
117
+ options.require_existing = true ;
118
+ std::shared_ptr<CWallet> wallet_instance = MakeWallet (name, path, options);
121
119
if (!wallet_instance) return false ;
122
120
WalletShowInfo (wallet_instance.get ());
123
121
wallet_instance->Close ();
0 commit comments