revault / research

4 stars 1 forks source link

Decent coin selection for the Cancel #67

Closed darosior closed 3 years ago

darosior commented 3 years ago

Note how it relies a conservative consolidation coin selection too!

darosior commented 3 years ago

Shit it should be one line below then (for the Vm coins) ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ Le jeudi 30 septembre 2021 à 6:47 PM, JSwambo @.***> a écrit :

@JSwambo commented on this pull request.


In Model/statemachine.py:

  • return coins
  • def coin_sum(coins):
  • return sum(c.amount for c in coins)
  • First check if the needed amount is very low, in which case we don't

  • even need a Vb coin.

  • if vb_coins[0].amount > needed_fee + txin_cost:
  • for i in range(1, len(vm_coins)):
  • if coin_sum(vm_coins[:i]) >= needed_fee + txin_cost * i:
  • return vm_coins[:i]
  • return [vb_coins[0]]
  • Then gather enough vb coins

  • picked_vb_coins = []
  • paid = 0
  • TODO: figure out why we have less overpayments by going in increasing order

This checks in decreasing order (largest first)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.