mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
syntax cleanup
This commit is contained in:
parent
83cf3a4b45
commit
663aacbc23
@ -86,10 +86,10 @@ Uses `btc-wallet-hook`, with max-gap=3
|
||||
|
||||
=eny1 0v3uc.iuebi.5qilc.l8d87.c1k6n.7iksq.nkobs.8s5he.raq40.9ff0b.5tj3u.kjtg7.aq59e.hatv7.oioam.mlsr4.pqqcd.cnbjn.pnpi2.1m5rt.k4scg
|
||||
=eny2 0v1gt.mc4ca.lfs0m.q1dal.lqobu.mmlbd.2umnp.lj9dr.4pf4s.pvclr.dps96.4a6i8.rt6n9.krp0r.11kqu.ckqe4.1tmat.gr754.463aj.a4b41.jj7qg
|
||||
|
||||
=inputs ~[[u(value val0) %0 0] [u(value val1) %0 2] [u(value val2) %0 1] [u(value val3) %1 2]]
|
||||
|
||||
(~(single-random-draw sut:bwsl [*walt:bwsl eny1 400.100 100 2]) inputs)
|
||||
(~(single-random-draw sut:bwsl [*walt:bwsl eny2 400.100 100 2]) inputs)(~(single-random-draw sut:bwsl [*walt:bwsl eny2 400.100 100 2]) inputs)
|
||||
(~(single-random-draw sut:bwsl [*walt:bwsl eny2 400.100 100 2]) inputs)
|
||||
|
||||
```
|
||||
Above tests w 2 outputs, total fees with 2 inputs of 27.500. Gives:
|
||||
|
@ -121,10 +121,10 @@
|
||||
=/ 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))
|
||||
|^ ^- (unit [=vbytes (list input)])
|
||||
%- single-random-draw
|
||||
%- zing
|
||||
(turn ~(val by wach.w) to-inputs)
|
||||
@ -139,19 +139,20 @@
|
||||
::
|
||||
++ single-random-draw
|
||||
|= is=(list input)
|
||||
^- (unit (list input))
|
||||
^- (unit [=vbytes (list input)])
|
||||
=/ rng ~(. og eny)
|
||||
=/ target (add targ (mul feyb base-weight)) :: add base fees to target
|
||||
=| [select=(list input) total=sats:btc]
|
||||
|- ?~ is ~
|
||||
|- ?: =(~ is) ~
|
||||
=^ n rng (rads:rng (lent is))
|
||||
=/ i=input (snag n `(list input)`is)
|
||||
=/ i=input (snag n is)
|
||||
=/ net-val (net-value value.utxo.i)
|
||||
=? select (gth net-val 0) [i select] :: select if net-value > 0
|
||||
=/ new-total (add total net-val)
|
||||
?: (gte new-total target) `select
|
||||
?: (gte new-total target)
|
||||
`[(total-vbytes select) select]
|
||||
%= $
|
||||
is (oust [n 1] `(list input)`is)
|
||||
is (oust [n 1] is)
|
||||
total new-total
|
||||
==
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user