From 44a0535c0931112c03852073776eee371fc03dac Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 26 Sep 2022 13:16:06 +0200 Subject: [PATCH 1/3] wallet: add script size for P2TR change output This commit adds a script size for a P2TR change output. Without it, the change size for a P2TR output will always be counted as 0 which leads to invalid transactions. --- wallet/createtx.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wallet/createtx.go b/wallet/createtx.go index 7d5fc4ad10..9962288d5c 100644 --- a/wallet/createtx.go +++ b/wallet/createtx.go @@ -382,6 +382,8 @@ func (w *Wallet) addrMgrWithChangeSource(dbtx walletdb.ReadWriteTx, scriptSize = txsizes.NestedP2WPKHPkScriptSize case waddrmgr.WitnessPubKey: scriptSize = txsizes.P2WPKHPkScriptSize + case waddrmgr.TaprootPubKey: + scriptSize = txsizes.P2TRPkScriptSize } newChangeScript := func() ([]byte, error) { From e2f6a6eddf0c7187ac221723a70b8b608ac8b0f7 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 26 Sep 2022 13:17:59 +0200 Subject: [PATCH 2/3] mod: bump wallet/txsizes to v1.2.3 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d0d7a19abf..422b0e45f5 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 - github.com/btcsuite/btcwallet/wallet/txsizes v1.2.2 + github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 github.com/btcsuite/btcwallet/walletdb v1.4.0 github.com/btcsuite/btcwallet/wtxmgr v1.5.0 github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 From 620913e64f60544b6bef197f9dca0cfbcbd03085 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 26 Sep 2022 18:21:54 -0700 Subject: [PATCH 3/3] build: run go mod tidy --- go.sum | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go.sum b/go.sum index d368a33b70..790aaceb53 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,9 @@ github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2/go.mod h1:Zpk/LOb2sKqwP2lmH 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/txsizes v1.1.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.2 h1:vtfutRuUoNsdgmKgYShuUgmBawNeC+lWu9jeucWkAII= github.com/btcsuite/btcwallet/wallet/txsizes v1.2.2/go.mod h1:q08Rms52VyWyXcp5zDc4tdFRKkFgNsMQrv3/LvE1448= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 h1:PszOub7iXVYbtGybym5TGCp9Dv1h1iX4rIC3HICZGLg= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3/go.mod h1:q08Rms52VyWyXcp5zDc4tdFRKkFgNsMQrv3/LvE1448= github.com/btcsuite/btcwallet/walletdb v1.3.5/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=