Merge pull request #5076 from timlucmiptev/release/bitcoin-wallet

scan-progress added
This commit is contained in:
~timluc-miptev 2021-07-02 10:07:50 +03:00 committed by GitHub
commit 8de3d1b2c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 4 deletions

View File

@ -210,7 +210,8 @@
[(silt (gulf 0 endpoint)) endpoint %.n]
=^ cards0 state (req-scan:hc b xpub %0)
=^ cards1 state (req-scan:hc b xpub %1)
[(weld cards0 cards1) state]
:_ state
[(scan-progress:hc xpub) (weld cards0 cards1)]
--
::
%delete-wallet
@ -602,7 +603,7 @@
(turn inputs.ti |=(i=val:tx [i `payer]))
%+ turn outputs.ti
|= o=val:tx
?: =(pos.o vout)
?: =(pos.o vout)
:: check whether this is the output that went to payee
[o payee]
[o `payer]
@ -964,7 +965,8 @@
(bump-batch xpub %0)
=^ cards1=(list card) state
(bump-batch xpub %1)
[(weld cards0 cards1) state]
:_ state
[(scan-progress:hc xpub) (weld cards0 cards1)]
::
:: delete the xpub from scans and set wallet to scanned
::
@ -977,7 +979,9 @@
walts (~(put by walts) xpub w(scanned %.y))
==
%- (slog ~[leaf+"Scanned xpub {<xpub>}"])
(set-curr-xpub:hc xpub)
=^ cards state
(set-curr-xpub:hc xpub)
[[(give-update:hc [%scan-progress ~ ~]) cards] state]
::
:: +bump-batch
:: if the batch is done but the wallet isn't done scanning,
@ -1218,6 +1222,21 @@
^- card
[%give %fact ~[/all] %btc-wallet-update !>(upd)]
::
++ scan-progress
|= [=xpub:bc]
|^ ^- card
%- give-update
:+ %scan-progress
(to-idx (~(gut by scans.state) [xpub %0] *batch))
(to-idx (~(gut by scans.state) [xpub %1] *batch))
++ to-idx
|= b=batch
^- (unit idx:bc)
=/ s=(list idx:bc)
(sort ~(tap in todo.b) lth)
?~ s ~ `i.s
--
::
++ watch-provider
|= who=@p
^- card

View File

@ -110,6 +110,7 @@
%cancel-tx (hexb txid.upd)
%new-address (address address.upd)
%balance (balance balance.upd)
%scan-progress (scan-progress main.upd change.upd)
%error s+error.upd
%broadcast-success ~
==
@ -161,6 +162,19 @@
unconfirmed+(numb q.u.b)
==
::
++ scan-progress
|= [main=(unit idx:bitcoin) change=(unit idx:bitcoin)]
|^ ^- json
%- pairs
:~ main+(from-unit main)
change+(from-unit change)
==
++ from-unit
|= i=(unit idx:bitcoin)
?~ i ~
(numb u.i)
--
::
++ btc-state
|= bs=btc-state:btc-wallet
^- json

View File

@ -162,6 +162,10 @@
[%new-address =address]
[%balance balance=(unit [confirmed=sats unconfirmed=sats])]
[%error =error]
:: current index being scanned in each wallet part
:: ~ if scan of that part is done
::
[%scan-progress main=(unit idx) change=(unit idx)]
==
::
--