support for only doing witness part

This commit is contained in:
timlucmiptev 2020-12-15 11:35:33 +02:00 committed by ixv
parent 741093a588
commit 6a4ebcf239
2 changed files with 13 additions and 6 deletions

View File

@ -108,7 +108,7 @@
=/ outs=(list out:psbt:btc)
%+ turn txos.t
|=(=txo [address.txo hk.txo])
`(encode:pbt:btc get-rawtx get-txid ins outs)
`(encode:pbt:btc %.y get-rawtx get-txid ins outs)
--
:: wad: door for processing walts (wallets)
:: parameterized on a walt and it's chyg account

View File

@ -193,10 +193,12 @@
==
::
++ input
|= i=in:psbt
|= [only-witness=? i=in:psbt]
^- map:psbt
:~ [[1 0x0] rawtx.i]
(witness-tx i)
%+ weld
?: only-witness ~
~[[1^0x0 rawtx.i]]
:~ (witness-tx i)
(hdkey %input hdkey.i)
==
::
@ -262,9 +264,14 @@
%- en:base64:mimes:html
(flip:byt b)
:: +encode: make base64 cord of PSBT
:: - only-witness: don't include non-witness UTXO
::
++ encode
|= [=rawtx =txid inputs=(list in:psbt) outputs=(list out:psbt)]
|= $: only-witness=?
=rawtx =txid
inputs=(list in:psbt)
outputs=(list out:psbt)
==
^- base64:psbt
=/ sep=(unit bytc) `1^0x0
=/ final=(list (unit bytc))
@ -272,7 +279,7 @@
%+ turn
%- zing
:~ ~[(globals:en rawtx)]
(turn inputs input:en)
(turn inputs (cury input:en only-witness))
(turn outputs output:en)
==
map-byts:en