diff --git a/bit/wallet.py b/bit/wallet.py index 5a29cec..515aaa1 100644 --- a/bit/wallet.py +++ b/bit/wallet.py @@ -400,10 +400,12 @@ def prepare_transaction(cls, address, outputs, compressed=True, fee=None, :returns: JSON storing data required to create an offline transaction. :rtype: ``str`` """ + if not isinstance(fee, (int, type(None))): + raise TypeError('Invalid fee type.') unspents, outputs = sanitize_tx_data( unspents or NetworkAPI.get_unspent(address), outputs, - fee or get_fee_cached(), + fee if isinstance(fee, int) else get_fee_cached(), leftover or address, combine=combine, message=message, @@ -766,10 +768,12 @@ def prepare_transaction(cls, address, outputs, compressed=True, fee=None, :returns: JSON storing data required to create an offline transaction. :rtype: ``str`` """ + if not isinstance(fee, (int, type(None))): + raise TypeError('Invalid fee type.') unspents, outputs = sanitize_tx_data( unspents or NetworkAPI.get_unspent_testnet(address), outputs, - fee or get_fee_cached(), + fee if isinstance(fee, int) else get_fee_cached(), leftover or address, combine=combine, message=message, @@ -1118,10 +1122,12 @@ def prepare_transaction(cls, address, outputs, compressed=True, fee=None, :returns: JSON storing data required to create an offline transaction. :rtype: ``str`` """ + if not isinstance(fee, (int, type(None))): + raise TypeError('Invalid fee type.') unspents, outputs = sanitize_tx_data( unspents or NetworkAPI.get_unspent(address), outputs, - fee or get_fee_cached(), + fee if isinstance(fee, int) else get_fee_cached(), leftover or address, combine=combine, message=message, @@ -1421,10 +1427,12 @@ def prepare_transaction(cls, address, outputs, compressed=True, fee=None, :returns: JSON storing data required to create an offline transaction. :rtype: ``str`` """ + if not isinstance(fee, (int, type(None))): + raise TypeError('Invalid fee type.') unspents, outputs = sanitize_tx_data( unspents or NetworkAPI.get_unspent_testnet(address), outputs, - fee or get_fee_cached(), + fee if isinstance(fee, int) else get_fee_cached(), leftover or address, combine=combine, message=message,