Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add correct handling for param fee in prepare_transaction when fee is 0 #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions bit/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down