btc: remove unnecessary retry logic, send balance in handle-tx-info

This commit is contained in:
pkova 2021-05-07 15:31:53 +03:00 committed by ixv
parent 41685a88c0
commit 6847bf0813
2 changed files with 9 additions and 49 deletions

View File

@ -34,7 +34,6 @@
=piym =piym
=poym =poym
ahistorical-txs=(set txid) ahistorical-txs=(set txid)
mempool-addresses=(jug address condition)
== ==
:: ::
+$ card card:agent:gall +$ card card:agent:gall
@ -79,7 +78,6 @@
*^piym *^piym
*^poym *^poym
~ ~
~
== ==
== ==
:: ::
@ -687,7 +685,6 @@
== ==
;: weld ;: weld
:: (retry-addrs network) :: (retry-addrs network)
retry-mempool-addresses
retry-ahistorical-txs retry-ahistorical-txs
(retry-pend-piym network) (retry-pend-piym network)
== ==
@ -699,13 +696,6 @@
(poke-provider [%tx-info txid]) (poke-provider [%tx-info txid])
:: ::
++ retry-mempool-addresses
^- (list card)
%+ turn
~(tap in ~(key by mempool-addresses))
|= =address
(poke-provider [%address-info address])
::
++ retry-scans ++ retry-scans
|= =network |= =network
^- (list card) ^- (list card)
@ -827,20 +817,6 @@
|= a=address |= a=address
^- card ^- card
(poke-provider [%address-info a]) (poke-provider [%address-info a])
::
=. mempool-addresses
%+ roll inputs.ti
|= [=val:tx out=_mempool-addresses]
?: (is-our-address address.val)
(~(put ju out) address.val [%exclude txid.val])
out
=. mempool-addresses
%+ roll outputs.ti
|= [=val:tx out=_mempool-addresses]
?: (is-our-address address.val)
(~(put ju out) address.val [%include txid.val])
out
::
?: =(0 ~(wyt in our-addrs)) `state ?: =(0 ~(wyt in our-addrs)) `state
=/ =xpub =/ =xpub
xpub.w:(need (address-coords:bl (snag 0 ~(tap in our-addrs)) ~(val by walts))) xpub.w:(need (address-coords:bl (snag 0 ~(tap in our-addrs)) ~(val by walts)))
@ -848,17 +824,20 @@
=/ new-hest=hest (mk-hest xpub our-inputs our-outputs) =/ new-hest=hest (mk-hest xpub our-inputs our-outputs)
=. history (~(put by history) txid.ti new-hest) =. history (~(put by history) txid.ti new-hest)
:_ state :_ state
:_ addr-info-cards :_ :_ addr-info-cards
(give-update %new-tx new-hest) (give-update %new-tx new-hest)
(give-update %balance current-balance)
?. included.ti :: tx in history, but not in mempool/blocks ?. included.ti :: tx in history, but not in mempool/blocks
:_ state(history (~(del by history) txid.ti)) :_ state(history (~(del by history) txid.ti))
:_ addr-info-cards :_ :_ addr-info-cards
(give-update %cancel-tx txid.ti) (give-update %cancel-tx txid.ti)
(give-update %balance current-balance)
=/ new-hest u.h(confs confs.ti, recvd recvd.ti) =/ new-hest u.h(confs confs.ti, recvd recvd.ti)
=. history (~(put by history) txid.ti new-hest) =. history (~(put by history) txid.ti new-hest)
:_ state :_ state
:_ addr-info-cards :_ :_ addr-info-cards
(give-update %new-tx new-hest) (give-update %new-tx new-hest)
(give-update %balance current-balance)
:: ::
++ mk-hest ++ mk-hest
:: has tx-info :: has tx-info
@ -909,20 +888,6 @@
=/ ac (address-coords:bl address ~(val by walts)) =/ ac (address-coords:bl address ~(val by walts))
?~ ac ?~ ac
`state `state
::
=/ cons=(set condition) (~(get ju mempool-addresses) address)
=/ new-cons=(set condition)
%- silt
%+ skip ~(tap in cons)
|= =condition
?: =(%include -.condition)
(~(any in utxos) |=(=utxo =(txid.utxo txid.condition)))
(~(all in utxos) |=(=utxo !=(txid.utxo txid.condition)))
=. mempool-addresses
?~ new-cons
(~(del by mempool-addresses) address)
(~(put by mempool-addresses) address new-cons)
::
=/ [w=walt =chyg =idx] u.ac =/ [w=walt =chyg =idx] u.ac
=. walts =. walts
%+ ~(put by walts) xpub.w %+ ~(put by walts) xpub.w
@ -939,7 +904,6 @@
[cad ah] [cad ah]
:- [(poke-provider [%tx-info txid.u]) cad] :- [(poke-provider [%tx-info txid.u]) cad]
(~(put by ah) txid.u) (~(put by ah) txid.u)
=. cards (snoc cards (give-update %balance current-balance))
:: if the wallet+chyg is being scanned, update the scan batch :: if the wallet+chyg is being scanned, update the scan batch
:: ::
=/ b (~(get by scans) [xpub.w chyg]) =/ b (~(get by scans) [xpub.w chyg])

View File

@ -138,8 +138,4 @@
[%balance balance=(unit [confirmed=sats unconfirmed=sats])] [%balance balance=(unit [confirmed=sats unconfirmed=sats])]
== ==
:: ::
+$ condition
$% [%exclude =txid]
[%include =txid]
==
-- --