wrote %expect-payment

This commit is contained in:
timlucmiptev 2020-12-07 16:31:48 +02:00 committed by ixv
parent f806f5f23a
commit 79a389a0c0
4 changed files with 37 additions and 9 deletions

View File

@ -199,14 +199,25 @@
:: add to wallet-store history
:: send message to peer
`state
::
%expect-payment
::TODO
:: - check that src.bowl isn't past piym-limit in pend-piym
:: - check that payment is in piym
:: - add to pend-piym
:: - retry pend-piym
`state
:: - send tx-info to provider (poke)
::
%expect-payment
~|("Too many %expect-payment sent, or payer+value not found in incoming payments")
=+ num-pend (~(gut by num.pend-piym) payer.act 0)
?> (gte piym-limit num-pend)
=+ pay=(~(get by ps.piym) payer.act)
?~ pay !!
?> ?& =(payer.u.pay payer.act)
=(value.u.pay value.act)
==
:- ~[(get-tx-info txid.act)]
%= state
ps.pend-piym (~(put by ps.pend-piym) txid u.pay)
num.pend-piym +(num-pend)
==
::
%clear-poym
`state(poym ~)
@ -390,6 +401,14 @@
%poke %btc-provider-action !>([ri %raw-tx txid])
==
::
++ get-tx-info
|= [host=ship =txid]
^- card
=/ ri=req-id:bp (gen-req-id:bp eny.bowl)
:* %pass /[(scot %da now.bowl)] %agent [host %btc-provider]
%poke %btc-provider-action !>([ri %tx-info txid])
==
::
++ provider-connected
^- ?
?~ provider %.n

View File

@ -120,8 +120,10 @@
(update-address +.act)
::
%tx-info
:: TODO: update history as these come. Check confs
:: if address in wach and confs low and this txid not there, request %address-info
:: TODO:
:: - check whether this txid in any hest map
:: - update history as these come. Check confs
:: - if address in wach and confs low and this txid not there, request %address-info
`state
::
%generate-address
@ -136,6 +138,13 @@
?~ t ~&(>>> "btc-wallet-store: insufficient balance" `state)
:_ state
~[(send-update [%generate-txbu xpub.act u.t])]
::
%add-history-entry
:: TODO
:: - create map for xpub if doesn't exist
:: - add the hest
:: - send a tx-info request out
`state
==
:: wallet scan algorithm:
:: Initiate a batch for each chyg, with max-gap idxs in it

View File

@ -34,7 +34,7 @@
[%gen-pay-address value=sats]
[%ret-pay-address =address payer=ship value=sats]
[%broadcast-tx signed-psbt=cord]
[%expect-payment payer=ship value=sats]
[%expect-payment =txid payer=ship value=sats]
[%clear-poym ~]
[%force-retry ~]
==

View File

@ -91,7 +91,7 @@
[%address-info =xpub =chyg =idx utxos=(set utxo) used=? block=@ud]
[%generate-address =xpub =chyg =peta]
[%generate-txbu =xpub payee=(unit ship) feyb=sats txos=(list txo)]
[%add-history-entry =hest]
[%add-history-entry =xpub =hest]
==
::
+$ update