@@ -4087,17 +4087,17 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4087
4087
std::vector<CWalletTx> vWtx;
4088
4088
4089
4089
if (gArgs .GetBoolArg (" -zapwallettxes" , false )) {
4090
- uiInterface. InitMessage (_ (" Zapping all transactions from wallet..." ));
4090
+ chain. initMessage (_ (" Zapping all transactions from wallet..." ));
4091
4091
4092
4092
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(chain, location, WalletDatabase::Create (location.GetPath ()));
4093
4093
DBErrors nZapWalletRet = tempWallet->ZapWalletTx (vWtx);
4094
4094
if (nZapWalletRet != DBErrors::LOAD_OK) {
4095
- InitError (strprintf (_ (" Error loading %s: Wallet corrupted" ), walletFile));
4095
+ chain. initError (strprintf (_ (" Error loading %s: Wallet corrupted" ), walletFile));
4096
4096
return nullptr ;
4097
4097
}
4098
4098
}
4099
4099
4100
- uiInterface. InitMessage (_ (" Loading wallet..." ));
4100
+ chain. initMessage (_ (" Loading wallet..." ));
4101
4101
4102
4102
int64_t nStart = GetTimeMillis ();
4103
4103
bool fFirstRun = true ;
@@ -4108,26 +4108,26 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4108
4108
if (nLoadWalletRet != DBErrors::LOAD_OK)
4109
4109
{
4110
4110
if (nLoadWalletRet == DBErrors::CORRUPT) {
4111
- InitError (strprintf (_ (" Error loading %s: Wallet corrupted" ), walletFile));
4111
+ chain. initError (strprintf (_ (" Error loading %s: Wallet corrupted" ), walletFile));
4112
4112
return nullptr ;
4113
4113
}
4114
4114
else if (nLoadWalletRet == DBErrors::NONCRITICAL_ERROR)
4115
4115
{
4116
- InitWarning (strprintf (_ (" Error reading %s! All keys read correctly, but transaction data"
4117
- " or address book entries might be missing or incorrect." ),
4116
+ chain. initWarning (strprintf (_ (" Error reading %s! All keys read correctly, but transaction data"
4117
+ " or address book entries might be missing or incorrect." ),
4118
4118
walletFile));
4119
4119
}
4120
4120
else if (nLoadWalletRet == DBErrors::TOO_NEW) {
4121
- InitError (strprintf (_ (" Error loading %s: Wallet requires newer version of %s" ), walletFile, _ (PACKAGE_NAME)));
4121
+ chain. initError (strprintf (_ (" Error loading %s: Wallet requires newer version of %s" ), walletFile, _ (PACKAGE_NAME)));
4122
4122
return nullptr ;
4123
4123
}
4124
4124
else if (nLoadWalletRet == DBErrors::NEED_REWRITE)
4125
4125
{
4126
- InitError (strprintf (_ (" Wallet needed to be rewritten: restart %s to complete" ), _ (PACKAGE_NAME)));
4126
+ chain. initError (strprintf (_ (" Wallet needed to be rewritten: restart %s to complete" ), _ (PACKAGE_NAME)));
4127
4127
return nullptr ;
4128
4128
}
4129
4129
else {
4130
- InitError (strprintf (_ (" Error loading %s" ), walletFile));
4130
+ chain. initError (strprintf (_ (" Error loading %s" ), walletFile));
4131
4131
return nullptr ;
4132
4132
}
4133
4133
}
@@ -4146,7 +4146,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4146
4146
walletInstance->WalletLogPrintf (" Allowing wallet upgrade up to %i\n " , nMaxVersion);
4147
4147
if (nMaxVersion < walletInstance->GetVersion ())
4148
4148
{
4149
- InitError (_ (" Cannot downgrade wallet" ));
4149
+ chain. initError (_ (" Cannot downgrade wallet" ));
4150
4150
return nullptr ;
4151
4151
}
4152
4152
walletInstance->SetMaxVersion (nMaxVersion);
@@ -4159,7 +4159,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4159
4159
// Do not upgrade versions to any version between HD_SPLIT and FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT
4160
4160
int max_version = walletInstance->nWalletVersion ;
4161
4161
if (!walletInstance->CanSupportFeature (FEATURE_HD_SPLIT) && max_version >=FEATURE_HD_SPLIT && max_version < FEATURE_PRE_SPLIT_KEYPOOL) {
4162
- InitError (_ (" Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified." ));
4162
+ chain. initError (_ (" Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified." ));
4163
4163
return nullptr ;
4164
4164
}
4165
4165
@@ -4187,7 +4187,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4187
4187
// Regenerate the keypool if upgraded to HD
4188
4188
if (hd_upgrade) {
4189
4189
if (!walletInstance->TopUpKeyPool ()) {
4190
- InitError (_ (" Unable to generate keys" ));
4190
+ chain. initError (_ (" Unable to generate keys" ));
4191
4191
return nullptr ;
4192
4192
}
4193
4193
}
@@ -4211,42 +4211,42 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4211
4211
4212
4212
// Top up the keypool
4213
4213
if (walletInstance->CanGenerateKeys () && !walletInstance->TopUpKeyPool ()) {
4214
- InitError (_ (" Unable to generate initial keys" ));
4214
+ chain. initError (_ (" Unable to generate initial keys" ));
4215
4215
return nullptr ;
4216
4216
}
4217
4217
4218
4218
auto locked_chain = chain.assumeLocked (); // Temporary. Removed in upcoming lock cleanup
4219
4219
walletInstance->ChainStateFlushed (locked_chain->getTipLocator ());
4220
4220
} else if (wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS) {
4221
4221
// Make it impossible to disable private keys after creation
4222
- InitError (strprintf (_ (" Error loading %s: Private keys can only be disabled during creation" ), walletFile));
4222
+ chain. initError (strprintf (_ (" Error loading %s: Private keys can only be disabled during creation" ), walletFile));
4223
4223
return NULL ;
4224
4224
} else if (walletInstance->IsWalletFlagSet (WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
4225
4225
LOCK (walletInstance->cs_KeyStore );
4226
4226
if (!walletInstance->mapKeys .empty () || !walletInstance->mapCryptedKeys .empty ()) {
4227
- InitWarning (strprintf (_ (" Warning: Private keys detected in wallet {%s} with disabled private keys" ), walletFile));
4227
+ chain. initWarning (strprintf (_ (" Warning: Private keys detected in wallet {%s} with disabled private keys" ), walletFile));
4228
4228
}
4229
4229
}
4230
4230
4231
4231
if (!gArgs .GetArg (" -addresstype" , " " ).empty () && !ParseOutputType (gArgs .GetArg (" -addresstype" , " " ), walletInstance->m_default_address_type )) {
4232
- InitError (strprintf (" Unknown address type '%s'" , gArgs .GetArg (" -addresstype" , " " )));
4232
+ chain. initError (strprintf (" Unknown address type '%s'" , gArgs .GetArg (" -addresstype" , " " )));
4233
4233
return nullptr ;
4234
4234
}
4235
4235
4236
4236
if (!gArgs .GetArg (" -changetype" , " " ).empty () && !ParseOutputType (gArgs .GetArg (" -changetype" , " " ), walletInstance->m_default_change_type )) {
4237
- InitError (strprintf (" Unknown change type '%s'" , gArgs .GetArg (" -changetype" , " " )));
4237
+ chain. initError (strprintf (" Unknown change type '%s'" , gArgs .GetArg (" -changetype" , " " )));
4238
4238
return nullptr ;
4239
4239
}
4240
4240
4241
4241
if (gArgs .IsArgSet (" -mintxfee" )) {
4242
4242
CAmount n = 0 ;
4243
4243
if (!ParseMoney (gArgs .GetArg (" -mintxfee" , " " ), n) || 0 == n) {
4244
- InitError (AmountErrMsg (" mintxfee" , gArgs .GetArg (" -mintxfee" , " " )));
4244
+ chain. initError (AmountErrMsg (" mintxfee" , gArgs .GetArg (" -mintxfee" , " " )));
4245
4245
return nullptr ;
4246
4246
}
4247
4247
if (n > HIGH_TX_FEE_PER_KB) {
4248
- InitWarning (AmountHighWarn (" -mintxfee" ) + " " +
4249
- _ (" This is the minimum transaction fee you pay on every transaction." ));
4248
+ chain. initWarning (AmountHighWarn (" -mintxfee" ) + " " +
4249
+ _ (" This is the minimum transaction fee you pay on every transaction." ));
4250
4250
}
4251
4251
walletInstance->m_min_fee = CFeeRate (n);
4252
4252
}
@@ -4255,41 +4255,41 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4255
4255
if (gArgs .IsArgSet (" -fallbackfee" )) {
4256
4256
CAmount nFeePerK = 0 ;
4257
4257
if (!ParseMoney (gArgs .GetArg (" -fallbackfee" , " " ), nFeePerK)) {
4258
- InitError (strprintf (_ (" Invalid amount for -fallbackfee=<amount>: '%s'" ), gArgs .GetArg (" -fallbackfee" , " " )));
4258
+ chain. initError (strprintf (_ (" Invalid amount for -fallbackfee=<amount>: '%s'" ), gArgs .GetArg (" -fallbackfee" , " " )));
4259
4259
return nullptr ;
4260
4260
}
4261
4261
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
4262
- InitWarning (AmountHighWarn (" -fallbackfee" ) + " " +
4263
- _ (" This is the transaction fee you may pay when fee estimates are not available." ));
4262
+ chain. initWarning (AmountHighWarn (" -fallbackfee" ) + " " +
4263
+ _ (" This is the transaction fee you may pay when fee estimates are not available." ));
4264
4264
}
4265
4265
walletInstance->m_fallback_fee = CFeeRate (nFeePerK);
4266
4266
walletInstance->m_allow_fallback_fee = nFeePerK != 0 ; // disable fallback fee in case value was set to 0, enable if non-null value
4267
4267
}
4268
4268
if (gArgs .IsArgSet (" -discardfee" )) {
4269
4269
CAmount nFeePerK = 0 ;
4270
4270
if (!ParseMoney (gArgs .GetArg (" -discardfee" , " " ), nFeePerK)) {
4271
- InitError (strprintf (_ (" Invalid amount for -discardfee=<amount>: '%s'" ), gArgs .GetArg (" -discardfee" , " " )));
4271
+ chain. initError (strprintf (_ (" Invalid amount for -discardfee=<amount>: '%s'" ), gArgs .GetArg (" -discardfee" , " " )));
4272
4272
return nullptr ;
4273
4273
}
4274
4274
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
4275
- InitWarning (AmountHighWarn (" -discardfee" ) + " " +
4276
- _ (" This is the transaction fee you may discard if change is smaller than dust at this level" ));
4275
+ chain. initWarning (AmountHighWarn (" -discardfee" ) + " " +
4276
+ _ (" This is the transaction fee you may discard if change is smaller than dust at this level" ));
4277
4277
}
4278
4278
walletInstance->m_discard_rate = CFeeRate (nFeePerK);
4279
4279
}
4280
4280
if (gArgs .IsArgSet (" -paytxfee" )) {
4281
4281
CAmount nFeePerK = 0 ;
4282
4282
if (!ParseMoney (gArgs .GetArg (" -paytxfee" , " " ), nFeePerK)) {
4283
- InitError (AmountErrMsg (" paytxfee" , gArgs .GetArg (" -paytxfee" , " " )));
4283
+ chain. initError (AmountErrMsg (" paytxfee" , gArgs .GetArg (" -paytxfee" , " " )));
4284
4284
return nullptr ;
4285
4285
}
4286
4286
if (nFeePerK > HIGH_TX_FEE_PER_KB) {
4287
- InitWarning (AmountHighWarn (" -paytxfee" ) + " " +
4288
- _ (" This is the transaction fee you will pay if you send a transaction." ));
4287
+ chain. initWarning (AmountHighWarn (" -paytxfee" ) + " " +
4288
+ _ (" This is the transaction fee you will pay if you send a transaction." ));
4289
4289
}
4290
4290
walletInstance->m_pay_tx_fee = CFeeRate (nFeePerK, 1000 );
4291
4291
if (walletInstance->m_pay_tx_fee < ::minRelayTxFee) {
4292
- InitError (strprintf (_ (" Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)" ),
4292
+ chain. initError (strprintf (_ (" Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)" ),
4293
4293
gArgs .GetArg (" -paytxfee" , " " ), ::minRelayTxFee.ToString ()));
4294
4294
return nullptr ;
4295
4295
}
@@ -4338,12 +4338,12 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4338
4338
}
4339
4339
4340
4340
if (rescan_height != block_height) {
4341
- InitError (_ (" Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)" ));
4341
+ chain. initError (_ (" Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)" ));
4342
4342
return nullptr ;
4343
4343
}
4344
4344
}
4345
4345
4346
- uiInterface. InitMessage (_ (" Rescanning..." ));
4346
+ chain. initMessage (_ (" Rescanning..." ));
4347
4347
walletInstance->WalletLogPrintf (" Rescanning last %i blocks (from block %i)...\n " , *tip_height - rescan_height, rescan_height);
4348
4348
4349
4349
// No need to read and scan block if block was created before
@@ -4358,7 +4358,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
4358
4358
{
4359
4359
WalletRescanReserver reserver (walletInstance.get ());
4360
4360
if (!reserver.reserve () || (ScanResult::SUCCESS != walletInstance->ScanForWalletTransactions (locked_chain->getBlockHash (rescan_height), {} /* stop block */ , reserver, true /* update */ ).status )) {
4361
- InitError (_ (" Failed to rescan the wallet during initialization" ));
4361
+ chain. initError (_ (" Failed to rescan the wallet during initialization" ));
4362
4362
return nullptr ;
4363
4363
}
4364
4364
}
0 commit comments