mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
SendFrom: Remove
This commit is contained in:
parent
4f3f87649f
commit
b780bf7047
4 changed files with 9 additions and 86 deletions
|
|
@ -100,7 +100,7 @@ _bitcoin_cli() {
|
|||
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany)
|
||||
getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendmany)
|
||||
_bitcoin_accounts
|
||||
return 0
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
self.nodes[0].settxfee(.001)
|
||||
|
||||
node0_address_foo = self.nodes[0].getnewaddress("foo")
|
||||
fund_foo_txid = self.nodes[0].sendfrom("", node0_address_foo, 1219)
|
||||
# fund_foo_txid = self.nodes[0].sendfrom("", node0_address_foo, 1219)
|
||||
fund_foo_tx = self.nodes[0].gettransaction(fund_foo_txid)
|
||||
|
||||
node0_address_bar = self.nodes[0].getnewaddress("bar")
|
||||
fund_bar_txid = self.nodes[0].sendfrom("", node0_address_bar, 29)
|
||||
# fund_bar_txid = self.nodes[0].sendfrom("", node0_address_bar, 29)
|
||||
fund_bar_tx = self.nodes[0].gettransaction(fund_bar_txid)
|
||||
|
||||
assert_equal(self.nodes[0].getbalance(""),
|
||||
|
|
@ -51,8 +51,8 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
node1_address = self.nodes[1].getnewaddress("from0")
|
||||
|
||||
# Send tx1, and another transaction tx2 that won't be cloned
|
||||
txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0)
|
||||
txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0)
|
||||
# txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0)
|
||||
# txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0)
|
||||
|
||||
# Construct a clone of tx1, to be malleated
|
||||
rawtx1 = self.nodes[0].getrawtransaction(txid1,1)
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
|
||||
# Assign coins to foo and bar accounts:
|
||||
node0_address_foo = self.nodes[0].getnewaddress("foo")
|
||||
fund_foo_txid = self.nodes[0].sendfrom("", node0_address_foo, 1219)
|
||||
# fund_foo_txid = self.nodes[0].sendfrom("", node0_address_foo, 1219)
|
||||
fund_foo_tx = self.nodes[0].gettransaction(fund_foo_txid)
|
||||
|
||||
node0_address_bar = self.nodes[0].getnewaddress("bar")
|
||||
fund_bar_txid = self.nodes[0].sendfrom("", node0_address_bar, 29)
|
||||
# fund_bar_txid = self.nodes[0].sendfrom("", node0_address_bar, 29)
|
||||
fund_bar_tx = self.nodes[0].gettransaction(fund_bar_txid)
|
||||
|
||||
assert_equal(self.nodes[0].getbalance(""),
|
||||
|
|
@ -67,8 +67,8 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
assert_equal(doublespend["complete"], True)
|
||||
|
||||
# Create two spends using 1 50 BTC coin each
|
||||
txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0)
|
||||
txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0)
|
||||
# txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0)
|
||||
# txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0)
|
||||
|
||||
# Have node0 mine a block:
|
||||
if (self.options.mine_block):
|
||||
|
|
|
|||
|
|
@ -914,81 +914,6 @@ UniValue movecmd(const JSONRPCRequest& request)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
UniValue sendfrom(const JSONRPCRequest& request)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(request.fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (request.fHelp || request.params.size() < 3 || request.params.size() > 6)
|
||||
throw runtime_error(
|
||||
"sendfrom \"fromaccount\" \"toaddress\" amount ( minconf \"comment\" \"comment_to\" )\n"
|
||||
"\nDEPRECATED (use sendtoaddress). Sent an amount from an account to a bitcoin address."
|
||||
+ HelpRequiringPassphrase() + "\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"fromaccount\" (string, required) The name of the account to send funds from. May be the default account using \"\".\n"
|
||||
" Specifying an account does not influence coin selection, but it does associate the newly created\n"
|
||||
" transaction with the account, so the account's balance computation and transaction history can reflect\n"
|
||||
" the spend.\n"
|
||||
"2. \"toaddress\" (string, required) The bitcoin address to send funds to.\n"
|
||||
"3. amount (numeric or string, required) The amount in " + CURRENCY_UNIT + " (transaction fee is added on top).\n"
|
||||
"4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n"
|
||||
"5. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
|
||||
" This is not part of the transaction, just kept in your wallet.\n"
|
||||
"6. \"comment_to\" (string, optional) An optional comment to store the name of the person or organization \n"
|
||||
" to which you're sending the transaction. This is not part of the transaction, \n"
|
||||
" it is just kept in your wallet.\n"
|
||||
"\nResult:\n"
|
||||
"\"txid\" (string) The transaction id.\n"
|
||||
"\nExamples:\n"
|
||||
"\nSend 0.01 " + CURRENCY_UNIT + " from the default account to the address, must have at least 1 confirmation\n"
|
||||
+ HelpExampleCli("sendfrom", "\"\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01") +
|
||||
"\nSend 0.01 from the tabby account to the given address, funds must have at least 6 confirmations\n"
|
||||
+ HelpExampleCli("sendfrom", "\"tabby\" \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.01 6 \"donation\" \"seans outpost\"") +
|
||||
"\nAs a json rpc call\n"
|
||||
+ HelpExampleRpc("sendfrom", "\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", 0.01, 6, \"donation\", \"seans outpost\"")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
string strAccount = AccountFromValue(request.params[0]);
|
||||
CBitcoinAddress address(request.params[1].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
CAmount nAmount = AmountFromValue(request.params[2]);
|
||||
if (nAmount <= 0)
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send");
|
||||
int nMinDepth = 1;
|
||||
if (request.params.size() > 3)
|
||||
nMinDepth = request.params[3].get_int();
|
||||
|
||||
|
||||
CPubKey confidentiality_pubkey;
|
||||
if (address.IsBlinded())
|
||||
confidentiality_pubkey = address.GetBlindingKey();
|
||||
|
||||
CWalletTx wtx;
|
||||
wtx.strFromAccount = strAccount;
|
||||
if (request.params.size() > 4 && !request.params[4].isNull() && !request.params[4].get_str().empty())
|
||||
wtx.mapValue["comment"] = request.params[4].get_str();
|
||||
if (request.params.size() > 5 && !request.params[5].isNull() && !request.params[5].get_str().empty())
|
||||
wtx.mapValue["to"] = request.params[5].get_str();
|
||||
|
||||
EnsureWalletIsUnlocked();
|
||||
|
||||
// Check funds
|
||||
CAmount nBalance = pwalletMain->GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||
if (nAmount > nBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||
|
||||
SendMoney(address.Get(), nAmount, BITCOINID, false, confidentiality_pubkey, wtx);
|
||||
|
||||
AuditLogPrintf("%s : sendfrom %s %s %s txid:%s\n", getUser(), request.params[0].get_str(), request.params[1].get_str(), request.params[2].getValStr(), wtx.GetHash().GetHex());
|
||||
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
|
||||
|
||||
UniValue sendmany(const JSONRPCRequest& request)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(request.fHelp))
|
||||
|
|
@ -3748,8 +3673,6 @@ static const CRPCCommand commands[] =
|
|||
{ "wallet", "listtransactions", &listtransactions, false, {"account","count","skip","include_watchonly"} },
|
||||
{ "wallet", "listunspent", &listunspent, false, {"minconf","maxconf","addresses","include_unsafe"} },
|
||||
{ "wallet", "lockunspent", &lockunspent, true, {"unlock","transactions"} },
|
||||
{ "wallet", "move", &movecmd, false, {"fromaccount","toaccount","amount","minconf","comment"} },
|
||||
{ "wallet", "sendfrom", &sendfrom, false, {"fromaccount","toaddress","amount","minconf","comment","comment_to"} },
|
||||
{ "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","comment","subtractfeefrom"} },
|
||||
{ "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount"} },
|
||||
{ "wallet", "setaccount", &setaccount, true, {"address","account"} },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue