Skip to content

Commit e3dd886

Browse files
authored
Merge pull request #8962 from ProofOfKeags/refactor/quiescence-micro-spinoffs
[NANO]: Refactor/quiescence micro spinoffs
2 parents 6e9eb1d + dc03637 commit e3dd886

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

htlcswitch/link.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
crand "crypto/rand"
66
"crypto/sha256"
7+
"errors"
78
"fmt"
89
prand "math/rand"
910
"sync"
@@ -13,7 +14,6 @@ import (
1314
"github.com/btcsuite/btcd/btcutil"
1415
"github.com/btcsuite/btcd/wire"
1516
"github.com/btcsuite/btclog"
16-
"github.com/go-errors/errors"
1717
"github.com/lightningnetwork/lnd/build"
1818
"github.com/lightningnetwork/lnd/channeldb"
1919
"github.com/lightningnetwork/lnd/channeldb/models"
@@ -480,7 +480,7 @@ var _ ChannelLink = (*channelLink)(nil)
480480
// NOTE: Part of the ChannelLink interface.
481481
func (l *channelLink) Start() error {
482482
if !atomic.CompareAndSwapInt32(&l.started, 0, 1) {
483-
err := errors.Errorf("channel link(%v): already started", l)
483+
err := fmt.Errorf("channel link(%v): already started", l)
484484
l.log.Warn("already started")
485485
return err
486486
}
@@ -4080,7 +4080,7 @@ func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64,
40804080
// remote peer.
40814081
func (l *channelLink) fail(linkErr LinkFailureError,
40824082
format string, a ...interface{}) {
4083-
reason := errors.Errorf(format, a...)
4083+
reason := fmt.Errorf(format, a...)
40844084

40854085
// Return if we have already notified about a failure.
40864086
if l.failed {

htlcswitch/link_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func TestChannelLinkSingleHopPayment(t *testing.T) {
444444
t.Parallel()
445445

446446
// Setup a alice-bob network.
447-
alice, bob, err := createTwoClusterChannels(
447+
alice, bob, err := createMirroredChannel(
448448
t, btcutil.SatoshiPerBitcoin*3, btcutil.SatoshiPerBitcoin*5,
449449
)
450450
require.NoError(t, err, "unable to create channel")
@@ -6318,7 +6318,7 @@ func TestChannelLinkCanceledInvoice(t *testing.T) {
63186318
t.Parallel()
63196319

63206320
// Setup a alice-bob network.
6321-
alice, bob, err := createTwoClusterChannels(
6321+
alice, bob, err := createMirroredChannel(
63226322
t, btcutil.SatoshiPerBitcoin*3, btcutil.SatoshiPerBitcoin*5,
63236323
)
63246324
require.NoError(t, err, "unable to create channel")
@@ -6374,7 +6374,7 @@ type hodlInvoiceTestCtx struct {
63746374

63756375
func newHodlInvoiceTestCtx(t *testing.T) (*hodlInvoiceTestCtx, error) {
63766376
// Setup a alice-bob network.
6377-
alice, bob, err := createTwoClusterChannels(
6377+
alice, bob, err := createMirroredChannel(
63786378
t, btcutil.SatoshiPerBitcoin*3, btcutil.SatoshiPerBitcoin*5,
63796379
)
63806380
require.NoError(t, err, "unable to create channel")

htlcswitch/test_utils.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,17 +1053,17 @@ func serverOptionRejectHtlc(alice, bob, carol bool) serverOption {
10531053
}
10541054
}
10551055

1056-
// createTwoClusterChannels creates lightning channels which are needed for
1057-
// a 2 hop network cluster to be initialized.
1058-
func createTwoClusterChannels(t *testing.T, aliceToBob,
1059-
bobToCarol btcutil.Amount) (*testLightningChannel,
1056+
// createMirroredChannel creates two LightningChannel objects which represent
1057+
// the state machines on either side of a single channel between alice and bob.
1058+
func createMirroredChannel(t *testing.T, aliceToBob,
1059+
bobToAlice btcutil.Amount) (*testLightningChannel,
10601060
*testLightningChannel, error) {
10611061

10621062
_, _, firstChanID, _ := genIDs()
10631063

1064-
// Create lightning channels between Alice<->Bob and Bob<->Carol
1064+
// Create lightning channels between Alice<->Bob for Alice and Bob
10651065
alice, bob, err := createTestChannel(t, alicePrivKey, bobPrivKey,
1066-
aliceToBob, aliceToBob, 0, 0, firstChanID,
1066+
aliceToBob, bobToAlice, 0, 0, firstChanID,
10671067
)
10681068
if err != nil {
10691069
return nil, nil, errors.Errorf("unable to create "+

0 commit comments

Comments
 (0)