Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type config struct {
allowPrivateDescriptorsExport bool // default to the safe option, denying
logging func(ctx context.Context) *zerolog.Logger
withoutInitialConnectionCheck bool
cookiePath string
}

func newConfig(opts []Option) config {
Expand Down Expand Up @@ -99,6 +100,16 @@ func WithAllowPrivateDescriptorsExport() Option {
}
}

// WithCookiePath authenticates via Core's cookie file instead of a static
// user/pass. The cookie is re-read when it changes, so callers survive a Core
// restart (which rewrites the cookie) without reconnecting. Ignored when a
// non-empty pass is also supplied.
func WithCookiePath(path string) Option {
return func(c *config) {
c.cookiePath = path
}
}

// WithoutInitialConnectionCheck disables the initial connection check to
// Bitcoin Core. This allows you to succeed in starting up the server, even
// if the underlying Core node is not reachable.
Expand Down Expand Up @@ -135,6 +146,7 @@ func NewBitcoind(
rpcConf := rpcclient.ConnConfig{
User: user,
Pass: pass,
CookiePath: conf.cookiePath,
DisableTLS: !conf.enableTLS,
Host: host,

Expand Down
Loading