prioritisetransaction RPC: Restore compatibility with existing implementations by using satoshis for fee offset rather than BTC

This commit is contained in:
Luke Dashjr 2014-12-01 12:51:45 +00:00
parent 89151d9f29
commit 8a20cd3c51

View file

@ -266,6 +266,7 @@ Value getmininginfo(const Array& params, bool fHelp)
} }
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
Value prioritisetransaction(const Array& params, bool fHelp) Value prioritisetransaction(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 3) if (fHelp || params.size() != 3)
@ -277,22 +278,20 @@ Value prioritisetransaction(const Array& params, bool fHelp)
"2. priority delta (numeric, required) The priority to add or subtract.\n" "2. priority delta (numeric, required) The priority to add or subtract.\n"
" The transaction selection algorithm considers the tx as it would have a higher priority.\n" " The transaction selection algorithm considers the tx as it would have a higher priority.\n"
" (priority of a transaction is calculated: coinage * value_in_satoshis / txsize) \n" " (priority of a transaction is calculated: coinage * value_in_satoshis / txsize) \n"
"3. fee delta (numeric, required) The absolute fee value to add or subtract in bitcoin.\n" "3. fee delta (numeric, required) The fee value (in satoshis) to add (or subtract, if negative).\n"
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n" " The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
" considers the transaction as it would have paid a higher (or lower) fee.\n" " considers the transaction as it would have paid a higher (or lower) fee.\n"
"\nResult\n" "\nResult\n"
"true (boolean) Returns true\n" "true (boolean) Returns true\n"
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 0.00010000") + HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 0.00010000") + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
); );
uint256 hash; uint256 hash;
hash.SetHex(params[0].get_str()); hash.SetHex(params[0].get_str());
CAmount nAmount = 0; CAmount nAmount = params[2].get_int64();
if (params[2].get_real() != 0.0)
nAmount = AmountFromValue(params[2]);
mempool.PrioritiseTransaction(hash, params[0].get_str(), params[1].get_real(), nAmount); mempool.PrioritiseTransaction(hash, params[0].get_str(), params[1].get_real(), nAmount);
return true; return true;