func (m *Manager) Close() {
	m.mtx.Lock()
	defer m.mtx.Unlock()
	if m.closed {
		return
	}
	if !m.watchingOnly && !m.locked {
		m.lock()
	}
	m.closed = true
	return
}
Close cleanly shuts down the manager.  It makes a best try effort to remove
and zero all private key and sensitive public key material associated with
the address manager from memory.
package waddrmgr
import (
	"crypto/rand"
	"crypto/sha512"
	"fmt"
	"github.com/Qitmeer/qitmeer-wallet/internal/zero"
	"github.com/Qitmeer/qitmeer-wallet/snacl"
	"github.com/Qitmeer/qitmeer-wallet/walletdb"
	"github.com/Qitmeer/qitmeer/core/types"
	"github.com/Qitmeer/qitmeer/crypto/bip32"
	ecc "github.com/Qitmeer/qitmeer/crypto/ecc/secp256k1"
	chaincfg "github.com/Qitmeer/qitmeer/params"
	"sync"
	"time"
)
const (
	MaxAccountNum = HardenedKeyStart - 2  
	MaxAddressesPerAccount = HardenedKeyStart - 1
	ImportedAddrAccount = MaxAccountNum + 1  
	ImportedAddrAccountName = "imported"
	HardenedKeyStart = 0x80000000  
	DefaultAccountNum = 0
	AccountMergePayNum = -1
	defaultAccountName = "default"
	ExternalBranch uint32 = 0
	InternalBranch uint32 = 1
	saltSize = 32
)
func isReservedAccountName(name string) bool {
	return name == ImportedAddrAccountName
}
type ScryptOptions struct {
	N, R, P int
}
type AccountProperties struct {
	AccountNumber    uint32
	AccountName      string
	ExternalKeyCount uint32
	InternalKeyCount uint32
	ImportedKeyCount uint32
}
type unlockDeriveInfo struct {
	managedAddr ManagedAddress
	branch      uint32
	index       uint32
}
type OpenCallbacks struct {
	ObtainSeed ObtainUserInputFunc
	ObtainPrivatePass ObtainUserInputFunc
}
type accountInfo struct {
	acctName string
	acctKeyEncrypted []byte
	acctKeyPriv      *bip32.Key
	acctKeyPub       *bip32.Key
	nextExternalIndex uint32
	lastExternalAddr  ManagedAddress
	nextInternalIndex uint32
	lastInternalAddr  ManagedAddress
}
var DefaultScryptOptions = ScryptOptions{
	N: 262144,  
	R: 8,
	P: 1,
}
type addrKey string
type EncryptorDecryptor interface {
	Encrypt(in []byte) ([]byte, error)
	Decrypt(in []byte) ([]byte, error)
	Bytes() []byte
	CopyBytes([]byte)
	Zero()
}
type CryptoKeyType byte
var newCryptoKey = defaultNewCryptoKey
func defaultNewCryptoKey() (EncryptorDecryptor, error) {
	key, err := snacl.GenerateCryptoKey()
	if err != nil {
		return nil, err
	}
	return &cryptoKey{*key}, nil
}
type Manager struct {
	mtx sync.RWMutex
	scopedManagers map[KeyScope]*ScopedKeyManager
	externalAddrSchemas map[AddressType][]KeyScope
	internalAddrSchemas map[AddressType][]KeyScope
	syncState           syncState
	chainHeight         uint32
	watchingOnly        bool
	birthday            time.Time
	locked              bool
	closed              bool
	chainParams         *chaincfg.Params
	masterKeyPub  *snacl.SecretKey
	masterKeyPriv *snacl.SecretKey
	cryptoKeyPub EncryptorDecryptor
	cryptoKeyPrivEncrypted []byte
	cryptoKeyPriv          EncryptorDecryptor
	cryptoKeyScriptEncrypted []byte
	cryptoKeyScript          EncryptorDecryptor
	privPassphraseSalt   [saltSize]byte
	hashedPrivPassphrase [sha512.Size]byte
}
type cryptoKey struct {
	snacl.CryptoKey
}
func (ck *cryptoKey) Bytes() []byte {
	return ck.CryptoKey[:]
}
func (ck *cryptoKey) CopyBytes(from []byte) {
	copy(ck.CryptoKey[:], from)
}
func (m *Manager) WatchOnly() bool {
	m.mtx.RLock()
	defer m.mtx.RUnlock()
	return m.watchOnly()
}
func (m *Manager) watchOnly() bool {
	return m.watchingOnly
}
func (m *Manager) Lock() error {
	if m.watchingOnly {
		return managerError(ErrWatchingOnly, errWatchingOnly, nil)
	}
	m.mtx.Lock()
	defer m.mtx.Unlock()
	if m.locked {
		return managerError(ErrLocked, errLocked, nil)
	}
	m.lock()
	return nil
}
func (m *Manager) lock() {
	m.cryptoKeyScript.Zero()
	m.cryptoKeyPriv.Zero()
	m.locked = true
}