aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-05-11 17:54:39 +0100
committerglozow <gloriajzhao@gmail.com>2023-10-02 10:13:38 +0100
commit5b9087a9a7da2602485e85e0b163dc3cbd2daf31 (patch)
treef55133d2e66afcf575a484119d94b038527b43b1 /src/rpc
parente32ba1599c599e75b1da3393f71f633de860505f (diff)
[rpc] require package to be a tree in submitpackage
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/mempool.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index 705608bd47..173127e014 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -820,6 +820,7 @@ static RPCHelpMan submitpackage()
{
return RPCHelpMan{"submitpackage",
"Submit a package of raw transactions (serialized, hex-encoded) to local node (-regtest only).\n"
+ "The package must consist of a child with its parents, and none of the parents may depend on one another.\n"
"The package will be validated according to consensus and mempool policy rules. If all transactions pass, they will be accepted to mempool.\n"
"This RPC is experimental and the interface may be unstable. Refer to doc/policy/packages.md for documentation on package policies.\n"
"Warning: until package relay is in use, successful submission does not mean the transaction will propagate to other nodes on the network.\n"
@@ -881,6 +882,9 @@ static RPCHelpMan submitpackage()
}
txns.emplace_back(MakeTransactionRef(std::move(mtx)));
}
+ if (!IsChildWithParentsTree(txns)) {
+ throw JSONRPCTransactionError(TransactionError::INVALID_PACKAGE, "package topology disallowed. not child-with-parents or parents depend on each other.");
+ }
NodeContext& node = EnsureAnyNodeContext(request.context);
CTxMemPool& mempool = EnsureMemPool(node);