aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_sendall.py
diff options
context:
space:
mode:
authorkouloumos <kouloumosa@gmail.com>2022-09-06 20:52:41 +0300
committerkouloumos <kouloumosa@gmail.com>2022-09-15 13:22:19 +0300
commitcc434cbf583ec8d1b0f3aa504417231fdc81f33a (patch)
tree8946bdba3873a4dceb2162f95ed13303ba05267c /test/functional/wallet_sendall.py
parent718304d222671f98d2335cd9b90a3022f62d7b21 (diff)
wallet: fix sendall creates tx that fails tx-size check
The `sendall` RPC doesn't use `CreateTransactionInternal`as the rest of the wallet RPCs and it never checks against the tx-size mempool limit. Add a check for tx-size as well as test coverage for that case.
Diffstat (limited to 'test/functional/wallet_sendall.py')
-rwxr-xr-xtest/functional/wallet_sendall.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/wallet_sendall.py b/test/functional/wallet_sendall.py
index f24329f7b3..db4f32fe16 100755
--- a/test/functional/wallet_sendall.py
+++ b/test/functional/wallet_sendall.py
@@ -276,6 +276,20 @@ class SendallTest(BitcoinTestFramework):
recipients=[self.remainder_target],
fee_rate=100000)
+ # This tests needs to be the last one otherwise @cleanup will fail with "Transaction too large" error
+ def sendall_fails_with_transaction_too_large(self):
+ self.log.info("Test that sendall fails if resulting transaction is too large")
+ # create many inputs
+ outputs = {self.wallet.getnewaddress(): 0.000025 for _ in range(1600)}
+ self.def_wallet.sendmany(amounts=outputs)
+ self.generate(self.nodes[0], 1)
+
+ assert_raises_rpc_error(
+ -4,
+ "Transaction too large.",
+ self.wallet.sendall,
+ recipients=[self.remainder_target])
+
def run_test(self):
self.nodes[0].createwallet("activewallet")
self.wallet = self.nodes[0].get_wallet_rpc("activewallet")
@@ -327,5 +341,8 @@ class SendallTest(BitcoinTestFramework):
# Sendall fails when providing a fee that is too high
self.sendall_fails_on_high_fee()
+ # Sendall fails when many inputs result to too large transaction
+ self.sendall_fails_with_transaction_too_large()
+
if __name__ == '__main__':
SendallTest().main()