mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
sendrawtransaction no longer bypasses transaction policy limits by default (#2110)
* [rpc] sendrawtransaction no longer bypasses minRelayTxFee The prioritisetransaction API can always be used if a transaction needs to be submitted that bypasses minRelayTxFee. * Allow to bypass transaction policy limits in sendrawtransaction Add new rpc param to sendrawtransaction to have an ability to tweak its behaviour. Default is `false` i.e. "do not bypass". * fix
This commit is contained in:
parent
8e129877a6
commit
8d8fdb4339
@ -70,7 +70,7 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||
self.block_submit(self.nodes[0], test1txs, True)
|
||||
|
||||
print ("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation")
|
||||
test2tx = self.create_transaction(self.nodes[0], txid2, self.ms_address, 48)
|
||||
test2tx = self.create_transaction(self.nodes[0], txid2, self.ms_address, 47)
|
||||
trueDummy(test2tx)
|
||||
txid4 = self.tx_submit(self.nodes[0], test2tx, NULLDUMMY_ERROR)
|
||||
|
||||
@ -78,7 +78,7 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||
self.block_submit(self.nodes[0], [test2tx], True)
|
||||
|
||||
print ("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
|
||||
test4tx = self.create_transaction(self.nodes[0], txid4, self.address, 47)
|
||||
test4tx = self.create_transaction(self.nodes[0], txid4, self.address, 46)
|
||||
test6txs=[CTransaction(test4tx)]
|
||||
trueDummy(test4tx)
|
||||
self.tx_submit(self.nodes[0], test4tx, NULLDUMMY_ERROR)
|
||||
|
@ -110,6 +110,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||
{ "signrawtransaction", 2, "privkeys" },
|
||||
{ "sendrawtransaction", 1, "allowhighfees" },
|
||||
{ "sendrawtransaction", 2, "instantsend" },
|
||||
{ "sendrawtransaction", 3, "bypasslimits" },
|
||||
{ "fundrawtransaction", 1, "options" },
|
||||
{ "gettxout", 1, "n" },
|
||||
{ "gettxout", 2, "include_mempool" },
|
||||
|
@ -873,15 +873,16 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
"sendrawtransaction \"hexstring\" ( allowhighfees instantsend )\n"
|
||||
"sendrawtransaction \"hexstring\" ( allowhighfees instantsend bypasslimits)\n"
|
||||
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
|
||||
"\nAlso see createrawtransaction and signrawtransaction calls.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
|
||||
"2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
|
||||
"3. instantsend (boolean, optional, default=false) Use InstantSend to send this transaction\n"
|
||||
"3. bypasslimits (boolean, optional, default=false) Bypass transactions policy limits\n"
|
||||
"\nResult:\n"
|
||||
"\"hex\" (string) The transaction hash in hex\n"
|
||||
"\nExamples:\n"
|
||||
@ -905,7 +906,6 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
|
||||
const uint256& hashTx = tx->GetHash();
|
||||
|
||||
bool fLimitFree = false;
|
||||
CAmount nMaxRawTxFee = maxTxFee;
|
||||
if (request.params.size() > 1 && request.params[1].get_bool())
|
||||
nMaxRawTxFee = 0;
|
||||
@ -914,6 +914,10 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
if (request.params.size() > 2)
|
||||
fInstantSend = request.params[2].get_bool();
|
||||
|
||||
bool fBypassLimits = false;
|
||||
if (request.params.size() > 3)
|
||||
fBypassLimits = request.params[3].get_bool();
|
||||
|
||||
CCoinsViewCache &view = *pcoinsTip;
|
||||
bool fHaveChain = false;
|
||||
for (size_t o = 0; !fHaveChain && o < tx->vout.size(); o++) {
|
||||
@ -928,7 +932,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
}
|
||||
CValidationState state;
|
||||
bool fMissingInputs;
|
||||
if (!AcceptToMemoryPool(mempool, state, std::move(tx), fLimitFree, &fMissingInputs, NULL, false, nMaxRawTxFee)) {
|
||||
if (!AcceptToMemoryPool(mempool, state, std::move(tx), !fBypassLimits, &fMissingInputs, NULL, false, nMaxRawTxFee)) {
|
||||
if (state.IsInvalid()) {
|
||||
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
|
||||
} else {
|
||||
@ -956,7 +960,7 @@ static const CRPCCommand commands[] =
|
||||
{ "rawtransactions", "createrawtransaction", &createrawtransaction, true, {"inputs","outputs","locktime"} },
|
||||
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, true, {"hexstring"} },
|
||||
{ "rawtransactions", "decodescript", &decodescript, true, {"hexstring"} },
|
||||
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false, {"hexstring","allowhighfees","instantsend"} },
|
||||
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false, {"hexstring","allowhighfees","instantsend","bypasslimits"} },
|
||||
{ "rawtransactions", "signrawtransaction", &signrawtransaction, false, {"hexstring","prevtxs","privkeys","sighashtype"} }, /* uses wallet if enabled */
|
||||
|
||||
{ "blockchain", "gettxoutproof", &gettxoutproof, true, {"txids", "blockhash"} },
|
||||
|
Loading…
Reference in New Issue
Block a user