RPC/Mining: Restore API compatibility for prioritisetransaction

Breaking API serves no purpose other than to be incompatible with older versions and other implementations that do support priority

(cherry picked from commit bitcoin/bitcoin@870824e919)

Zcash:
* Update the release notes.
* Update the `prioritisetransaction.py` RPC test.
* We don't have BIP 68 or replace-by-fee.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Luke Dashjr 2017-04-21 16:41:01 +00:00 committed by Daira Emma Hopwood
parent 54fe279ef8
commit dd4fdf77d0
5 changed files with 19 additions and 14 deletions

View File

@ -30,8 +30,8 @@ RPC Changes
pool, so the impact of this change is that for such transactions, the user must specify
`AllowFullyTransparent`.
- The `estimatepriority` RPC call has been removed.
- The `priority_delta` argument to the `prioritisetransaction` RPC call has been
removed.
- The `priority_delta` argument to the `prioritisetransaction` RPC call now has
no effect and must be set to a dummy value (0 or null).
Changes to Transaction Fee Selection
------------------------------------

View File

@ -88,7 +88,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
# Check that descendant modified fees includes fee deltas from
# prioritisetransaction
self.nodes[0].prioritisetransaction(chain[-1], 1000)
self.nodes[0].prioritisetransaction(chain[-1], 0, 1000)
mempool = self.nodes[0].getrawmempool(True)
descendant_fees = 0
@ -104,7 +104,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
# Check that prioritising a tx before it's added to the mempool works
self.nodes[0].generate(1)
self.nodes[0].prioritisetransaction(chain[-1], 2000)
self.nodes[0].prioritisetransaction(chain[-1], None, 2000)
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
mempool = self.nodes[0].getrawmempool(True)

View File

@ -74,7 +74,7 @@ class PrioritiseTransactionTest (BitcoinTestFramework):
print("in_block_template =", in_block_template)
#assert_equal(in_block_template, False)
priority_success = self.nodes[0].prioritisetransaction(priority_tx_0, int(3 * base_fee * COIN))
priority_success = self.nodes[0].prioritisetransaction(priority_tx_0, 0, int(3 * base_fee * COIN))
assert(priority_success)
# Check that prioritised transaction is not in getblocktemplate()
@ -113,7 +113,7 @@ class PrioritiseTransactionTest (BitcoinTestFramework):
# Node 1 doesn't get the next block, so this *shouldn't* be mined despite being prioritised on node 1
priority_tx_1 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 0.1)
self.nodes[1].prioritisetransaction(priority_tx_1, int(3 * base_fee * COIN))
self.nodes[1].prioritisetransaction(priority_tx_1, 0, int(3 * base_fee * COIN))
# Mine block on node 0
blk_hash = self.nodes[0].generate(1)

View File

@ -52,7 +52,7 @@ static const CRPCConvertTable rpcCvtTable =
{ "generate", {{o}, {}} },
{ "setgenerate", {{o}, {o}} },
{ "getmininginfo", {{}, {}} },
{ "prioritisetransaction", {{s, o}, {}} },
{ "prioritisetransaction", {{s, o, o}, {}} },
{ "getblocktemplate", {{}, {o}} },
// NB: The second argument _should_ be an object, but upstream treats it as a string, so we
// preserve that here.

View File

@ -375,26 +375,31 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
// NOTE: Unlike wallet RPCs (which use ZEC values), mining RPCs follow GBT (BIP 22) in using zatoshi amounts.
UniValue prioritisetransaction(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error(
"prioritisetransaction <txid> <fee delta>\n"
if (fHelp || params.size() != 3)
throw std::runtime_error(
"prioritisetransaction <txid> <priority delta> <fee delta>\n"
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id.\n"
"2. fee_delta (numeric, required) The fee value (in " + MINOR_CURRENCY_UNIT + ") to add (or subtract, if negative).\n"
"2. priority_delta (numeric, optional) Fee-independent priority adjustment. Not supported, so must be zero or null.\n"
"3. fee_delta (numeric, required) The fee value (in " + MINOR_CURRENCY_UNIT + ") to add (or subtract, if negative).\n"
" The modified 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"
"\nResult\n"
"true (boolean) Returns true\n"
"\nExamples:\n"
+ HelpExampleCli("prioritisetransaction", "\"txid\" 10000")
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 10000")
+ HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
);
LOCK(cs_main);
uint256 hash = ParseHashStr(params[0].get_str(), "txid");
CAmount nAmount = params[1].get_int64();
CAmount nAmount = params[2].get_int64();
if (!(params[1].isNull() || params[1].get_real() == 0)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is not supported, and adjustment thereof must be zero.");
}
mempool.PrioritiseTransaction(hash, params[0].get_str(), nAmount);
return true;