Browse Source

Return TransactionFailed when insufficient funds

Fixes #1170.
Prior to this commit, an attempt to spend using
the direct-send endpoint in the RPC API would
cause a backend crash because the NoFundsException
was not being caught.
This is now fixed.
master
Adam Gibson 4 years ago
parent
commit
a0b7b38d30
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 4
      jmclient/jmclient/wallet_rpc.py

4
jmclient/jmclient/wallet_rpc.py

@ -20,7 +20,7 @@ from jmclient import Taker, jm_single, \
create_wallet, get_max_cj_fee_values, \
StorageError, StoragePasswordError, JmwalletdWebSocketServerFactory, \
JmwalletdWebSocketServerProtocol, RetryableStorageError, \
SegwitWalletFidelityBonds, wallet_gettimelockaddress
SegwitWalletFidelityBonds, wallet_gettimelockaddress, NotEnoughFundsException
from jmbase.support import get_log, utxostr_to_utxo
jlog = get_log()
@ -546,6 +546,8 @@ class JMWalletDaemon(Service):
return_transaction=True, answeryes=True)
except AssertionError:
raise InvalidRequestFormat()
except NotEnoughFundsException as e:
raise TransactionFailed(repr(e))
if not tx:
# this should not really happen; not a coinjoin
# so tx should go through.

Loading…
Cancel
Save