Skip to content

Commit b398205

Browse files
itest: export HarnessNode publicly
1 parent dfa3aee commit b398205

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

itest/litd_node.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ var _ lnrpc.LightningClient = (*HarnessNode)(nil)
339339
var _ lnrpc.WalletUnlockerClient = (*HarnessNode)(nil)
340340
var _ invoicesrpc.InvoicesClient = (*HarnessNode)(nil)
341341

342-
// newNode creates a new test lightning node instance from the passed config.
343-
func newNode(t *testing.T, cfg *LitNodeConfig,
344-
harness *NetworkHarness) (*HarnessNode, error) {
342+
// NewNode creates a new test lightning node instance from the passed config.
343+
func NewNode(t *testing.T, cfg *LitNodeConfig,
344+
harness *lntest.HarnessTest) (*HarnessNode, error) {
345345

346346
if cfg.BaseDir == "" {
347347
var err error
@@ -393,7 +393,7 @@ func newNode(t *testing.T, cfg *LitNodeConfig,
393393

394394
var remoteNode *node.HarnessNode
395395
if cfg.RemoteMode {
396-
lndHarness := harness.LNDHarness
396+
lndHarness := harness
397397

398398
remoteNode = lndHarness.NewNode("bob-custom", cfg.ExtraArgs)
399399
tenBTC := btcutil.Amount(10 * btcutil.SatoshiPerBitcoin)
@@ -538,7 +538,7 @@ func renameFile(fromFileName, toFileName string) {
538538
//
539539
// This may not clean up properly if an error is returned, so the caller should
540540
// call shutdown() regardless of the return value.
541-
func (hn *HarnessNode) start(litdBinary string, litdError chan<- error,
541+
func (hn *HarnessNode) Start(litdBinary string, litdError chan<- error,
542542
wait bool, litArgOpts ...LitArgOption) error {
543543

544544
hn.quit = make(chan struct{})
@@ -1165,8 +1165,8 @@ func (hn *HarnessNode) cleanup() error {
11651165
return os.RemoveAll(hn.Cfg.BaseDir)
11661166
}
11671167

1168-
// Stop attempts to stop the active litd process.
1169-
func (hn *HarnessNode) stop() error {
1168+
// Stop attempts to Stop the active litd process.
1169+
func (hn *HarnessNode) Stop() error {
11701170
// Do nothing if the process is not running.
11711171
if hn.processExit == nil {
11721172
return nil
@@ -1246,7 +1246,7 @@ func (hn *HarnessNode) stop() error {
12461246
// shutdown stops the active lnd process and cleans up any temporary directories
12471247
// created along the way.
12481248
func (hn *HarnessNode) shutdown() error {
1249-
if err := hn.stop(); err != nil {
1249+
if err := hn.Stop(); err != nil {
12501250
return err
12511251
}
12521252
if err := hn.cleanup(); err != nil {

itest/network_harness.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func (n *NetworkHarness) newNode(t *testing.T, name string, extraArgs,
315315
RemoteMode: remoteMode,
316316
}
317317

318-
node, err := newNode(t, cfg, n)
318+
node, err := NewNode(t, cfg, n.LNDHarness)
319319
if err != nil {
320320
return nil, err
321321
}
@@ -326,7 +326,7 @@ func (n *NetworkHarness) newNode(t *testing.T, name string, extraArgs,
326326
n.activeNodes[node.NodeID] = node
327327
n.mtx.Unlock()
328328

329-
err = node.start(n.litdBinary, n.lndErrorChan, wait)
329+
err = node.Start(n.litdBinary, n.lndErrorChan, wait)
330330
if err != nil {
331331
return nil, err
332332
}
@@ -649,7 +649,7 @@ func (n *NetworkHarness) RestartNode(node *HarnessNode, callback func() error,
649649
func (n *NetworkHarness) RestartNodeNoUnlock(node *HarnessNode,
650650
callback func() error, wait bool, litArgOpts ...LitArgOption) error {
651651

652-
if err := node.stop(); err != nil {
652+
if err := node.Stop(); err != nil {
653653
return err
654654
}
655655

@@ -659,18 +659,18 @@ func (n *NetworkHarness) RestartNodeNoUnlock(node *HarnessNode,
659659
}
660660
}
661661

662-
return node.start(n.litdBinary, n.lndErrorChan, wait, litArgOpts...)
662+
return node.Start(n.litdBinary, n.lndErrorChan, wait, litArgOpts...)
663663
}
664664

665665
// SuspendNode stops the given node and returns a callback that can be used to
666666
// start it again.
667667
func (n *NetworkHarness) SuspendNode(node *HarnessNode) (func() error, error) {
668-
if err := node.stop(); err != nil {
668+
if err := node.Stop(); err != nil {
669669
return nil, err
670670
}
671671

672672
restart := func() error {
673-
return node.start(n.litdBinary, n.lndErrorChan, true)
673+
return node.Start(n.litdBinary, n.lndErrorChan, true)
674674
}
675675

676676
return restart, nil
@@ -701,7 +701,7 @@ func (n *NetworkHarness) KillNode(node *HarnessNode) error {
701701
// This can be used to temporarily bring a node down during a test, to be later
702702
// started up again.
703703
func (n *NetworkHarness) StopNode(node *HarnessNode) error {
704-
return node.stop()
704+
return node.Stop()
705705
}
706706

707707
// OpenChannel attempts to open a channel between srcNode and destNode with the

0 commit comments

Comments
 (0)