From 6847bf0813f00d0889da4d75fcf8b7e44189c159 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 7 May 2021 15:31:53 +0300 Subject: [PATCH] btc: remove unnecessary retry logic, send balance in handle-tx-info --- pkg/arvo/app/btc-wallet.hoon | 54 ++++++------------------------------ pkg/arvo/sur/btc-wallet.hoon | 4 --- 2 files changed, 9 insertions(+), 49 deletions(-) diff --git a/pkg/arvo/app/btc-wallet.hoon b/pkg/arvo/app/btc-wallet.hoon index c07d7816ff..414dec956b 100644 --- a/pkg/arvo/app/btc-wallet.hoon +++ b/pkg/arvo/app/btc-wallet.hoon @@ -34,7 +34,6 @@ =piym =poym ahistorical-txs=(set txid) - mempool-addresses=(jug address condition) == :: +$ card card:agent:gall @@ -79,7 +78,6 @@ *^piym *^poym ~ - ~ == == :: @@ -687,7 +685,6 @@ == ;: weld :: (retry-addrs network) - retry-mempool-addresses retry-ahistorical-txs (retry-pend-piym network) == @@ -699,13 +696,6 @@ (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 |= =network ^- (list card) @@ -827,20 +817,6 @@ |= a=address ^- card (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 =/ =xpub 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) =. history (~(put by history) txid.ti new-hest) :_ state - :_ addr-info-cards - (give-update %new-tx new-hest) + :_ :_ addr-info-cards + (give-update %new-tx new-hest) + (give-update %balance current-balance) ?. included.ti :: tx in history, but not in mempool/blocks :_ state(history (~(del by history) txid.ti)) - :_ addr-info-cards - (give-update %cancel-tx txid.ti) + :_ :_ addr-info-cards + (give-update %cancel-tx txid.ti) + (give-update %balance current-balance) =/ new-hest u.h(confs confs.ti, recvd recvd.ti) =. history (~(put by history) txid.ti new-hest) :_ state - :_ addr-info-cards - (give-update %new-tx new-hest) + :_ :_ addr-info-cards + (give-update %new-tx new-hest) + (give-update %balance current-balance) :: ++ mk-hest :: has tx-info @@ -909,20 +888,6 @@ =/ ac (address-coords:bl address ~(val by walts)) ?~ ac `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 =. walts %+ ~(put by walts) xpub.w @@ -939,7 +904,6 @@ [cad ah] :- [(poke-provider [%tx-info txid.u]) cad] (~(put by ah) txid.u) - =. cards (snoc cards (give-update %balance current-balance)) :: if the wallet+chyg is being scanned, update the scan batch :: =/ b (~(get by scans) [xpub.w chyg]) diff --git a/pkg/arvo/sur/btc-wallet.hoon b/pkg/arvo/sur/btc-wallet.hoon index cc1a6f8f79..bcb86e50bc 100644 --- a/pkg/arvo/sur/btc-wallet.hoon +++ b/pkg/arvo/sur/btc-wallet.hoon @@ -138,8 +138,4 @@ [%balance balance=(unit [confirmed=sats unconfirmed=sats])] == :: -+$ condition - $% [%exclude =txid] - [%include =txid] - == --