Skip to content

Commit 1a875d4

Browse files
committed
rpc: update min package size error message in submitpackage
Currently, the only allowed package topology has a min size of 2. Update the error message to reflect that.
1 parent f9ece25 commit 1a875d4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/rpc/mempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ static RPCHelpMan submitpackage()
861861
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
862862
{
863863
const UniValue raw_transactions = request.params[0].get_array();
864-
if (raw_transactions.size() < 1 || raw_transactions.size() > MAX_PACKAGE_COUNT) {
864+
if (raw_transactions.size() < 2 || raw_transactions.size() > MAX_PACKAGE_COUNT) {
865865
throw JSONRPCError(RPC_INVALID_PARAMETER,
866-
"Array must contain between 1 and " + ToString(MAX_PACKAGE_COUNT) + " transactions.");
866+
"Array must contain between 2 and " + ToString(MAX_PACKAGE_COUNT) + " transactions.");
867867
}
868868

869869
std::vector<CTransactionRef> txns;

test/functional/rpc_packages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ def test_submitpackage(self):
343343
assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, chain_hex)
344344
assert_equal(legacy_pool, node.getrawmempool())
345345

346-
assert_raises_rpc_error(-8, f"Array must contain between 1 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, [])
347-
assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, [chain_hex[0]] * 1)
346+
assert_raises_rpc_error(-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, [])
347+
assert_raises_rpc_error(-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, [chain_hex[0]] * 1)
348348
assert_raises_rpc_error(
349-
-8, f"Array must contain between 1 and {MAX_PACKAGE_COUNT} transactions.",
349+
-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.",
350350
node.submitpackage, [chain_hex[0]] * (MAX_PACKAGE_COUNT + 1)
351351
)
352352

0 commit comments

Comments
 (0)