WIP: return txid in %raw-tx

This commit is contained in:
timlucmiptev 2020-11-20 15:22:24 +02:00 committed by ixv
parent 484e4cc1f8
commit 1a972b1a97
5 changed files with 23 additions and 12 deletions

View File

@ -164,7 +164,7 @@
[%raw-tx @ *]
?> ?=([%get-raw-tx *] resp)
:_ state
~[(send-update [%.y (get-req-id wire) %raw-tx rawtx.resp])]
~[(send-update [%.y (get-req-id wire) %raw-tx +.resp])]
::
[%ping @ *]
?> ?=([%get-block-and-fee *] resp)

View File

@ -33,7 +33,6 @@
def-wallet=(unit xpub)
moon-limit=@ud
=pend-addr
=pend-txbu
=piym
=poym
=piym-watch
@ -191,6 +190,7 @@
==
::
%raw-tx
:: TODO: check whether in poym
~& >> rawtx.body.p.upd
`state
==
@ -225,10 +225,11 @@
:: txbus can potentially use the same UTXO inputs, so if another payment
:: was in process of fetching raw-txs for a txbu, replace it
::
=/ ri=req-id:bp (gen-req-id:bp eny.bowl)
:_ state(poym [ri payee.upd txbu.upd])
=/ txids=(list txid)
%+ turn txis.txbu.upd
|= =txi:bws txid.utxo.txi
:_ state(poym [payee.upd txbu.upd])
:: TODO: send all its input tx-ids out for feedback
~
::
%scan-done
?~ def-wallet
@ -269,11 +270,20 @@
(get-address-info ri host.u.provider a.req)
::
++ get-address-info
|= [ri=req-id:bp host=ship a=address] ^- card
|= [ri=req-id:bp host=ship a=address]
^- card
:* %pass /[(scot %da now.bowl)] %agent [host %btc-provider]
%poke %btc-provider-action !>([ri %address-info a])
==
::
++ get-raw-tx
|= [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 %raw-tx txid)
==
::
++ provider-connected
^- ?
?~ provider %.n

View File

@ -95,7 +95,10 @@
[%value ni:dejs:format]
==
++ raw-tx
(cu:dejs:format to-btc-byts so:dejs:format)
%- ot:dejs:format
:~ [%txid (cu:dejs:format to-hash256 so:dejs:format)]
[%rawtx (cu:dejs:format to-btc-byts so:dejs:format)]
==
++ block-and-fee
%- ot:dejs:format
:~ [%blockcount ni:dejs:format]

View File

@ -15,7 +15,7 @@
+$ result [=req-id body=result-body]
+$ result-body
$% [%address-info utxos=(set utxo) used=? blockcount=@ud]
[%raw-tx =rawtx]
[%raw-tx =txid =rawtx]
==
+$ error
$% [%not-connected status=@ud]
@ -41,7 +41,7 @@
::
+$ response
$% [%get-address-info utxos=(set utxo) used=? blockcount=@ud]
[%get-raw-tx =rawtx]
[%get-raw-tx =txid =rawtx]
[%get-block-count blockcount=@ud]
[%get-block-and-fee blockcount=@ud fee=sats]
==

View File

@ -2,7 +2,6 @@
|%
:: req-id: hash of [xpub chyg idx]
:: pend: lookup of req-id -> requests from wallet-store
:: pend-txbu: lookup req-id -> txbu (to fetch and assoc rawtx info with txid)
::
:: payment: a payment expected from another ship
:: - address: address generated for this payment
@ -14,12 +13,11 @@
::
+$ btc-state [blockcount=@ud fee=sats t=@da]
+$ pend-addr (map req-id:bp request:bws)
+$ pend-txbu (map req-id:bp ship)
::
+$ payment [=address payer=ship value=sats]
::
+$ piym (jar ship payment)
+$ poym [=req-id:bp payee=(unit ship) =txbu:bws]
+$ poym [payee=(unit ship) =txbu]
+$ piym-watch (map address ship)
+$ poym-watch (map address ship)
::