mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-12 15:01:38 +03:00
refactor select-utxos
This commit is contained in:
parent
77f15b16b2
commit
055906378a
@ -121,17 +121,18 @@
|
||||
=/ cost (mul input-weight feyb)
|
||||
?: (lte val cost) 0
|
||||
(sub val cost)
|
||||
:: Uses naive random selection. Should switch to branch-and-bound later
|
||||
:: Uses naive random selection. Should switch to branch-and-bound later
|
||||
::
|
||||
++ select-utxos
|
||||
^- (unit (list input))
|
||||
=/ is=(list input)
|
||||
%- zing
|
||||
%+ turn ~(val by wach.w)
|
||||
|= =addi
|
||||
|^ ^- (unit (list input))
|
||||
%- single-random-draw
|
||||
%- zing
|
||||
(turn ~(val by wach.w) to-inputs)
|
||||
++ to-inputs
|
||||
|= =addi ^- (list input)
|
||||
%+ turn ~(tap in utxos.addi)
|
||||
|=(=utxo:btc [utxo chyg.addi idx.addi])
|
||||
(single-random-draw is)
|
||||
|=(=utxo:btc [utxo chyg.addi idx.addi])
|
||||
--
|
||||
:: single-random-draw
|
||||
:: randomly choose utxos until target is hit
|
||||
:: only use an input if its net-value > 0
|
||||
|
Loading…
Reference in New Issue
Block a user