forked from LBRYCommunity/lbry-sdk
pylint & mypint fixes
This commit is contained in:
parent
f2bd0edc51
commit
4a24cc0095
2 changed files with 9 additions and 8 deletions
|
@ -94,7 +94,8 @@ class TestCoinSelectionTests(BaseSelectionTestCase):
|
|||
)
|
||||
selector = CoinSelector(utxo_pool, 20*CENT, 0)
|
||||
match = selector.select("confirmed_only")
|
||||
self.assertEqual([5,5], [c.txo.tx_ref.height for c in match])
|
||||
self.assertEqual([5, 5], [c.txo.tx_ref.height for c in match])
|
||||
|
||||
|
||||
class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ class CoinSelector:
|
|||
if seed is not None:
|
||||
self.random.seed(seed, version=1)
|
||||
|
||||
def select(self, strategy: str = None) -> List[basetransaction.BaseOutputEffectiveAmountEstimator]:
|
||||
def select(self, strategy_name: str = None) -> List[basetransaction.BaseOutputEffectiveAmountEstimator]:
|
||||
if not self.txos:
|
||||
return []
|
||||
if self.target > self.available:
|
||||
return []
|
||||
if strategy is not None:
|
||||
return getattr(self, strategy)()
|
||||
if strategy_name is not None:
|
||||
return getattr(self, strategy_name)()
|
||||
return (
|
||||
self.branch_and_bound() or
|
||||
self.closest_match() or
|
||||
|
@ -41,12 +41,12 @@ class CoinSelector:
|
|||
|
||||
@strategy
|
||||
def confirmed_only(self) -> List[basetransaction.BaseOutputEffectiveAmountEstimator]:
|
||||
self.txos = [t for t in self.txos if t.txo.tx_ref.height > 0] or self.txos
|
||||
self.txos = [t for t in self.txos if t.txo.tx_ref and t.txo.tx_ref.height > 0] or self.txos
|
||||
self.available = sum(c.effective_amount for c in self.txos)
|
||||
return (
|
||||
self.branch_and_bound() or
|
||||
self.closest_match() or
|
||||
self.random_draw()
|
||||
self.branch_and_bound() or
|
||||
self.closest_match() or
|
||||
self.random_draw()
|
||||
)
|
||||
|
||||
@strategy
|
||||
|
|
Loading…
Add table
Reference in a new issue