multi: allow internal wallet to be watch-only

This commit is contained in:
Oliver Gugger committed 2021-10-14 15:42:45 +02:00
1 parent 6093393e2f
commit 1309c6afea
5 files changed
+35 -17

No files matched your search

+7 -3
View File
@@ -291,10 +291,14 @@ func (b *BtcWallet) Start() error {
// We'll start by unlocking the wallet and ensuring that the KeyScope:
// (1017, 1) exists within the internal waddrmgr. We'll need this in
// order to properly generate the keys required for signing various
// contracts.
if err := b.wallet.Unlock(b.cfg.PrivatePass, nil); err != nil {
return err
// contracts. If this is a watch-only wallet, we don't have any private
// keys and therefore unlocking is not necessary.
if !b.cfg.WatchOnly {
if err := b.wallet.Unlock(b.cfg.PrivatePass, nil); err != nil {
return err
}
}
_, err := b.wallet.Manager.FetchScopedKeyManager(b.chainKeyScope)
if err != nil {
// If the scope hasn't yet been created (it wouldn't been
+4
View File
@@ -72,6 +72,10 @@ type Config struct {
// CoinSelectionStrategy is the strategy that is used for selecting
// coins when funding a transaction.
CoinSelectionStrategy wallet.CoinSelectionStrategy
// WatchOnly indicates that the wallet was initialized with public key
// material only and does not contain any private keys.
WatchOnly bool
}
// NetworkDir returns the directory name of a network directory to hold wallet