@ -346,6 +346,9 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
if ( nValue > curBalance )
if ( nValue > curBalance )
throw JSONRPCError ( RPC_WALLET_INSUFFICIENT_FUNDS , " Insufficient funds " ) ;
throw JSONRPCError ( RPC_WALLET_INSUFFICIENT_FUNDS , " Insufficient funds " ) ;
if ( pwalletMain - > GetBroadcastTransactions ( ) & & ! g_connman )
throw JSONRPCError ( RPC_CLIENT_P2P_DISABLED , " Error: Peer-to-peer functionality missing or disabled " ) ;
// Parse Bitcoin address
// Parse Bitcoin address
CScript scriptPubKey = GetScriptForDestination ( address ) ;
CScript scriptPubKey = GetScriptForDestination ( address ) ;
@ -362,7 +365,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
strError = strprintf ( " Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds! " , FormatMoney ( nFeeRequired ) ) ;
strError = strprintf ( " Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds! " , FormatMoney ( nFeeRequired ) ) ;
throw JSONRPCError ( RPC_WALLET_ERROR , strError ) ;
throw JSONRPCError ( RPC_WALLET_ERROR , strError ) ;
}
}
if ( ! pwalletMain - > CommitTransaction ( wtxNew , reservekey ) )
if ( ! pwalletMain - > CommitTransaction ( wtxNew , reservekey , g_connman . get ( ) ) )
throw JSONRPCError ( RPC_WALLET_ERROR , " Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of the wallet and coins were spent in the copy but not marked as spent here. " ) ;
throw JSONRPCError ( RPC_WALLET_ERROR , " Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of the wallet and coins were spent in the copy but not marked as spent here. " ) ;
}
}
@ -891,6 +894,9 @@ UniValue sendmany(const UniValue& params, bool fHelp)
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
if ( pwalletMain - > GetBroadcastTransactions ( ) & & ! g_connman )
throw JSONRPCError ( RPC_CLIENT_P2P_DISABLED , " Error: Peer-to-peer functionality missing or disabled " ) ;
string strAccount = AccountFromValue ( params [ 0 ] ) ;
string strAccount = AccountFromValue ( params [ 0 ] ) ;
UniValue sendTo = params [ 1 ] . get_obj ( ) ;
UniValue sendTo = params [ 1 ] . get_obj ( ) ;
int nMinDepth = 1 ;
int nMinDepth = 1 ;
@ -953,7 +959,7 @@ UniValue sendmany(const UniValue& params, bool fHelp)
bool fCreated = pwalletMain - > CreateTransaction ( vecSend , wtx , keyChange , nFeeRequired , nChangePosRet , strFailReason ) ;
bool fCreated = pwalletMain - > CreateTransaction ( vecSend , wtx , keyChange , nFeeRequired , nChangePosRet , strFailReason ) ;
if ( ! fCreated )
if ( ! fCreated )
throw JSONRPCError ( RPC_WALLET_INSUFFICIENT_FUNDS , strFailReason ) ;
throw JSONRPCError ( RPC_WALLET_INSUFFICIENT_FUNDS , strFailReason ) ;
if ( ! pwalletMain - > CommitTransaction ( wtx , keyChange ) )
if ( ! pwalletMain - > CommitTransaction ( wtx , keyChange , g_connman . get ( ) ) )
throw JSONRPCError ( RPC_WALLET_ERROR , " Transaction commit failed " ) ;
throw JSONRPCError ( RPC_WALLET_ERROR , " Transaction commit failed " ) ;
return wtx . GetHash ( ) . GetHex ( ) ;
return wtx . GetHash ( ) . GetHex ( ) ;
@ -2308,9 +2314,12 @@ UniValue resendwallettransactions(const UniValue& params, bool fHelp)
" Returns array of transaction ids that were re-broadcast. \n "
" Returns array of transaction ids that were re-broadcast. \n "
) ;
) ;
if ( ! g_connman )
throw JSONRPCError ( RPC_CLIENT_P2P_DISABLED , " Error: Peer-to-peer functionality missing or disabled " ) ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
std : : vector < uint256 > txids = pwalletMain - > ResendWalletTransactionsBefore ( GetTime ( ) ) ;
std : : vector < uint256 > txids = pwalletMain - > ResendWalletTransactionsBefore ( GetTime ( ) , g_connman . get ( ) ) ;
UniValue result ( UniValue : : VARR ) ;
UniValue result ( UniValue : : VARR ) ;
BOOST_FOREACH ( const uint256 & txid , txids )
BOOST_FOREACH ( const uint256 & txid , txids )
{
{