func (l *Loader) onLoaded(w *wallet.Wallet, db wallet.DB) {
	for _, fn := range l.callbacks {
		fn(w)
	}
	l.wallet = w
	l.db = db
	l.callbacks = nil  
}
onLoaded executes each added callback and prevents loader from loading any
additional wallets.  Requires mutex to be locked.
package loader
import (
	"context"
	"net"
	"os"
	"path/filepath"
	"sync"
	"decred.org/dcrwallet/v2/errors"
	"decred.org/dcrwallet/v2/wallet"
	_ "decred.org/dcrwallet/v2/wallet/drivers/bdb"  
	"github.com/decred/dcrd/chaincfg/v3"
	"github.com/decred/dcrd/dcrutil/v4"
	"github.com/decred/dcrd/txscript/v4/stdaddr"
)
const (
	walletDbName = "wallet.db"
	driver       = "bdb"
)
type Loader struct {
	callbacks   []func(*wallet.Wallet)
	chainParams *chaincfg.Params
	dbDirPath   string
	wallet      *wallet.Wallet
	db          wallet.DB
	stakeOptions            *StakeOptions
	gapLimit                uint32
	accountGapLimit         int
	disableCoinTypeUpgrades bool
	allowHighFees           bool
	manualTickets           bool
	relayFee                dcrutil.Amount
	mu sync.Mutex
	DialCSPPServer DialFunc
}
type StakeOptions struct {
	VotingEnabled       bool
	AddressReuse        bool
	VotingAddress       stdaddr.StakeAddress
	PoolAddress         stdaddr.StakeAddress
	PoolFees            float64
	StakePoolColdExtKey string
}
type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)
func NewLoader(chainParams *chaincfg.Params, dbDirPath string, stakeOptions *StakeOptions, gapLimit uint32,
	allowHighFees bool, relayFee dcrutil.Amount, accountGapLimit int, disableCoinTypeUpgrades bool, manualTickets bool) *Loader {
	return &Loader{
		chainParams:             chainParams,
		dbDirPath:               dbDirPath,
		stakeOptions:            stakeOptions,
		gapLimit:                gapLimit,
		accountGapLimit:         accountGapLimit,
		disableCoinTypeUpgrades: disableCoinTypeUpgrades,
		allowHighFees:           allowHighFees,
		manualTickets:           manualTickets,
		relayFee:                relayFee,
	}
}