mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-03 12:11:52 +02:00
wallet: return accurate error messages from Coin Selection
and not the general "Insufficient funds" when the wallet actually have funds. Two new error messages: 1) If the selection result exceeds the maximum transaction weight, we now will return: "The inputs size exceeds the maximum weight". 2) If the user preselected inputs and disallowed the automatic coin selection process (no other inputs are allowed), we now will return: "The preselected coins total amount does not cover the transaction target".
This commit is contained in:
@ -412,10 +412,12 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
assert res["complete"]
|
||||
utxo1 = w0.listunspent()[0]
|
||||
assert_equal(utxo1["amount"], 50)
|
||||
ERR_NOT_ENOUGH_PRESET_INPUTS = "The preselected coins total amount does not cover the transaction target. " \
|
||||
"Please allow other inputs to be automatically selected or include more coins manually"
|
||||
self.test_send(from_wallet=w0, to_wallet=w1, amount=51, inputs=[utxo1],
|
||||
expect_error=(-4, "Insufficient funds"))
|
||||
expect_error=(-4, ERR_NOT_ENOUGH_PRESET_INPUTS))
|
||||
self.test_send(from_wallet=w0, to_wallet=w1, amount=51, inputs=[utxo1], add_inputs=False,
|
||||
expect_error=(-4, "Insufficient funds"))
|
||||
expect_error=(-4, ERR_NOT_ENOUGH_PRESET_INPUTS))
|
||||
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=51, inputs=[utxo1], add_inputs=True, add_to_wallet=False)
|
||||
assert res["complete"]
|
||||
|
||||
|
Reference in New Issue
Block a user