compiling TX processing

This commit is contained in:
timlucmiptev 2020-12-17 17:28:42 +02:00 committed by ixv
parent 5ace317a61
commit 4a83460333
3 changed files with 23 additions and 14 deletions

View File

@ -300,7 +300,7 @@
(poym-to-history ti)
`state
:_ state
[(poke-wallet-store [%tx-info ti]) cards]
[(poke-wallet-store [%tx-info ti block.btc-state]) cards]
::
:: %raw-tx
:: - if the req-id is for current poym, add txid/rawtx to the poym
@ -501,9 +501,7 @@
^- card
%- poke-wallet-store
:* %add-history-entry
xpub
:: hest
txid.ti confs.ti recvd.ti
xpub txid.ti confs.ti recvd.ti
(turn inputs.ti |=(i=val:tx [i `payer]))
%+ turn outputs.ti
|= o=val:tx

View File

@ -115,16 +115,27 @@
%address-info
:: TODO
:: if blank address we're watching gets a value
:: "blank" = unused
:: add it to history
:: send a %tx-info request
(update-address +.act)
:: %txinfo
:: - check whether this txid is in history
:: - if yes, update its confs and received
:: - request info on the tx again if not enough confs
::
%tx-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
=* ti info.act
=+ h=(~(get by history) txid.ti)
?~ h `state
=+ w=(~(get by walts) xpub.u.h)
?~ w `state
=. history
%+ ~(put by history) txid.ti
u.h(confs confs.ti, recvd recvd.ti)
:_ state
?: (gte confs.ti confs.u.w) ~
~[(send-request ~[requests-path] [%tx-info block.act txid.ti])]
::
%generate-address
(generate-address +.act)
@ -139,7 +150,6 @@
:: - send a request for info on the address (watch it)
:: - DON'T send an address update for the address, since it's change
::
:: TODO: end to end tests
%generate-txbu
=+ uw=(~(get by walts) xpub.act)
?~ uw

View File

@ -64,13 +64,14 @@
:: hest: an entry in the history log
::
+$ hest
$: =txid
$: =xpub
=txid
confs=@ud
recvd=(unit @da)
inputs=(list [=val:tx s=(unit ship)])
outputs=(list [=val:tx s=(unit ship)])
==
+$ history (map xpub (map txid hest))
+$ history (map txid hest)
:: state/watch variables:
:: scanning addresses and monitoring generated addresses
:: batch: indexes to scan for a given chyg
@ -89,10 +90,10 @@
+$ action
$% [%add-wallet =xpub =fprint scan-to=(unit scon) max-gap=(unit @ud) confs=(unit @ud)]
[%address-info =xpub =chyg =idx utxos=(set utxo) used=? block=@ud]
[%tx-info =info:tx]
[%tx-info =info:tx block=@ud]
[%generate-address =xpub =chyg =peta]
[%generate-txbu =xpub payee=(unit ship) feyb=sats txos=(list txo)]
[%add-history-entry =xpub =hest]
[%add-history-entry =hest]
==
::
+$ update