mirror of
https://github.com/urbit/shrub.git
synced 2024-12-23 19:05:48 +03:00
fixes
This commit is contained in:
parent
b96c752c3c
commit
b50144b1a1
@ -172,9 +172,6 @@
|
||||
::
|
||||
%broadcast-tx
|
||||
[%broadcast-tx rawtx.act]
|
||||
::
|
||||
%ping
|
||||
[%get-block-info ~]
|
||||
==
|
||||
[~[(req-card act ract)] state]
|
||||
::
|
||||
|
@ -173,7 +173,7 @@
|
||||
::
|
||||
:: overwrites any payment being built in poym
|
||||
::
|
||||
%req-pay-address
|
||||
%init-payment
|
||||
~| "Can't pay ourselves; no comets; can't do while tx is being signed"
|
||||
?< =(src.bowl payee.comm)
|
||||
?< ?=(%pawn (clan:title payee.comm))
|
||||
@ -217,7 +217,7 @@
|
||||
=. state state(num-fam.piym (~(put by num-fam.piym) f +(n)))
|
||||
=^ a=address state
|
||||
(generate-address u.curr-xpub %0)
|
||||
:- ~[(poke-peer src.bowl [%recv-pay-address a value.act])]
|
||||
:- ~[(poke-peer src.bowl [%give-pay-address a value.act])]
|
||||
state(ps.piym (~(put by ps.piym) src.bowl [~ u.curr-xpub a src.bowl value.act]))
|
||||
::
|
||||
++ generate-address
|
||||
@ -237,10 +237,10 @@
|
||||
?^ pend.u.p ~|("%gen-address: {<payer>} already has pending payment to us" !!)
|
||||
=+ newp=u.p(value value.act)
|
||||
:_ state(ps.piym (~(put by ps.piym) payer newp))
|
||||
~[(poke-peer payer [%recv-pay-address address.newp value.act])]
|
||||
~[(poke-peer payer [%give-pay-address address.newp value.act])]
|
||||
--
|
||||
::
|
||||
%recv-pay-address
|
||||
%give-pay-address
|
||||
?: =(src.bowl our.bowl) ~|("Can't pay ourselves" !!)
|
||||
?: is-broadcasting ~|("Broadcasting a transaction" !!)
|
||||
?~ curr-xpub ~|("btc-wallet-hook: no curr-xpub set" !!)
|
||||
@ -293,6 +293,15 @@
|
||||
?& =(payer.p src.bowl)
|
||||
=(value.p value.act)
|
||||
==
|
||||
::
|
||||
++ update-pend-piym
|
||||
|= [txid=hexb p=payment]
|
||||
^- _state
|
||||
?~ pend.p ~|("update-pend-piym: no pending payment" !!)
|
||||
%= state
|
||||
ps.piym (~(put by ps.piym) payer.p p)
|
||||
pend.piym (~(put by pend.piym) txid p)
|
||||
==
|
||||
--
|
||||
==
|
||||
::
|
||||
@ -301,6 +310,7 @@
|
||||
^- (quip card _state)
|
||||
?- -.intr
|
||||
%add-poym-raw-txi
|
||||
|^
|
||||
?> =(src.bowl our.bowl)
|
||||
?~ poym `state
|
||||
=. txis.u.poym
|
||||
@ -313,6 +323,18 @@
|
||||
~& >> "{<vb>} vbytes, {<(div fee vb)>} sats/byte, {<fee>} sats fee"
|
||||
%- (slog [%leaf "PSBT: {<u.pb>}"]~)
|
||||
~
|
||||
:: update outgoing payment with a rawtx, if the txid is in poym's txis
|
||||
::
|
||||
++ update-poym-txis
|
||||
|= [txis=(list txi) txid=hexb rawtx=hexb]
|
||||
^- (list txi)
|
||||
=| i=@
|
||||
|- ?: (gte i (lent txis)) txis
|
||||
=/ ith=txi (snag i txis)
|
||||
=? txis =(txid txid.utxo.ith)
|
||||
(snap txis i `txi`ith(rawtx `rawtx))
|
||||
$(i +(i))
|
||||
--
|
||||
:: delete an incoming/outgoing payment when we see it included in a tx
|
||||
::
|
||||
%close-pym
|
||||
@ -491,6 +513,7 @@
|
||||
?: ?|(?!(connected.p) (lth block.btc-state block))
|
||||
;: weld
|
||||
(retry-pend-piym network)
|
||||
(retry-poym network)
|
||||
(retry-addrs network)
|
||||
(retry-txs network)
|
||||
(retry-scans network)
|
||||
@ -769,34 +792,6 @@
|
||||
[(weld cards0 cards1) state]
|
||||
::
|
||||
::
|
||||
|
||||
:: +update-pend.piym
|
||||
:: - set pend.payment to txid (lock)
|
||||
:: - add txid to pend.piym
|
||||
::
|
||||
++ update-pend-piym
|
||||
|= [txid=hexb p=payment]
|
||||
^- _state
|
||||
?~ pend.p ~|("update-pend-piym: no pending payment" !!)
|
||||
%= state
|
||||
ps.piym (~(put by ps.piym) payer.p p)
|
||||
pend.piym (~(put by pend.piym) txid p)
|
||||
==
|
||||
::
|
||||
:: +update-poym-txis:
|
||||
:: update outgoing payment with a rawtx, if the txid is in poym's txis
|
||||
::
|
||||
++ update-poym-txis
|
||||
|= [txis=(list txi) txid=hexb rt=hexb]
|
||||
^- (list txi)
|
||||
=| i=@
|
||||
|- ?: (gte i (lent txis)) txis
|
||||
=/ ith=txi (snag i txis)
|
||||
=? txis =(txid txid.utxo.ith)
|
||||
(snap txis i `txi`ith(ur `rt))
|
||||
$(i +(i))
|
||||
::
|
||||
::
|
||||
::
|
||||
++ poke-provider
|
||||
|= [act=action:bp]
|
||||
|
@ -151,8 +151,8 @@
|
||||
=/ ins=(list in:psbt:bc)
|
||||
%+ murn txis.t
|
||||
|= =txi
|
||||
?~ ur.txi ~
|
||||
`[utxo.txi u.ur.txi hdkey.txi]
|
||||
?~ rawtx.txi ~
|
||||
`[utxo.txi u.rawtx.txi hdkey.txi]
|
||||
?: (lth (lent ins) (lent txis.t))
|
||||
~
|
||||
=/ outs=(list out:psbt:bc)
|
||||
|
@ -31,9 +31,7 @@
|
||||
[%raw-tx txid=hexb]
|
||||
[%broadcast-tx rawtx=hexb]
|
||||
[%ping ~]
|
||||
check-network
|
||||
==
|
||||
+$ check-network [%check-network =network]
|
||||
::
|
||||
+$ result
|
||||
$% [%address-info =address utxos=(set utxo) used=? block=@ud]
|
||||
|
@ -16,14 +16,14 @@
|
||||
[%set-current-wallet =xpub]
|
||||
[%add-wallet =xpub =fprint scan-to=(unit scon) max-gap=(unit @ud) confs=(unit @ud)]
|
||||
[%delete-wallet =xpub]
|
||||
[%req-pay-address payee=ship value=sats feyb=sats]
|
||||
[%init-payment payee=ship value=sats feyb=sats]
|
||||
[%broadcast-tx txhex=cord]
|
||||
==
|
||||
:: action: how peers poke us
|
||||
::
|
||||
+$ action
|
||||
$% [%gen-pay-address value=sats]
|
||||
[%recv-pay-address =address value=sats]
|
||||
[%give-pay-address =address value=sats]
|
||||
[%expect-payment =txid value=sats]
|
||||
==
|
||||
:: internal: actions that simply make the state machine more explicit
|
||||
@ -88,7 +88,7 @@
|
||||
::
|
||||
+$ insel [=utxo =chyg =idx]
|
||||
+$ feyb sats
|
||||
+$ txi [=utxo ur=(unit hexb) =hdkey]
|
||||
+$ txi [=utxo rawtx=(unit hexb) =hdkey]
|
||||
+$ txo [=address value=sats hk=(unit hdkey)]
|
||||
+$ txbu
|
||||
$: =xpub
|
||||
|
Loading…
Reference in New Issue
Block a user