@@ -334,8 +334,7 @@ Value sendtoaddress(const Array& params, bool fHelp)
334
334
if (params.size () > 3 && params[3 ].type () != null_type && !params[3 ].get_str ().empty ())
335
335
wtx.mapValue [" to" ] = params[3 ].get_str ();
336
336
337
- if (pwalletMain->IsLocked ())
338
- throw JSONRPCError (RPC_WALLET_UNLOCK_NEEDED, " Error: Please enter the wallet passphrase with walletpassphrase first." );
337
+ EnsureWalletIsUnlocked ();
339
338
340
339
string strError = pwalletMain->SendMoneyToDestination (address.Get (), nAmount, wtx);
341
340
if (strError != " " )
@@ -1657,15 +1656,15 @@ Value keypoolrefill(const Array& params, bool fHelp)
1657
1656
+ HelpExampleRpc (" keypoolrefill" , " " )
1658
1657
);
1659
1658
1660
- unsigned int kpSize = max (GetArg (" -keypool" , 100 ), (int64_t ) 0 );
1659
+ // 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
1660
+ unsigned int kpSize = 0 ;
1661
1661
if (params.size () > 0 ) {
1662
1662
if (params[0 ].get_int () < 0 )
1663
- throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid parameter, expected valid size" );
1664
- kpSize = (unsigned int ) params[0 ].get_int ();
1663
+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid parameter, expected valid size. " );
1664
+ kpSize = (unsigned int )params[0 ].get_int ();
1665
1665
}
1666
1666
1667
1667
EnsureWalletIsUnlocked ();
1668
-
1669
1668
pwalletMain->TopUpKeyPool (kpSize);
1670
1669
1671
1670
if (pwalletMain->GetKeyPoolSize () < kpSize)
0 commit comments