@ -4087,17 +4087,17 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
std : : vector < CWalletTx > vWtx ;
if ( gArgs . GetBoolArg ( " -zapwallettxes " , false ) ) {
uiInterface. I nitMessage( _ ( " Zapping all transactions from wallet... " ) ) ;
chain. i nitMessage( _ ( " Zapping all transactions from wallet... " ) ) ;
std : : unique_ptr < CWallet > tempWallet = MakeUnique < CWallet > ( chain , location , WalletDatabase : : Create ( location . GetPath ( ) ) ) ;
DBErrors nZapWalletRet = tempWallet - > ZapWalletTx ( vWtx ) ;
if ( nZapWalletRet ! = DBErrors : : LOAD_OK ) {
I nitError( strprintf ( _ ( " Error loading %s: Wallet corrupted " ) , walletFile ) ) ;
chain. i nitError( strprintf ( _ ( " Error loading %s: Wallet corrupted " ) , walletFile ) ) ;
return nullptr ;
}
}
uiInterface. I nitMessage( _ ( " Loading wallet... " ) ) ;
chain. i nitMessage( _ ( " Loading wallet... " ) ) ;
int64_t nStart = GetTimeMillis ( ) ;
bool fFirstRun = true ;
@ -4108,26 +4108,26 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
if ( nLoadWalletRet ! = DBErrors : : LOAD_OK )
{
if ( nLoadWalletRet = = DBErrors : : CORRUPT ) {
I nitError( strprintf ( _ ( " Error loading %s: Wallet corrupted " ) , walletFile ) ) ;
chain. i nitError( strprintf ( _ ( " Error loading %s: Wallet corrupted " ) , walletFile ) ) ;
return nullptr ;
}
else if ( nLoadWalletRet = = DBErrors : : NONCRITICAL_ERROR )
{
I nitWarning( strprintf ( _ ( " Error reading %s! All keys read correctly, but transaction data "
chain. i nitWarning( strprintf ( _ ( " Error reading %s! All keys read correctly, but transaction data "
" or address book entries might be missing or incorrect. " ) ,
walletFile ) ) ;
}
else if ( nLoadWalletRet = = DBErrors : : TOO_NEW ) {
I nitError( strprintf ( _ ( " Error loading %s: Wallet requires newer version of %s " ) , walletFile , _ ( PACKAGE_NAME ) ) ) ;
chain. i nitError( strprintf ( _ ( " Error loading %s: Wallet requires newer version of %s " ) , walletFile , _ ( PACKAGE_NAME ) ) ) ;
return nullptr ;
}
else if ( nLoadWalletRet = = DBErrors : : NEED_REWRITE )
{
I nitError( strprintf ( _ ( " Wallet needed to be rewritten: restart %s to complete " ) , _ ( PACKAGE_NAME ) ) ) ;
chain. i nitError( strprintf ( _ ( " Wallet needed to be rewritten: restart %s to complete " ) , _ ( PACKAGE_NAME ) ) ) ;
return nullptr ;
}
else {
I nitError( strprintf ( _ ( " Error loading %s " ) , walletFile ) ) ;
chain. i nitError( strprintf ( _ ( " Error loading %s " ) , walletFile ) ) ;
return nullptr ;
}
}
@ -4146,7 +4146,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
walletInstance - > WalletLogPrintf ( " Allowing wallet upgrade up to %i \n " , nMaxVersion ) ;
if ( nMaxVersion < walletInstance - > GetVersion ( ) )
{
I nitError( _ ( " Cannot downgrade wallet " ) ) ;
chain. i nitError( _ ( " Cannot downgrade wallet " ) ) ;
return nullptr ;
}
walletInstance - > SetMaxVersion ( nMaxVersion ) ;
@ -4159,7 +4159,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
// Do not upgrade versions to any version between HD_SPLIT and FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT
int max_version = walletInstance - > nWalletVersion ;
if ( ! walletInstance - > CanSupportFeature ( FEATURE_HD_SPLIT ) & & max_version > = FEATURE_HD_SPLIT & & max_version < FEATURE_PRE_SPLIT_KEYPOOL ) {
I nitError( _ ( " Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified. " ) ) ;
chain. i nitError( _ ( " Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified. " ) ) ;
return nullptr ;
}
@ -4187,7 +4187,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
// Regenerate the keypool if upgraded to HD
if ( hd_upgrade ) {
if ( ! walletInstance - > TopUpKeyPool ( ) ) {
I nitError( _ ( " Unable to generate keys " ) ) ;
chain. i nitError( _ ( " Unable to generate keys " ) ) ;
return nullptr ;
}
}
@ -4211,7 +4211,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
// Top up the keypool
if ( walletInstance - > CanGenerateKeys ( ) & & ! walletInstance - > TopUpKeyPool ( ) ) {
I nitError( _ ( " Unable to generate initial keys " ) ) ;
chain. i nitError( _ ( " Unable to generate initial keys " ) ) ;
return nullptr ;
}
@ -4219,33 +4219,33 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
walletInstance - > ChainStateFlushed ( locked_chain - > getTipLocator ( ) ) ;
} else if ( wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS ) {
// Make it impossible to disable private keys after creation
I nitError( strprintf ( _ ( " Error loading %s: Private keys can only be disabled during creation " ) , walletFile ) ) ;
chain. i nitError( strprintf ( _ ( " Error loading %s: Private keys can only be disabled during creation " ) , walletFile ) ) ;
return NULL ;
} else if ( walletInstance - > IsWalletFlagSet ( WALLET_FLAG_DISABLE_PRIVATE_KEYS ) ) {
LOCK ( walletInstance - > cs_KeyStore ) ;
if ( ! walletInstance - > mapKeys . empty ( ) | | ! walletInstance - > mapCryptedKeys . empty ( ) ) {
I nitWarning( strprintf ( _ ( " Warning: Private keys detected in wallet {%s} with disabled private keys " ) , walletFile ) ) ;
chain. i nitWarning( strprintf ( _ ( " Warning: Private keys detected in wallet {%s} with disabled private keys " ) , walletFile ) ) ;
}
}
if ( ! gArgs . GetArg ( " -addresstype " , " " ) . empty ( ) & & ! ParseOutputType ( gArgs . GetArg ( " -addresstype " , " " ) , walletInstance - > m_default_address_type ) ) {
I nitError( strprintf ( " Unknown address type '%s' " , gArgs . GetArg ( " -addresstype " , " " ) ) ) ;
chain. i nitError( strprintf ( " Unknown address type '%s' " , gArgs . GetArg ( " -addresstype " , " " ) ) ) ;
return nullptr ;
}
if ( ! gArgs . GetArg ( " -changetype " , " " ) . empty ( ) & & ! ParseOutputType ( gArgs . GetArg ( " -changetype " , " " ) , walletInstance - > m_default_change_type ) ) {
I nitError( strprintf ( " Unknown change type '%s' " , gArgs . GetArg ( " -changetype " , " " ) ) ) ;
chain. i nitError( strprintf ( " Unknown change type '%s' " , gArgs . GetArg ( " -changetype " , " " ) ) ) ;
return nullptr ;
}
if ( gArgs . IsArgSet ( " -mintxfee " ) ) {
CAmount n = 0 ;
if ( ! ParseMoney ( gArgs . GetArg ( " -mintxfee " , " " ) , n ) | | 0 = = n ) {
I nitError( AmountErrMsg ( " mintxfee " , gArgs . GetArg ( " -mintxfee " , " " ) ) ) ;
chain. i nitError( AmountErrMsg ( " mintxfee " , gArgs . GetArg ( " -mintxfee " , " " ) ) ) ;
return nullptr ;
}
if ( n > HIGH_TX_FEE_PER_KB ) {
I nitWarning( AmountHighWarn ( " -mintxfee " ) + " " +
chain. i nitWarning( AmountHighWarn ( " -mintxfee " ) + " " +
_ ( " This is the minimum transaction fee you pay on every transaction. " ) ) ;
}
walletInstance - > m_min_fee = CFeeRate ( n ) ;
@ -4255,11 +4255,11 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
if ( gArgs . IsArgSet ( " -fallbackfee " ) ) {
CAmount nFeePerK = 0 ;
if ( ! ParseMoney ( gArgs . GetArg ( " -fallbackfee " , " " ) , nFeePerK ) ) {
I nitError( strprintf ( _ ( " Invalid amount for -fallbackfee=<amount>: '%s' " ) , gArgs . GetArg ( " -fallbackfee " , " " ) ) ) ;
chain. i nitError( strprintf ( _ ( " Invalid amount for -fallbackfee=<amount>: '%s' " ) , gArgs . GetArg ( " -fallbackfee " , " " ) ) ) ;
return nullptr ;
}
if ( nFeePerK > HIGH_TX_FEE_PER_KB ) {
I nitWarning( AmountHighWarn ( " -fallbackfee " ) + " " +
chain. i nitWarning( AmountHighWarn ( " -fallbackfee " ) + " " +
_ ( " This is the transaction fee you may pay when fee estimates are not available. " ) ) ;
}
walletInstance - > m_fallback_fee = CFeeRate ( nFeePerK ) ;
@ -4268,11 +4268,11 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
if ( gArgs . IsArgSet ( " -discardfee " ) ) {
CAmount nFeePerK = 0 ;
if ( ! ParseMoney ( gArgs . GetArg ( " -discardfee " , " " ) , nFeePerK ) ) {
I nitError( strprintf ( _ ( " Invalid amount for -discardfee=<amount>: '%s' " ) , gArgs . GetArg ( " -discardfee " , " " ) ) ) ;
chain. i nitError( strprintf ( _ ( " Invalid amount for -discardfee=<amount>: '%s' " ) , gArgs . GetArg ( " -discardfee " , " " ) ) ) ;
return nullptr ;
}
if ( nFeePerK > HIGH_TX_FEE_PER_KB ) {
I nitWarning( AmountHighWarn ( " -discardfee " ) + " " +
chain. i nitWarning( AmountHighWarn ( " -discardfee " ) + " " +
_ ( " This is the transaction fee you may discard if change is smaller than dust at this level " ) ) ;
}
walletInstance - > m_discard_rate = CFeeRate ( nFeePerK ) ;
@ -4280,16 +4280,16 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
if ( gArgs . IsArgSet ( " -paytxfee " ) ) {
CAmount nFeePerK = 0 ;
if ( ! ParseMoney ( gArgs . GetArg ( " -paytxfee " , " " ) , nFeePerK ) ) {
I nitError( AmountErrMsg ( " paytxfee " , gArgs . GetArg ( " -paytxfee " , " " ) ) ) ;
chain. i nitError( AmountErrMsg ( " paytxfee " , gArgs . GetArg ( " -paytxfee " , " " ) ) ) ;
return nullptr ;
}
if ( nFeePerK > HIGH_TX_FEE_PER_KB ) {
I nitWarning( AmountHighWarn ( " -paytxfee " ) + " " +
chain. i nitWarning( AmountHighWarn ( " -paytxfee " ) + " " +
_ ( " This is the transaction fee you will pay if you send a transaction. " ) ) ;
}
walletInstance - > m_pay_tx_fee = CFeeRate ( nFeePerK , 1000 ) ;
if ( walletInstance - > m_pay_tx_fee < : : minRelayTxFee ) {
I nitError( strprintf ( _ ( " Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s) " ) ,
chain. i nitError( strprintf ( _ ( " Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s) " ) ,
gArgs . GetArg ( " -paytxfee " , " " ) , : : minRelayTxFee . ToString ( ) ) ) ;
return nullptr ;
}
@ -4338,12 +4338,12 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
}
if ( rescan_height ! = block_height ) {
I nitError( _ ( " Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node) " ) ) ;
chain. i nitError( _ ( " Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node) " ) ) ;
return nullptr ;
}
}
uiInterface. I nitMessage( _ ( " Rescanning... " ) ) ;
chain. i nitMessage( _ ( " Rescanning... " ) ) ;
walletInstance - > WalletLogPrintf ( " Rescanning last %i blocks (from block %i)... \n " , * tip_height - rescan_height , rescan_height ) ;
// 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,
{
WalletRescanReserver reserver ( walletInstance . get ( ) ) ;
if ( ! reserver . reserve ( ) | | ( ScanResult : : SUCCESS ! = walletInstance - > ScanForWalletTransactions ( locked_chain - > getBlockHash ( rescan_height ) , { } /* stop block */ , reserver , true /* update */ ) . status ) ) {
I nitError( _ ( " Failed to rescan the wallet during initialization " ) ) ;
chain. i nitError( _ ( " Failed to rescan the wallet during initialization " ) ) ;
return nullptr ;
}
}