Skip to content

Commit

Permalink
Merge pull request #973 from CounterpartyXCP/develop
Browse files Browse the repository at this point in the history
Filter out multisig dust too
  • Loading branch information
Robby Dermody authored May 22, 2017
2 parents fc50533 + db4dacf commit f645384
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions counterpartylib/lib/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def get_tx_list(block):
return (tx_hash_list, raw_transactions)

def sort_unspent_txouts(unspent, unconfirmed=False):
# Filter out all dust amounts
unspent = list(filter(lambda x: x['amount'] * config.UNIT > config.DEFAULT_REGULAR_DUST_SIZE, unspent))
# Then, sort by amount, using the largest UTXOs available
# Filter out all dust amounts to avoid bloating the resultant transaction
unspent = list(filter(lambda x: x['amount'] * config.UNIT > config.DEFAULT_MULTISIG_DUST_SIZE, unspent))
# Sort by amount, using the largest UTXOs available
unspent = sorted(unspent, key=lambda x: x['amount'], reverse=True)

return unspent
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_unspent_txouts(source, unconfirmed=False, multisig_inputs=False, unspent
"""
if not MEMPOOL_CACHE_INITIALIZED:
raise MempoolError('Mempool is not yet ready; please try again in a few minutes.')

# Get all outputs.
logger.debug('Getting outputs for {}'.format(source))
if unspent_tx_hash:
Expand Down

0 comments on commit f645384

Please sign in to comment.