Skip to content

Commit 0456497

Browse files
committed
lncfg: add IsLocalNetwork helper
It returns true for Signet and Regtest networks.
1 parent c7aa179 commit 0456497

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

chainreg/chainregistry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
528528
// On local test networks we usually don't have multiple
529529
// chain backend peers, so we can skip
530530
// the checkOutboundPeers test.
531-
if cfg.Bitcoin.SimNet || cfg.Bitcoin.RegTest {
531+
if cfg.Bitcoin.IsLocalNetwork() {
532532
return nil
533533
}
534534

@@ -651,7 +651,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
651651
// On local test networks we usually don't have multiple
652652
// chain backend peers, so we can skip
653653
// the checkOutboundPeers test.
654-
if cfg.Bitcoin.SimNet || cfg.Bitcoin.RegTest {
654+
if cfg.Bitcoin.IsLocalNetwork() {
655655
return nil
656656
}
657657

lncfg/chain.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ func (c *Chain) Validate(minTimeLockDelta uint32, minDelay uint16) error {
5252

5353
return nil
5454
}
55+
56+
// IsLocalNetwork returns true if the chain is a local network, such as
57+
// simnet or regtest.
58+
func (c *Chain) IsLocalNetwork() bool {
59+
return c.SimNet || c.RegTest
60+
}

0 commit comments

Comments
 (0)