def test_perfect_match_with_range(self): unspents, remaining = select_coins(99960000, 200, [34, 34], 0, absolute_fee=True, consolidate=False, unspents=UNSPENTS_SEGWIT) assert len(unspents) == 1 assert remaining == 0
def test_random_draw(self): print(UNSPENTS_SEGWIT) unspents, remaining = select_coins(150000000, 0, [34, 34], 0, absolute_fee=True, consolidate=False, unspents=UNSPENTS_SEGWIT) assert all([u in UNSPENTS_SEGWIT for u in unspents]) assert remaining == 50000000
'minamount'] * 100_000_000 < required_change: continue return req['utxos'], req['minamount'] * 100_000_000 return [[]], 0 sats_required_from_rbf = sats_to_send - stripped_balance + max(feerates) + 566 all_rbf_change = bitpost_interface.get_change_utxos_from_bitpost() rbf_selected, min_rbf_sats = rbf_coin_select(all_rbf_change, sats_required_from_rbf) selected_unspents = [] if not min_rbf_sats > sats_to_send + max( feerates) + 566 and stripped_balance > 0: selected_unspents = select_coins(sats_to_send - min_rbf_sats, max(feerates), [34], min_change=566, unspents=unspents) selected_unspents = selected_unspents[0] elif min_rbf_sats < sats_required_from_rbf: print("Not enough balance. Fund wallet: address=" + key.segwit_address) exit(0) raw_signed_txs = [] for pre_selection in rbf_selected: coin_selection = pre_selection + selected_unspents for i in range(0, len(feerates)): tx = key.create_transaction( [(destination_address, sats_to_send, 'satoshi')], feerates[i], combine=True, unspents=coin_selection,