mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
multi: bump btcd to taproot aware version
This commit is contained in:
parent
0dcaa511a2
commit
72c9582b85
@ -1440,7 +1440,7 @@ func (b *BreachArbiter) sweepSpendableOutputsTxn(txWeight int64,
|
|||||||
|
|
||||||
// Create a sighash cache to improve the performance of hashing and
|
// Create a sighash cache to improve the performance of hashing and
|
||||||
// signing SigHashAll inputs.
|
// signing SigHashAll inputs.
|
||||||
hashCache := txscript.NewTxSigHashes(txn)
|
hashCache := input.NewTxSigHashesV0Only(txn)
|
||||||
|
|
||||||
// Create a closure that encapsulates the process of initializing a
|
// Create a closure that encapsulates the process of initializing a
|
||||||
// particular output's witness generation function, computing the
|
// particular output's witness generation function, computing the
|
||||||
|
@ -1377,7 +1377,7 @@ func getSpendTransactions(signer input.Signer, chanPoint *wire.OutPoint,
|
|||||||
// sign and add the witness to the HTLC sweep.
|
// sign and add the witness to the HTLC sweep.
|
||||||
retInfo := newRetributionInfo(chanPoint, retribution)
|
retInfo := newRetributionInfo(chanPoint, retribution)
|
||||||
|
|
||||||
hashCache := txscript.NewTxSigHashes(htlcSweep)
|
hashCache := input.NewTxSigHashesV0Only(htlcSweep)
|
||||||
for i := range retInfo.breachedOutputs {
|
for i := range retInfo.breachedOutputs {
|
||||||
inp := &retInfo.breachedOutputs[i]
|
inp := &retInfo.breachedOutputs[i]
|
||||||
|
|
||||||
|
15
go.mod
15
go.mod
@ -4,15 +4,16 @@ require (
|
|||||||
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect
|
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect
|
||||||
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82
|
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82
|
||||||
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344
|
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344
|
||||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220207191057-4dc4ff7963b4
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220316175102-8d5c75c28923
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0
|
github.com/btcsuite/btcd/btcec/v2 v2.1.3
|
||||||
github.com/btcsuite/btcd/btcutil v1.1.0
|
github.com/btcsuite/btcd/btcutil v1.1.1
|
||||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.0
|
github.com/btcsuite/btcd/btcutil/psbt v1.1.1
|
||||||
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
||||||
github.com/btcsuite/btcwallet v0.14.0
|
github.com/btcsuite/btcwallet v0.14.1-0.20220322182735-b0001c262734
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.1
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3
|
||||||
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
|
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
|
||||||
github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec
|
github.com/btcsuite/btcwallet/walletdb v1.4.0
|
||||||
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
|
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
|
||||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
|
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
|
31
go.sum
31
go.sum
@ -73,39 +73,46 @@ github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcug
|
|||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
||||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220204213055-eaf0459ff879/go.mod h1:osu7EoKiL36UThEgzYPqdRaxeo0NU8VoXqgcnwpey0g=
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220204213055-eaf0459ff879/go.mod h1:osu7EoKiL36UThEgzYPqdRaxeo0NU8VoXqgcnwpey0g=
|
||||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220207191057-4dc4ff7963b4 h1:CEGr/598C/0LZQUoioaT6sdGGcJgu4+ck0PDeJ/QkKs=
|
|
||||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220207191057-4dc4ff7963b4/go.mod h1:7alexyj/lHlOtr2PJK7L/+HDJZpcGDn/pAU98r7DY08=
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220207191057-4dc4ff7963b4/go.mod h1:7alexyj/lHlOtr2PJK7L/+HDJZpcGDn/pAU98r7DY08=
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0 h1:Whmbo9yShKKG+WrUfYGFfgj77vYBiwhwBSJnM66TMKI=
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220316175102-8d5c75c28923 h1:6H47xWODLXYDuzHapvx4dauPqFjegX4+rHgUkFQPvfw=
|
||||||
|
github.com/btcsuite/btcd v0.22.0-beta.0.20220316175102-8d5c75c28923/go.mod h1:taIcYprAW2g6Z9S0gGUxyR+zDwimyDMK5ePOX+iJ2ds=
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.1.1/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||||
github.com/btcsuite/btcd/btcutil v1.1.0 h1:MO4klnGY+EWJdoWF12Wkuf4AWDBPMpZNeN/jRLrklUU=
|
|
||||||
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
||||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.0 h1:1LxDjz2ar4L2mrviBdxrzxesMMcAtj4nuBlX4FdqjOA=
|
github.com/btcsuite/btcd/btcutil v1.1.1 h1:hDcDaXiP0uEzR8Biqo2weECKqEw0uHDZ9ixIWevVQqY=
|
||||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.0/go.mod h1:xMuACsIKDzcE3kWMxqK+aLrAWZ8bMdn7YjYEwNs5q8k=
|
github.com/btcsuite/btcd/btcutil v1.1.1/go.mod h1:nbKlBMNm9FGsdvKvu0essceubPiAcI57pYBNnsLAa34=
|
||||||
|
github.com/btcsuite/btcd/btcutil/psbt v1.1.1 h1:t8yNrashLB1ZLqOapxtWy/d8jMfMDgwPKwf70sgnSac=
|
||||||
|
github.com/btcsuite/btcd/btcutil/psbt v1.1.1/go.mod h1:KsGzRAzAdEimzgERpK9Xm+RhuCMvc4j2ctK0BEQ8JV0=
|
||||||
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||||
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||||
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
github.com/btcsuite/btcwallet v0.14.0 h1:+Nwf0GkRUwDjd/F3i9HgrRhDp8RHZFbBZ3kQaZr6zD0=
|
github.com/btcsuite/btcwallet v0.14.1-0.20220322182735-b0001c262734 h1:gG2UgzXLiMiT4sw74161AEf0LE/mxDM8Ia6TaoV0VBw=
|
||||||
github.com/btcsuite/btcwallet v0.14.0/go.mod h1:KFR1x3ZH7c31i4qA34XIvcsnhrEBLK1SHli52lN8E54=
|
github.com/btcsuite/btcwallet v0.14.1-0.20220322182735-b0001c262734/go.mod h1:QN2tl1ipATUQRo9RtgvMHLSspqx7QWsj30qL+7AXuAo=
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.1 h1:oxIaFiF8gmOLJh7wNkXYkyLWT7Pj5igSrn5HthPVDYg=
|
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.1/go.mod h1:/74bubxX5Js48d76nf/TsNabpYp/gndUuJw4chzCmhU=
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.1/go.mod h1:/74bubxX5Js48d76nf/TsNabpYp/gndUuJw4chzCmhU=
|
||||||
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3 h1:M2yr5UlULvpqtxUqpMxTME/pA92Z9cpqeyvAFk9lAg0=
|
||||||
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3/go.mod h1:T2xSiKGpUkSLCh68aF+FMXmKK9mFqNdHl9VaqOr+JjU=
|
||||||
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
|
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
|
||||||
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0/go.mod h1:AtkqiL7ccKWxuLYtZm8Bu8G6q82w4yIZdgq6riy60z0=
|
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0/go.mod h1:AtkqiL7ccKWxuLYtZm8Bu8G6q82w4yIZdgq6riy60z0=
|
||||||
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 h1:wZnOolEAeNOHzHTnznw/wQv+j35ftCIokNrnOTOU5o8=
|
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 h1:wZnOolEAeNOHzHTnznw/wQv+j35ftCIokNrnOTOU5o8=
|
||||||
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs=
|
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs=
|
||||||
github.com/btcsuite/btcwallet/walletdb v1.3.5/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
|
github.com/btcsuite/btcwallet/walletdb v1.3.5/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
|
||||||
github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec h1:zcAU3Ij8SmqaE+ITtS76fua2Niq7DRNp46sJRhi8PiI=
|
|
||||||
github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
|
github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
|
||||||
|
github.com/btcsuite/btcwallet/walletdb v1.4.0 h1:/C5JRF+dTuE2CNMCO/or5N8epsrhmSM4710uBQoYPTQ=
|
||||||
|
github.com/btcsuite/btcwallet/walletdb v1.4.0/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
|
||||||
github.com/btcsuite/btcwallet/wtxmgr v1.5.0 h1:WO0KyN4l6H3JWnlFxfGR7r3gDnlGT7W2cL8vl6av4SU=
|
github.com/btcsuite/btcwallet/wtxmgr v1.5.0 h1:WO0KyN4l6H3JWnlFxfGR7r3gDnlGT7W2cL8vl6av4SU=
|
||||||
github.com/btcsuite/btcwallet/wtxmgr v1.5.0/go.mod h1:TQVDhFxseiGtZwEPvLgtfyxuNUDsIdaJdshvWzR0HJ4=
|
github.com/btcsuite/btcwallet/wtxmgr v1.5.0/go.mod h1:TQVDhFxseiGtZwEPvLgtfyxuNUDsIdaJdshvWzR0HJ4=
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw=
|
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw=
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||||
github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc=
|
github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc=
|
||||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
||||||
github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4=
|
|
||||||
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
|
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
|
||||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||||
github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJGQE=
|
|
||||||
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
|
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
||||||
@ -631,6 +638,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
|
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
|
||||||
|
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
|
@ -338,7 +338,7 @@ func MakeHtlcSecondLevelTimeoutAnchorInput(signedTx *wire.MsgTx,
|
|||||||
txinIdx int) (wire.TxWitness, error) {
|
txinIdx int) (wire.TxWitness, error) {
|
||||||
|
|
||||||
desc := signDetails.SignDesc
|
desc := signDetails.SignDesc
|
||||||
desc.SigHashes = txscript.NewTxSigHashes(txn)
|
desc.SigHashes = NewTxSigHashesV0Only(txn)
|
||||||
desc.InputIndex = txinIdx
|
desc.InputIndex = txinIdx
|
||||||
|
|
||||||
return SenderHtlcSpendTimeout(
|
return SenderHtlcSpendTimeout(
|
||||||
|
@ -864,7 +864,7 @@ func HtlcSpendSuccess(signer Signer, signDesc *SignDescriptor,
|
|||||||
|
|
||||||
// As we mutated the transaction, we'll re-calculate the sighashes for
|
// As we mutated the transaction, we'll re-calculate the sighashes for
|
||||||
// this instance.
|
// this instance.
|
||||||
signDesc.SigHashes = txscript.NewTxSigHashes(sweepTx)
|
signDesc.SigHashes = NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
// With the proper sequence and version set, we'll now sign the timeout
|
// With the proper sequence and version set, we'll now sign the timeout
|
||||||
// transaction using the passed signed descriptor. In order to generate
|
// transaction using the passed signed descriptor. In order to generate
|
||||||
|
@ -280,7 +280,7 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
sweepTxSigHashes = txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes = NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
bobSigHash = txscript.SigHashAll
|
bobSigHash = txscript.SigHashAll
|
||||||
if confirmed {
|
if confirmed {
|
||||||
@ -546,9 +546,14 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(htlcPkScript,
|
return txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
htlcPkScript, sweepTx, 0,
|
||||||
nil, int64(paymentAmt))
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
|
int64(paymentAmt),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
htlcPkScript, int64(paymentAmt),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -674,7 +679,7 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
|||||||
Value: 1 * 10e8,
|
Value: 1 * 10e8,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
sweepTxSigHashes = txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes = NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
aliceSigHash = txscript.SigHashAll
|
aliceSigHash = txscript.SigHashAll
|
||||||
if confirmed {
|
if confirmed {
|
||||||
@ -962,9 +967,14 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(htlcPkScript,
|
return txscript.NewEngine(
|
||||||
|
htlcPkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(paymentAmt))
|
nil, int64(paymentAmt),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
htlcPkScript, int64(paymentAmt),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -1014,7 +1024,7 @@ func TestSecondLevelHtlcSpends(t *testing.T) {
|
|||||||
Value: 1 * 10e8,
|
Value: 1 * 10e8,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
// The delay key will be crafted using Bob's public key as the output
|
// The delay key will be crafted using Bob's public key as the output
|
||||||
// we created will be spending from Alice's commitment transaction.
|
// we created will be spending from Alice's commitment transaction.
|
||||||
@ -1165,9 +1175,14 @@ func TestSecondLevelHtlcSpends(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(htlcPkScript,
|
return txscript.NewEngine(
|
||||||
|
htlcPkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(htlcAmt))
|
nil, int64(htlcAmt),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
htlcPkScript, int64(htlcAmt),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -1220,7 +1235,7 @@ func TestLeaseSecondLevelHtlcSpends(t *testing.T) {
|
|||||||
Value: 1 * 10e8,
|
Value: 1 * 10e8,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
// The delay key will be crafted using Bob's public key as the output
|
// The delay key will be crafted using Bob's public key as the output
|
||||||
// we created will be spending from Alice's commitment transaction.
|
// we created will be spending from Alice's commitment transaction.
|
||||||
@ -1400,9 +1415,14 @@ func TestLeaseSecondLevelHtlcSpends(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(htlcPkScript,
|
return txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
htlcPkScript, sweepTx, 0,
|
||||||
nil, int64(htlcAmt))
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
|
int64(htlcAmt),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
htlcPkScript, int64(htlcAmt),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -1472,7 +1492,7 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
// Bob can spend with his revocation key, but not
|
// Bob can spend with his revocation key, but not
|
||||||
// without the proper tweak.
|
// without the proper tweak.
|
||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
PubKey: bobKeyPub,
|
PubKey: bobKeyPub,
|
||||||
@ -1494,7 +1514,7 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
// Bob can spend with his revocation key with the proper
|
// Bob can spend with his revocation key with the proper
|
||||||
// tweak.
|
// tweak.
|
||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
PubKey: bobKeyPub,
|
PubKey: bobKeyPub,
|
||||||
@ -1521,7 +1541,7 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
||||||
false, csvDelay/2,
|
false, csvDelay/2,
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
PubKey: aliceKeyPub,
|
PubKey: aliceKeyPub,
|
||||||
@ -1548,7 +1568,7 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
||||||
false, csvDelay,
|
false, csvDelay,
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
PubKey: aliceKeyPub,
|
PubKey: aliceKeyPub,
|
||||||
@ -1575,7 +1595,7 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
||||||
false, csvDelay,
|
false, csvDelay,
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
PubKey: aliceKeyPub,
|
PubKey: aliceKeyPub,
|
||||||
@ -1599,9 +1619,14 @@ func TestLeaseCommmitSpendToSelf(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(commitPkScript,
|
return txscript.NewEngine(
|
||||||
|
commitPkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(outputVal))
|
nil, int64(outputVal),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
commitPkScript, int64(outputVal),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -1659,7 +1684,7 @@ func TestCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
// Alice can spend after the a CSV delay has passed.
|
// Alice can spend after the a CSV delay has passed.
|
||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTx.TxIn[0].Sequence = LockTimeToSequence(false, 1)
|
sweepTx.TxIn[0].Sequence = LockTimeToSequence(false, 1)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1681,7 +1706,7 @@ func TestCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
// Alice cannot spend output without sequence set.
|
// Alice cannot spend output without sequence set.
|
||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1705,9 +1730,14 @@ func TestCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(commitPkScript,
|
return txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
commitPkScript, sweepTx, 0,
|
||||||
nil, int64(outputVal))
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
|
int64(outputVal),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
commitPkScript, int64(outputVal),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
@ -1770,7 +1800,7 @@ func TestLeaseCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
sweepTx.TxIn[0].Sequence = LockTimeToSequence(
|
||||||
false, 1,
|
false, 1,
|
||||||
)
|
)
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1795,7 +1825,7 @@ func TestLeaseCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTx.LockTime = leaseExpiry
|
sweepTx.LockTime = leaseExpiry
|
||||||
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1820,7 +1850,7 @@ func TestLeaseCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTx.LockTime = 0
|
sweepTx.LockTime = 0
|
||||||
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1849,6 +1879,9 @@ func TestLeaseCommitSpendToRemoteConfirmed(t *testing.T) {
|
|||||||
commitPkScript, sweepTx, 0,
|
commitPkScript, sweepTx, 0,
|
||||||
txscript.StandardVerifyFlags, nil, nil,
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
int64(outputVal),
|
int64(outputVal),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
commitPkScript, int64(outputVal),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1913,7 +1946,7 @@ func TestSpendAnchor(t *testing.T) {
|
|||||||
// Alice can spend immediately.
|
// Alice can spend immediately.
|
||||||
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
makeWitnessTestCase(t, func() (wire.TxWitness, error) {
|
||||||
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
sweepTx.TxIn[0].Sequence = wire.MaxTxInSequenceNum
|
||||||
sweepTxSigHashes := txscript.NewTxSigHashes(sweepTx)
|
sweepTxSigHashes := NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
signDesc := &SignDescriptor{
|
signDesc := &SignDescriptor{
|
||||||
KeyDesc: keychain.KeyDescriptor{
|
KeyDesc: keychain.KeyDescriptor{
|
||||||
@ -1953,9 +1986,14 @@ func TestSpendAnchor(t *testing.T) {
|
|||||||
sweepTx.TxIn[0].Witness = testCase.witness()
|
sweepTx.TxIn[0].Witness = testCase.witness()
|
||||||
|
|
||||||
newEngine := func() (*txscript.Engine, error) {
|
newEngine := func() (*txscript.Engine, error) {
|
||||||
return txscript.NewEngine(anchorPkScript,
|
return txscript.NewEngine(
|
||||||
|
anchorPkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(anchorSize))
|
nil, int64(anchorSize),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
anchorPkScript, int64(anchorSize),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEngineExecution(t, i, testCase.valid, newEngine)
|
assertEngineExecution(t, i, testCase.valid, newEngine)
|
||||||
|
20
input/taproot.go
Normal file
20
input/taproot.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package input
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewTxSigHashesV0Only returns a new txscript.TxSigHashes instance that will
|
||||||
|
// only calculate the sighash midstate values for segwit v0 inputs and can
|
||||||
|
// therefore never be used for transactions that want to spend segwit v1
|
||||||
|
// (taproot) inputs.
|
||||||
|
func NewTxSigHashesV0Only(tx *wire.MsgTx) *txscript.TxSigHashes {
|
||||||
|
// The canned output fetcher returns a wire.TxOut instance with the
|
||||||
|
// given pk script and amount. We can get away with nil since the first
|
||||||
|
// thing the TxSigHashes constructor checks is the length of the pk
|
||||||
|
// script and whether it matches taproot output script length. If the
|
||||||
|
// length doesn't match it assumes v0 inputs only.
|
||||||
|
nilFetcher := txscript.NewCannedPrevOutputFetcher(nil, 0)
|
||||||
|
return txscript.NewTxSigHashes(tx, nilFetcher)
|
||||||
|
}
|
@ -266,7 +266,7 @@ func (s *Server) SignOutputRaw(ctx context.Context, in *SignReq) (*SignResp,
|
|||||||
return nil, fmt.Errorf("unable to decode tx: %v", err)
|
return nil, fmt.Errorf("unable to decode tx: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigHashCache := txscript.NewTxSigHashes(&txToSign)
|
sigHashCache := input.NewTxSigHashesV0Only(&txToSign)
|
||||||
|
|
||||||
log.Debugf("Generating sigs for %v inputs: ", len(in.SignDescs))
|
log.Debugf("Generating sigs for %v inputs: ", len(in.SignDescs))
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ func (s *Server) ComputeInputScript(ctx context.Context,
|
|||||||
return nil, fmt.Errorf("unable to decode tx: %v", err)
|
return nil, fmt.Errorf("unable to decode tx: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigHashCache := txscript.NewTxSigHashes(&txToSign)
|
sigHashCache := input.NewTxSigHashesV0Only(&txToSign)
|
||||||
|
|
||||||
signDescs := make([]*input.SignDescriptor, 0, len(in.SignDescs))
|
signDescs := make([]*input.SignDescriptor, 0, len(in.SignDescs))
|
||||||
for _, signDesc := range in.SignDescs {
|
for _, signDesc := range in.SignDescs {
|
||||||
|
@ -107,7 +107,7 @@ func (b *BtcWallet) SignPsbt(packet *psbt.Packet) error {
|
|||||||
// there are inputs that we don't know how to sign, we won't return any
|
// there are inputs that we don't know how to sign, we won't return any
|
||||||
// error. So it's possible we're not the final signer.
|
// error. So it's possible we're not the final signer.
|
||||||
tx := packet.UnsignedTx
|
tx := packet.UnsignedTx
|
||||||
sigHashes := txscript.NewTxSigHashes(tx)
|
sigHashes := input.NewTxSigHashesV0Only(tx)
|
||||||
for idx := range tx.TxIn {
|
for idx := range tx.TxIn {
|
||||||
in := packet.Inputs[idx]
|
in := packet.Inputs[idx]
|
||||||
|
|
||||||
|
@ -330,6 +330,9 @@ func TestSignPsbt(t *testing.T) {
|
|||||||
refTx.TxOut[0].PkScript, finalTx, 0,
|
refTx.TxOut[0].PkScript, finalTx, 0,
|
||||||
txscript.StandardVerifyFlags, nil, nil,
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
refTx.TxOut[0].Value,
|
refTx.TxOut[0].Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
refTx.TxOut[0].PkScript, refTx.TxOut[0].Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, vm.Execute())
|
require.NoError(t, vm.Execute())
|
||||||
|
@ -109,7 +109,7 @@ func (f *FullIntent) CompileFundingTx(extraInputs []*wire.TxIn,
|
|||||||
// order of the inputs.
|
// order of the inputs.
|
||||||
signDesc := input.SignDescriptor{
|
signDesc := input.SignDescriptor{
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(fundingTx),
|
SigHashes: input.NewTxSigHashesV0Only(fundingTx),
|
||||||
}
|
}
|
||||||
for i, txIn := range fundingTx.TxIn {
|
for i, txIn := range fundingTx.TxIn {
|
||||||
// We can only sign this input if it's ours, so we'll ask the
|
// We can only sign this input if it's ours, so we'll ask the
|
||||||
|
@ -3044,7 +3044,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
|||||||
WitnessScript: htlc.theirWitnessScript,
|
WitnessScript: htlc.theirWitnessScript,
|
||||||
Output: txOut,
|
Output: txOut,
|
||||||
HashType: sigHashType,
|
HashType: sigHashType,
|
||||||
SigHashes: txscript.NewTxSigHashes(sigJob.Tx),
|
SigHashes: input.NewTxSigHashesV0Only(sigJob.Tx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
sigJob.OutputIndex = htlc.remoteOutputIndex
|
sigJob.OutputIndex = htlc.remoteOutputIndex
|
||||||
@ -3098,7 +3098,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
|||||||
WitnessScript: htlc.theirWitnessScript,
|
WitnessScript: htlc.theirWitnessScript,
|
||||||
Output: txOut,
|
Output: txOut,
|
||||||
HashType: sigHashType,
|
HashType: sigHashType,
|
||||||
SigHashes: txscript.NewTxSigHashes(sigJob.Tx),
|
SigHashes: input.NewTxSigHashesV0Only(sigJob.Tx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
sigJob.OutputIndex = htlc.remoteOutputIndex
|
sigJob.OutputIndex = htlc.remoteOutputIndex
|
||||||
@ -3610,7 +3610,7 @@ func (lc *LightningChannel) SignNextCommitment() (lnwire.Sig, []lnwire.Sig,
|
|||||||
// While the jobs are being carried out, we'll Sign their version of
|
// While the jobs are being carried out, we'll Sign their version of
|
||||||
// the new commitment transaction while we're waiting for the rest of
|
// the new commitment transaction while we're waiting for the rest of
|
||||||
// the HTLC signatures to be processed.
|
// the HTLC signatures to be processed.
|
||||||
lc.signDesc.SigHashes = txscript.NewTxSigHashes(newCommitView.txn)
|
lc.signDesc.SigHashes = input.NewTxSigHashesV0Only(newCommitView.txn)
|
||||||
rawSig, err := lc.Signer.SignOutputRaw(newCommitView.txn, lc.signDesc)
|
rawSig, err := lc.Signer.SignOutputRaw(newCommitView.txn, lc.signDesc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
close(cancelChan)
|
close(cancelChan)
|
||||||
@ -4143,7 +4143,7 @@ func genHtlcSigValidationJobs(localCommitmentView *commitment,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hashCache := txscript.NewTxSigHashes(successTx)
|
hashCache := input.NewTxSigHashesV0Only(successTx)
|
||||||
sigHash, err := txscript.CalcWitnessSigHash(
|
sigHash, err := txscript.CalcWitnessSigHash(
|
||||||
htlc.ourWitnessScript, hashCache,
|
htlc.ourWitnessScript, hashCache,
|
||||||
sigHashType, successTx, 0,
|
sigHashType, successTx, 0,
|
||||||
@ -4198,7 +4198,7 @@ func genHtlcSigValidationJobs(localCommitmentView *commitment,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hashCache := txscript.NewTxSigHashes(timeoutTx)
|
hashCache := input.NewTxSigHashesV0Only(timeoutTx)
|
||||||
sigHash, err := txscript.CalcWitnessSigHash(
|
sigHash, err := txscript.CalcWitnessSigHash(
|
||||||
htlc.ourWitnessScript, hashCache,
|
htlc.ourWitnessScript, hashCache,
|
||||||
sigHashType, timeoutTx, 0,
|
sigHashType, timeoutTx, 0,
|
||||||
@ -4391,7 +4391,7 @@ func (lc *LightningChannel) ReceiveNewCommitment(commitSig lnwire.Sig,
|
|||||||
// this newly proposed state update.
|
// this newly proposed state update.
|
||||||
localCommitTx := localCommitmentView.txn
|
localCommitTx := localCommitmentView.txn
|
||||||
multiSigScript := lc.signDesc.WitnessScript
|
multiSigScript := lc.signDesc.WitnessScript
|
||||||
hashCache := txscript.NewTxSigHashes(localCommitTx)
|
hashCache := input.NewTxSigHashesV0Only(localCommitTx)
|
||||||
sigHash, err := txscript.CalcWitnessSigHash(
|
sigHash, err := txscript.CalcWitnessSigHash(
|
||||||
multiSigScript, hashCache, txscript.SigHashAll,
|
multiSigScript, hashCache, txscript.SigHashAll,
|
||||||
localCommitTx, 0, int64(lc.channelState.Capacity),
|
localCommitTx, 0, int64(lc.channelState.Capacity),
|
||||||
@ -5493,7 +5493,7 @@ func (lc *LightningChannel) getSignedCommitTx() (*wire.MsgTx, error) {
|
|||||||
|
|
||||||
// With this, we then generate the full witness so the caller can
|
// With this, we then generate the full witness so the caller can
|
||||||
// broadcast a fully signed transaction.
|
// broadcast a fully signed transaction.
|
||||||
lc.signDesc.SigHashes = txscript.NewTxSigHashes(commitTx)
|
lc.signDesc.SigHashes = input.NewTxSigHashesV0Only(commitTx)
|
||||||
ourSig, err := lc.Signer.SignOutputRaw(commitTx, lc.signDesc)
|
ourSig, err := lc.Signer.SignOutputRaw(commitTx, lc.signDesc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -5901,7 +5901,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
|||||||
WitnessScript: htlcScript,
|
WitnessScript: htlcScript,
|
||||||
Output: txOut,
|
Output: txOut,
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(timeoutTx),
|
SigHashes: input.NewTxSigHashesV0Only(timeoutTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6036,7 +6036,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
|||||||
WitnessScript: htlcScript,
|
WitnessScript: htlcScript,
|
||||||
Output: txOut,
|
Output: txOut,
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(successTx),
|
SigHashes: input.NewTxSigHashesV0Only(successTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6459,7 +6459,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
|
|||||||
// initiator we'll simply send our signature over to the remote party,
|
// initiator we'll simply send our signature over to the remote party,
|
||||||
// using the generated txid to be notified once the closure transaction
|
// using the generated txid to be notified once the closure transaction
|
||||||
// has been confirmed.
|
// has been confirmed.
|
||||||
lc.signDesc.SigHashes = txscript.NewTxSigHashes(closeTx)
|
lc.signDesc.SigHashes = input.NewTxSigHashesV0Only(closeTx)
|
||||||
sig, err := lc.Signer.SignOutputRaw(closeTx, lc.signDesc)
|
sig, err := lc.Signer.SignOutputRaw(closeTx, lc.signDesc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, err
|
return nil, nil, 0, err
|
||||||
@ -6519,7 +6519,7 @@ func (lc *LightningChannel) CompleteCooperativeClose(
|
|||||||
if err := blockchain.CheckTransactionSanity(tx); err != nil {
|
if err := blockchain.CheckTransactionSanity(tx); err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
hashCache := txscript.NewTxSigHashes(closeTx)
|
hashCache := input.NewTxSigHashesV0Only(closeTx)
|
||||||
|
|
||||||
// Finally, construct the witness stack minding the order of the
|
// Finally, construct the witness stack minding the order of the
|
||||||
// pubkeys+sigs on the stack.
|
// pubkeys+sigs on the stack.
|
||||||
@ -6536,8 +6536,12 @@ func (lc *LightningChannel) CompleteCooperativeClose(
|
|||||||
// Validate the finalized transaction to ensure the output script is
|
// Validate the finalized transaction to ensure the output script is
|
||||||
// properly met, and that the remote peer supplied a valid signature.
|
// properly met, and that the remote peer supplied a valid signature.
|
||||||
prevOut := lc.signDesc.Output
|
prevOut := lc.signDesc.Output
|
||||||
vm, err := txscript.NewEngine(prevOut.PkScript, closeTx, 0,
|
vm, err := txscript.NewEngine(
|
||||||
txscript.StandardVerifyFlags, nil, hashCache, prevOut.Value)
|
prevOut.PkScript, closeTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
|
hashCache, prevOut.Value, txscript.NewCannedPrevOutputFetcher(
|
||||||
|
prevOut.PkScript, prevOut.Value,
|
||||||
|
),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
@ -990,9 +990,14 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
|
|||||||
// the multi-sig clause within the output on the commitment transaction
|
// the multi-sig clause within the output on the commitment transaction
|
||||||
// that produces this HTLC.
|
// that produces this HTLC.
|
||||||
timeoutTx := htlcResolution.SignedTimeoutTx
|
timeoutTx := htlcResolution.SignedTimeoutTx
|
||||||
vm, err := txscript.NewEngine(senderHtlcPkScript,
|
vm, err := txscript.NewEngine(
|
||||||
|
senderHtlcPkScript,
|
||||||
timeoutTx, 0, txscript.StandardVerifyFlags, nil,
|
timeoutTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(htlcAmount.ToSatoshis()))
|
nil, int64(htlcAmount.ToSatoshis()),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
senderHtlcPkScript, int64(htlcAmount.ToSatoshis()),
|
||||||
|
),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
}
|
}
|
||||||
@ -1028,6 +1033,10 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
|
|||||||
htlcResolution.SweepSignDesc.Output.PkScript,
|
htlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, htlcResolution.SweepSignDesc.Output.Value,
|
nil, htlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
htlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
|
htlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
@ -1057,9 +1066,14 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
|
|||||||
// before publication.
|
// before publication.
|
||||||
successTx := inHtlcResolution.SignedSuccessTx
|
successTx := inHtlcResolution.SignedSuccessTx
|
||||||
successTx.TxIn[0].Witness[3] = preimageBob[:]
|
successTx.TxIn[0].Witness[3] = preimageBob[:]
|
||||||
vm, err = txscript.NewEngine(receiverHtlcScript,
|
vm, err = txscript.NewEngine(
|
||||||
|
receiverHtlcScript,
|
||||||
successTx, 0, txscript.StandardVerifyFlags, nil,
|
successTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(htlcAmount.ToSatoshis()))
|
nil, int64(htlcAmount.ToSatoshis()),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
receiverHtlcScript, int64(htlcAmount.ToSatoshis()),
|
||||||
|
),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
}
|
}
|
||||||
@ -1091,6 +1105,10 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
|
|||||||
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, inHtlcResolution.SweepSignDesc.Output.Value,
|
nil, inHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
|
inHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
@ -5978,7 +5996,7 @@ func TestChannelUnilateralCloseHtlcResolution(t *testing.T) {
|
|||||||
Value: outHtlcResolution.SweepSignDesc.Output.Value,
|
Value: outHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
})
|
})
|
||||||
outHtlcResolution.SweepSignDesc.InputIndex = 0
|
outHtlcResolution.SweepSignDesc.InputIndex = 0
|
||||||
outHtlcResolution.SweepSignDesc.SigHashes = txscript.NewTxSigHashes(
|
outHtlcResolution.SweepSignDesc.SigHashes = input.NewTxSigHashesV0Only(
|
||||||
sweepTx,
|
sweepTx,
|
||||||
)
|
)
|
||||||
sweepTx.LockTime = outHtlcResolution.Expiry
|
sweepTx.LockTime = outHtlcResolution.Expiry
|
||||||
@ -5996,6 +6014,10 @@ func TestChannelUnilateralCloseHtlcResolution(t *testing.T) {
|
|||||||
outHtlcResolution.SweepSignDesc.Output.PkScript,
|
outHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, outHtlcResolution.SweepSignDesc.Output.Value,
|
nil, outHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
outHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
|
outHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
@ -6016,7 +6038,7 @@ func TestChannelUnilateralCloseHtlcResolution(t *testing.T) {
|
|||||||
Value: inHtlcResolution.SweepSignDesc.Output.Value,
|
Value: inHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
})
|
})
|
||||||
inHtlcResolution.SweepSignDesc.InputIndex = 0
|
inHtlcResolution.SweepSignDesc.InputIndex = 0
|
||||||
inHtlcResolution.SweepSignDesc.SigHashes = txscript.NewTxSigHashes(
|
inHtlcResolution.SweepSignDesc.SigHashes = input.NewTxSigHashesV0Only(
|
||||||
sweepTx,
|
sweepTx,
|
||||||
)
|
)
|
||||||
sweepTx.TxIn[0].Witness, err = input.SenderHtlcSpendRedeem(
|
sweepTx.TxIn[0].Witness, err = input.SenderHtlcSpendRedeem(
|
||||||
@ -6034,6 +6056,10 @@ func TestChannelUnilateralCloseHtlcResolution(t *testing.T) {
|
|||||||
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, inHtlcResolution.SweepSignDesc.Output.Value,
|
nil, inHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
inHtlcResolution.SweepSignDesc.Output.PkScript,
|
||||||
|
inHtlcResolution.SweepSignDesc.Output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
@ -6151,7 +6177,7 @@ func TestChannelUnilateralClosePendingCommit(t *testing.T) {
|
|||||||
PkScript: testHdSeed[:],
|
PkScript: testHdSeed[:],
|
||||||
Value: aliceSignDesc.Output.Value,
|
Value: aliceSignDesc.Output.Value,
|
||||||
})
|
})
|
||||||
aliceSignDesc.SigHashes = txscript.NewTxSigHashes(sweepTx)
|
aliceSignDesc.SigHashes = input.NewTxSigHashesV0Only(sweepTx)
|
||||||
sweepTx.TxIn[0].Witness, err = input.CommitSpendNoDelay(
|
sweepTx.TxIn[0].Witness, err = input.CommitSpendNoDelay(
|
||||||
aliceChannel.Signer, &aliceSignDesc, sweepTx, false,
|
aliceChannel.Signer, &aliceSignDesc, sweepTx, false,
|
||||||
)
|
)
|
||||||
@ -6165,6 +6191,10 @@ func TestChannelUnilateralClosePendingCommit(t *testing.T) {
|
|||||||
aliceSignDesc.Output.PkScript, sweepTx, 0,
|
aliceSignDesc.Output.PkScript, sweepTx, 0,
|
||||||
txscript.StandardVerifyFlags, nil, nil,
|
txscript.StandardVerifyFlags, nil, nil,
|
||||||
aliceSignDesc.Output.Value,
|
aliceSignDesc.Output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
aliceSignDesc.Output.PkScript,
|
||||||
|
aliceSignDesc.Output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
|
@ -189,6 +189,7 @@ func Validate(ctx *Context) (*wire.OutPoint, error) {
|
|||||||
vm, err := txscript.NewEngine(
|
vm, err := txscript.NewEngine(
|
||||||
ctx.MultiSigPkScript, ctx.CommitCtx.FullySignedCommitTx,
|
ctx.MultiSigPkScript, ctx.CommitCtx.FullySignedCommitTx,
|
||||||
0, txscript.StandardVerifyFlags, nil, nil, fundingValue,
|
0, txscript.StandardVerifyFlags, nil, nil, fundingValue,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(ctx.MultiSigPkScript, 0),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -98,7 +98,7 @@ func newChannelTestCtx(chanSize int64) (*channelTestCtx, error) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
sigHashes := txscript.NewTxSigHashes(commitTx)
|
sigHashes := input.NewTxSigHashesV0Only(commitTx)
|
||||||
aliceSigRaw, err := txscript.RawTxInWitnessSignature(
|
aliceSigRaw, err := txscript.RawTxInWitnessSignature(
|
||||||
commitTx, sigHashes, 0, chanSize,
|
commitTx, sigHashes, 0, chanSize,
|
||||||
multiSigScript, txscript.SigHashAll, alicePriv,
|
multiSigScript, txscript.SigHashAll, alicePriv,
|
||||||
|
@ -135,7 +135,7 @@ func (r *RPCKeyRing) SendOutputs(outputs []*wire.TxOut,
|
|||||||
// So we can just compute the input script using the remote signer.
|
// So we can just compute the input script using the remote signer.
|
||||||
signDesc := input.SignDescriptor{
|
signDesc := input.SignDescriptor{
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(tx),
|
SigHashes: input.NewTxSigHashesV0Only(tx),
|
||||||
}
|
}
|
||||||
for i, txIn := range tx.TxIn {
|
for i, txIn := range tx.TxIn {
|
||||||
// We can only sign this input if it's ours, so we'll ask the
|
// We can only sign this input if it's ours, so we'll ask the
|
||||||
@ -255,7 +255,7 @@ func (r *RPCKeyRing) FinalizePsbt(packet *psbt.Packet, _ string) error {
|
|||||||
// ones to sign. If there is any input without witness data that we
|
// ones to sign. If there is any input without witness data that we
|
||||||
// cannot sign because it's not our UTXO, this will be a hard failure.
|
// cannot sign because it's not our UTXO, this will be a hard failure.
|
||||||
tx := packet.UnsignedTx
|
tx := packet.UnsignedTx
|
||||||
sigHashes := txscript.NewTxSigHashes(tx)
|
sigHashes := input.NewTxSigHashesV0Only(tx)
|
||||||
for idx, txIn := range tx.TxIn {
|
for idx, txIn := range tx.TxIn {
|
||||||
in := packet.Inputs[idx]
|
in := packet.Inputs[idx]
|
||||||
|
|
||||||
|
@ -1710,7 +1710,7 @@ func txFromOutput(tx *wire.MsgTx, signer input.Signer, fromPubKey,
|
|||||||
WitnessScript: keyScript,
|
WitnessScript: keyScript,
|
||||||
Output: tx.TxOut[outputIndex],
|
Output: tx.TxOut[outputIndex],
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(tx1),
|
SigHashes: input.NewTxSigHashesV0Only(tx1),
|
||||||
InputIndex: 0, // Has only one input.
|
InputIndex: 0, // Has only one input.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,7 +1730,9 @@ func txFromOutput(tx *wire.MsgTx, signer input.Signer, fromPubKey,
|
|||||||
// private key.
|
// private key.
|
||||||
vm, err := txscript.NewEngine(
|
vm, err := txscript.NewEngine(
|
||||||
keyScript, tx1, 0, txscript.StandardVerifyFlags, nil,
|
keyScript, tx1, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, outputValue,
|
nil, outputValue, txscript.NewCannedPrevOutputFetcher(
|
||||||
|
keyScript, outputValue,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to create engine: %v", err)
|
return nil, fmt.Errorf("unable to create engine: %v", err)
|
||||||
@ -2096,7 +2098,7 @@ func testSignOutputUsingTweaks(r *rpctest.Harness,
|
|||||||
WitnessScript: keyScript,
|
WitnessScript: keyScript,
|
||||||
Output: newOutput,
|
Output: newOutput,
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(sweepTx),
|
SigHashes: input.NewTxSigHashesV0Only(sweepTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2123,9 +2125,13 @@ func testSignOutputUsingTweaks(r *rpctest.Harness,
|
|||||||
// Finally, attempt to validate the completed transaction. This
|
// Finally, attempt to validate the completed transaction. This
|
||||||
// should succeed if the wallet was able to properly generate
|
// should succeed if the wallet was able to properly generate
|
||||||
// the proper private key.
|
// the proper private key.
|
||||||
vm, err := txscript.NewEngine(keyScript,
|
vm, err := txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
keyScript, sweepTx, 0, txscript.StandardVerifyFlags,
|
||||||
nil, int64(btcutil.SatoshiPerBitcoin))
|
nil, nil, int64(btcutil.SatoshiPerBitcoin),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
keyScript, int64(btcutil.SatoshiPerBitcoin),
|
||||||
|
),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
}
|
}
|
||||||
@ -2833,7 +2839,7 @@ func testSignOutputCreateAccount(r *rpctest.Harness, w *lnwallet.LightningWallet
|
|||||||
Value: 1000,
|
Value: 1000,
|
||||||
},
|
},
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(fakeTx),
|
SigHashes: input.NewTxSigHashesV0Only(fakeTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
PubKey: aliceKeyPub,
|
PubKey: aliceKeyPub,
|
||||||
},
|
},
|
||||||
SingleTweak: remoteCommitTweak,
|
SingleTweak: remoteCommitTweak,
|
||||||
SigHashes: txscript.NewTxSigHashes(sweepTx),
|
SigHashes: input.NewTxSigHashesV0Only(sweepTx),
|
||||||
Output: &wire.TxOut{
|
Output: &wire.TxOut{
|
||||||
Value: int64(channelBalance),
|
Value: int64(channelBalance),
|
||||||
},
|
},
|
||||||
@ -626,9 +626,11 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
t.Fatalf("unable to generate delay commit spend witness: %v", err)
|
t.Fatalf("unable to generate delay commit spend witness: %v", err)
|
||||||
}
|
}
|
||||||
sweepTx.TxIn[0].Witness = aliceWitnessSpend
|
sweepTx.TxIn[0].Witness = aliceWitnessSpend
|
||||||
vm, err := txscript.NewEngine(delayOutput.PkScript,
|
vm, err := txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
delayOutput.PkScript, sweepTx, 0, txscript.StandardVerifyFlags,
|
||||||
nil, int64(channelBalance))
|
nil, nil, int64(channelBalance),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(nil, 0),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
}
|
}
|
||||||
@ -647,7 +649,7 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
},
|
},
|
||||||
DoubleTweak: commitSecret,
|
DoubleTweak: commitSecret,
|
||||||
WitnessScript: delayScript,
|
WitnessScript: delayScript,
|
||||||
SigHashes: txscript.NewTxSigHashes(sweepTx),
|
SigHashes: input.NewTxSigHashesV0Only(sweepTx),
|
||||||
Output: &wire.TxOut{
|
Output: &wire.TxOut{
|
||||||
Value: int64(channelBalance),
|
Value: int64(channelBalance),
|
||||||
},
|
},
|
||||||
@ -660,9 +662,11 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
t.Fatalf("unable to generate revocation witness: %v", err)
|
t.Fatalf("unable to generate revocation witness: %v", err)
|
||||||
}
|
}
|
||||||
sweepTx.TxIn[0].Witness = bobWitnessSpend
|
sweepTx.TxIn[0].Witness = bobWitnessSpend
|
||||||
vm, err = txscript.NewEngine(delayOutput.PkScript,
|
vm, err = txscript.NewEngine(
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
delayOutput.PkScript, sweepTx, 0, txscript.StandardVerifyFlags,
|
||||||
nil, int64(channelBalance))
|
nil, nil, int64(channelBalance),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(nil, 0),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
}
|
}
|
||||||
@ -691,7 +695,7 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
PubKey: bobKeyPub,
|
PubKey: bobKeyPub,
|
||||||
},
|
},
|
||||||
WitnessScript: bobScriptP2WKH,
|
WitnessScript: bobScriptP2WKH,
|
||||||
SigHashes: txscript.NewTxSigHashes(sweepTx),
|
SigHashes: input.NewTxSigHashesV0Only(sweepTx),
|
||||||
Output: &wire.TxOut{
|
Output: &wire.TxOut{
|
||||||
Value: int64(channelBalance),
|
Value: int64(channelBalance),
|
||||||
PkScript: bobScriptP2WKH,
|
PkScript: bobScriptP2WKH,
|
||||||
@ -713,6 +717,7 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
|||||||
regularOutput.PkScript,
|
regularOutput.PkScript,
|
||||||
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
sweepTx, 0, txscript.StandardVerifyFlags, nil,
|
||||||
nil, int64(channelBalance),
|
nil, int64(channelBalance),
|
||||||
|
txscript.NewCannedPrevOutputFetcher(bobScriptP2WKH, 0),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create engine: %v", err)
|
t.Fatalf("unable to create engine: %v", err)
|
||||||
|
@ -1615,7 +1615,7 @@ func (l *LightningWallet) handleChanPointReady(req *continueContributionMsg) {
|
|||||||
KeyDesc: ourKey,
|
KeyDesc: ourKey,
|
||||||
Output: fundingOutput,
|
Output: fundingOutput,
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(theirCommitTx),
|
SigHashes: input.NewTxSigHashesV0Only(theirCommitTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
sigTheirCommit, err := l.Cfg.Signer.SignOutputRaw(theirCommitTx, &signDesc)
|
sigTheirCommit, err := l.Cfg.Signer.SignOutputRaw(theirCommitTx, &signDesc)
|
||||||
@ -1690,7 +1690,7 @@ func (l *LightningWallet) verifyFundingInputs(fundingTx *wire.MsgTx,
|
|||||||
remoteInputScripts []*input.Script) error {
|
remoteInputScripts []*input.Script) error {
|
||||||
|
|
||||||
sigIndex := 0
|
sigIndex := 0
|
||||||
fundingHashCache := txscript.NewTxSigHashes(fundingTx)
|
fundingHashCache := input.NewTxSigHashesV0Only(fundingTx)
|
||||||
inputScripts := remoteInputScripts
|
inputScripts := remoteInputScripts
|
||||||
for i, txin := range fundingTx.TxIn {
|
for i, txin := range fundingTx.TxIn {
|
||||||
if len(inputScripts) != 0 && len(txin.Witness) == 0 {
|
if len(inputScripts) != 0 && len(txin.Witness) == 0 {
|
||||||
@ -1727,6 +1727,9 @@ func (l *LightningWallet) verifyFundingInputs(fundingTx *wire.MsgTx,
|
|||||||
output.PkScript, fundingTx, i,
|
output.PkScript, fundingTx, i,
|
||||||
txscript.StandardVerifyFlags, nil,
|
txscript.StandardVerifyFlags, nil,
|
||||||
fundingHashCache, output.Value,
|
fundingHashCache, output.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
output.PkScript, output.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot create script "+
|
return fmt.Errorf("cannot create script "+
|
||||||
@ -1806,7 +1809,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
|
|||||||
// Next, create the spending scriptSig, and then verify that the script
|
// Next, create the spending scriptSig, and then verify that the script
|
||||||
// is complete, allowing us to spend from the funding transaction.
|
// is complete, allowing us to spend from the funding transaction.
|
||||||
channelValue := int64(res.partialState.Capacity)
|
channelValue := int64(res.partialState.Capacity)
|
||||||
hashCache := txscript.NewTxSigHashes(commitTx)
|
hashCache := input.NewTxSigHashesV0Only(commitTx)
|
||||||
sigHash, err := txscript.CalcWitnessSigHash(
|
sigHash, err := txscript.CalcWitnessSigHash(
|
||||||
witnessScript, hashCache, txscript.SigHashAll, commitTx,
|
witnessScript, hashCache, txscript.SigHashAll, commitTx,
|
||||||
0, channelValue,
|
0, channelValue,
|
||||||
@ -1957,7 +1960,7 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
|||||||
req.fundingOutpoint, spew.Sdump(theirCommitTx))
|
req.fundingOutpoint, spew.Sdump(theirCommitTx))
|
||||||
|
|
||||||
channelValue := int64(pendingReservation.partialState.Capacity)
|
channelValue := int64(pendingReservation.partialState.Capacity)
|
||||||
hashCache := txscript.NewTxSigHashes(ourCommitTx)
|
hashCache := input.NewTxSigHashesV0Only(ourCommitTx)
|
||||||
theirKey := pendingReservation.theirContribution.MultiSigKey
|
theirKey := pendingReservation.theirContribution.MultiSigKey
|
||||||
ourKey := pendingReservation.ourContribution.MultiSigKey
|
ourKey := pendingReservation.ourContribution.MultiSigKey
|
||||||
witnessScript, _, err := input.GenFundingPkScript(
|
witnessScript, _, err := input.GenFundingPkScript(
|
||||||
@ -2008,7 +2011,7 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
|||||||
Value: channelValue,
|
Value: channelValue,
|
||||||
},
|
},
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
SigHashes: txscript.NewTxSigHashes(theirCommitTx),
|
SigHashes: input.NewTxSigHashesV0Only(theirCommitTx),
|
||||||
InputIndex: 0,
|
InputIndex: 0,
|
||||||
}
|
}
|
||||||
sigTheirCommit, err := l.Cfg.Signer.SignOutputRaw(theirCommitTx, &signDesc)
|
sigTheirCommit, err := l.Cfg.Signer.SignOutputRaw(theirCommitTx, &signDesc)
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/blockchain"
|
"github.com/btcsuite/btcd/blockchain"
|
||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
@ -264,7 +263,7 @@ func createSweepTx(inputs []input.Input, outputs []*wire.TxOut,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hashCache := txscript.NewTxSigHashes(sweepTx)
|
hashCache := input.NewTxSigHashesV0Only(sweepTx)
|
||||||
|
|
||||||
// With all the inputs in place, use each output's unique input script
|
// With all the inputs in place, use each output's unique input script
|
||||||
// function to generate the final witness required for spending.
|
// function to generate the final witness required for spending.
|
||||||
|
@ -228,6 +228,9 @@ func (p *JusticeDescriptor) assembleJusticeTxn(txWeight int64,
|
|||||||
input.txOut.PkScript, justiceTxn, i,
|
input.txOut.PkScript, justiceTxn, i,
|
||||||
txscript.StandardVerifyFlags,
|
txscript.StandardVerifyFlags,
|
||||||
nil, nil, input.txOut.Value,
|
nil, nil, input.txOut.Value,
|
||||||
|
txscript.NewCannedPrevOutputFetcher(
|
||||||
|
input.txOut.PkScript, input.txOut.Value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -269,7 +269,7 @@ func testJusticeDescriptor(t *testing.T, blobType blob.Type) {
|
|||||||
justiceTxn.TxOut = outputs
|
justiceTxn.TxOut = outputs
|
||||||
txsort.InPlaceSort(justiceTxn)
|
txsort.InPlaceSort(justiceTxn)
|
||||||
|
|
||||||
hashCache := txscript.NewTxSigHashes(justiceTxn)
|
hashCache := input.NewTxSigHashesV0Only(justiceTxn)
|
||||||
|
|
||||||
// Create the sign descriptor used to sign for the to-local input.
|
// Create the sign descriptor used to sign for the to-local input.
|
||||||
toLocalSignDesc := &input.SignDescriptor{
|
toLocalSignDesc := &input.SignDescriptor{
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
"github.com/btcsuite/btcd/btcutil/txsort"
|
"github.com/btcsuite/btcd/btcutil/txsort"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
@ -285,7 +284,7 @@ func (t *backupTask) craftSessionPayload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct a sighash cache to improve signing performance.
|
// Construct a sighash cache to improve signing performance.
|
||||||
hashCache := txscript.NewTxSigHashes(justiceTxn)
|
hashCache := input.NewTxSigHashesV0Only(justiceTxn)
|
||||||
|
|
||||||
// Since the transaction inputs could have been reordered as a result of
|
// Since the transaction inputs could have been reordered as a result of
|
||||||
// the BIP69 sort, create an index mapping each prevout to it's new
|
// the BIP69 sort, create an index mapping each prevout to it's new
|
||||||
|
Loading…
Reference in New Issue
Block a user