Skip to content

Commit 638bc73

Browse files
fix
1 parent 7f46fc0 commit 638bc73

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

wallet/multisig.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package wallet
77

88
import (
99
"errors"
10+
"fmt"
1011

1112
"github.com/btcsuite/btcd/btcutil"
1213
"github.com/btcsuite/btcd/txscript"
@@ -52,18 +53,29 @@ func (w *Wallet) MakeMultiSigScript(addrs []btcutil.Address, nRequired int) ([]b
5253
}
5354
addrmgrNs = dbtx.ReadBucket(waddrmgrNamespaceKey)
5455
}
56+
5557
addrInfo, err := w.Manager.Address(addrmgrNs, addr)
5658
if err != nil {
5759
return nil, err
5860
}
59-
serializedPubKey := addrInfo.(waddrmgr.ManagedPubKeyAddress).
60-
PubKey().SerializeCompressed()
61+
62+
mpka, ok := addrInfo.(waddrmgr.ManagedPubKeyAddress)
63+
if !ok {
64+
err := fmt.Errorf("managed address type for "+
65+
"%v is `%T` but want "+
66+
"waddrmgr.ManagedPubKeyAddress", addr,
67+
addrInfo)
68+
return nil, err
69+
}
70+
71+
serializedPubKey := mpka.PubKey().SerializeCompressed()
6172

6273
pubKeyAddr, err := btcutil.NewAddressPubKey(
6374
serializedPubKey, w.chainParams)
6475
if err != nil {
6576
return nil, err
6677
}
78+
6779
pubKeys[i] = pubKeyAddr
6880
}
6981
}

0 commit comments

Comments
 (0)