mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
Merge bitcoin/bitcoin#29292: rpc: improve submitpackage documentation and other improvements
78e52f663f
doc: rpc: fix submitpackage examples (stickies-v)1a875d4049
rpc: update min package size error message in submitpackage (stickies-v)f9ece258aa
doc: rpc: submitpackage takes sorted array (stickies-v)17f74512f0
test: add bounds checking for submitpackage RPC (stickies-v) Pull request description: `submitpackage` requires the package to be topologically sorted with the child being the last element in the array, but this is not documented in the RPC method or the error messages. Also sneaking in some other minor improvements that I found while going through the code: - Informing the user that `package` needs to be an array of length between `1` and `MAX_PACKAGE_COUNT` is confusing when `IsChildWithPackage()` requires that the package size >= 2. Remove this check to avoid code duplication and sending a confusing error message. - fixups to the `submitpackage` examples ACKs for top commit: fjahr: re-ACK78e52f663f
instagibbs: ACK78e52f663f
achow101: ACK78e52f663f
glozow: utACK78e52f663f
Tree-SHA512: a8845621bb1cbf784167fc7c82cb8ceb105868b65b26d3465f072d1c04ef3699e85a21a524ade805d423bcecbc34f7d5bff12f2c21cbd902ae1fb154193ebdc9
This commit is contained in:
@ -26,6 +26,9 @@ from test_framework.wallet import (
|
||||
)
|
||||
|
||||
|
||||
MAX_PACKAGE_COUNT = 25
|
||||
|
||||
|
||||
class RPCPackagesTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
@ -344,6 +347,13 @@ class RPCPackagesTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, chain_hex)
|
||||
assert_equal(legacy_pool, node.getrawmempool())
|
||||
|
||||
assert_raises_rpc_error(-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, [])
|
||||
assert_raises_rpc_error(-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, [chain_hex[0]] * 1)
|
||||
assert_raises_rpc_error(
|
||||
-8, f"Array must contain between 2 and {MAX_PACKAGE_COUNT} transactions.",
|
||||
node.submitpackage, [chain_hex[0]] * (MAX_PACKAGE_COUNT + 1)
|
||||
)
|
||||
|
||||
# Create a transaction chain such as only the parent gets accepted (by making the child's
|
||||
# version non-standard). Make sure the parent does get broadcast.
|
||||
self.log.info("If a package is partially submitted, transactions included in mempool get broadcast")
|
||||
|
Reference in New Issue
Block a user