1
0

add NotEnoughFunds exception

This commit is contained in:
ThomasV
2014-11-20 19:10:43 +01:00
parent 5adb10e4d2
commit 01cf04079f
4 changed files with 20 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ import shutil
from datetime import datetime
is_verbose = False
class NotEnoughFunds(Exception): pass
class MyEncoder(json.JSONEncoder):
def default(self, obj):

View File

@@ -27,7 +27,7 @@ import math
import json
import copy
from util import print_msg, print_error
from util import print_msg, print_error, NotEnoughFunds
from bitcoin import *
from account import *
@@ -712,8 +712,9 @@ class Abstract_Wallet(object):
fee = fixed_fee if fixed_fee is not None else self.estimated_fee(tx)
if total >= amount + fee: break
else:
print_error("Not enough funds", total, amount, fee)
return None
raise NotEnoughFunds()
#print_error("Not enough funds", total, amount, fee)
#return None
# change address
if not change_addr: