diff --git a/autopilot/agent.go b/autopilot/agent.go index 22eb6c90a3..b74eaba9a6 100644 --- a/autopilot/agent.go +++ b/autopilot/agent.go @@ -141,7 +141,7 @@ type Agent struct { // time. chanOpenFailures chan *chanOpenFailureUpdate - // heuristicUpdates is a channel where updates from active heurstics + // heuristicUpdates is a channel where updates from active heuristics // will be sent. heuristicUpdates chan *heuristicUpdate diff --git a/autopilot/agent_constraints.go b/autopilot/agent_constraints.go index 26282116ea..63c7ac511e 100644 --- a/autopilot/agent_constraints.go +++ b/autopilot/agent_constraints.go @@ -31,7 +31,7 @@ type AgentConstraints interface { MaxChanSize() btcutil.Amount } -// agenConstraints is an implementation of the AgentConstraints interface that +// agentConstraints is an implementation of the AgentConstraints interface that // indicate the constraints the autopilot agent must adhere to when opening // channels. type agentConstraints struct { diff --git a/autopilot/manager.go b/autopilot/manager.go index e2b09f11ef..cf30aca82c 100644 --- a/autopilot/manager.go +++ b/autopilot/manager.go @@ -293,7 +293,7 @@ func (m *Manager) queryHeuristics(nodes map[NodeID]struct{}, localState bool) ( HeuristicScores, error) { // If we want to take the local state into action when querying the - // heuristics, we fetch it. If not we'll just pass an emply slice to + // heuristics, we fetch it. If not we'll just pass an empty slice to // the heuristic. var totalChans []LocalChannel var err error diff --git a/autopilot/simple_graph.go b/autopilot/simple_graph.go index 08476414b4..c2dc7448f6 100644 --- a/autopilot/simple_graph.go +++ b/autopilot/simple_graph.go @@ -7,7 +7,7 @@ package autopilot // where 0 is maximally costly. const diameterCutoff = 0.75 -// SimpleGraph stores a simplifed adj graph of a channel graph to speed +// SimpleGraph stores a simplified adj graph of a channel graph to speed // up graph processing by eliminating all unnecessary hashing and map access. type SimpleGraph struct { // Nodes is a map from node index to NodeID. @@ -26,7 +26,7 @@ func NewSimpleGraph(g ChannelGraph) (*SimpleGraph, error) { nextIndex := 0 // getNodeIndex returns the integer index of the passed node. - // The returned index is then used to create a simplifed adjacency list + // The returned index is then used to create a simplified adjacency list // where each node is identified by its index instead of its pubkey, and // also to create a mapping from node index to node pubkey. getNodeIndex := func(node Node) int { diff --git a/autopilot/top_centrality_test.go b/autopilot/top_centrality_test.go index 426f0adc30..9e82427614 100644 --- a/autopilot/top_centrality_test.go +++ b/autopilot/top_centrality_test.go @@ -66,7 +66,7 @@ func testTopCentrality(t *testing.T, graph testGraph, } } -// TestTopCentrality tests that we return the correct normalized centralitiy +// TestTopCentrality tests that we return the correct normalized centrality // values given a non empty graph, and given our node has an increasing amount // of channels from 0 to N-1 simulating the whole range from non-connected to // fully connected. diff --git a/cert/selfsigned_test.go b/cert/selfsigned_test.go index 437aa4bf2f..614225a5a6 100644 --- a/cert/selfsigned_test.go +++ b/cert/selfsigned_test.go @@ -79,7 +79,7 @@ func TestIsOutdatedCert(t *testing.T) { } // TestIsOutdatedPermutation tests that the order of listed IPs or DNS names, -// nor dulicates in the lists, matter for whether we consider the certificate +// nor duplicates in the lists, matter for whether we consider the certificate // outdated. func TestIsOutdatedPermutation(t *testing.T) { tempDir := t.TempDir() diff --git a/lnwallet/btcwallet/psbt.go b/lnwallet/btcwallet/psbt.go index b3e8369468..7d0c633a17 100644 --- a/lnwallet/btcwallet/psbt.go +++ b/lnwallet/btcwallet/psbt.go @@ -67,7 +67,7 @@ func (b *BtcWallet) FundPsbt(packet *psbt.Packet, minConfs int32, switch accountName { // For default accounts and single imported public keys, we'll provide a - // nil key scope to FundPsbt, allowing it to select nputs from all + // nil key scope to FundPsbt, allowing it to select inputs from all // scopes (NP2WKH, P2WKH, P2TR). By default, the change key scope for // these accounts will be P2WKH. case lnwallet.DefaultAccountName: diff --git a/lnwallet/chainfee/estimator_test.go b/lnwallet/chainfee/estimator_test.go index d40bb42d1c..8227b5f2b2 100644 --- a/lnwallet/chainfee/estimator_test.go +++ b/lnwallet/chainfee/estimator_test.go @@ -189,7 +189,7 @@ func TestWebAPIFeeEstimator(t *testing.T) { expectedErr: "", }, { - // When requested target is smaller than the min cahced + // When requested target is smaller than the min cached // target, the fee rate of the min cached target is // returned. name: "API-omitted_target", diff --git a/lnwallet/chancloser/chancloser.go b/lnwallet/chancloser/chancloser.go index 5fcc4562d2..f2ed6da2b0 100644 --- a/lnwallet/chancloser/chancloser.go +++ b/lnwallet/chancloser/chancloser.go @@ -39,10 +39,10 @@ var ( ErrUpfrontShutdownScriptMismatch = fmt.Errorf("shutdown script does not " + "match upfront shutdown script") - // ErrProposalExeceedsMaxFee is returned when as the initiator, the + // ErrProposalExceedsMaxFee is returned when as the initiator, the // latest fee proposal sent by the responder exceed our max fee. // responder. - ErrProposalExeceedsMaxFee = fmt.Errorf("latest fee proposal exceeds " + + ErrProposalExceedsMaxFee = fmt.Errorf("latest fee proposal exceeds " + "max fee") // ErrInvalidShutdownScript is returned when we receive an address from @@ -526,7 +526,7 @@ func (c *ChanCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, // use this when we craft the closure transaction. c.remoteDeliveryScript = shutdownMsg.Address - // Now that we know their desried delivery script, we can + // Now that we know their desired delivery script, we can // compute what our max/ideal fee will be. c.initFeeBaseline() @@ -722,7 +722,7 @@ func (c *ChanCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, ) if c.cfg.Channel.IsInitiator() && feeProposal > c.maxFee { return nil, false, fmt.Errorf("%w: %v > %v", - ErrProposalExeceedsMaxFee, feeProposal, + ErrProposalExceedsMaxFee, feeProposal, c.maxFee) } @@ -902,7 +902,7 @@ func (c *ChanCloser) proposeCloseSigned(fee btcutil.Amount) (*lnwire.ClosingSign closeSignedMsg := lnwire.NewClosingSigned(c.cid, fee, parsedSig) // For musig2 channels, the main sig is blank, and instead we'll send - // over a partial signature which'll be combine donce our offer is + // over a partial signature which'll be combined once our offer is // accepted. if partialSig != nil { closeSignedMsg.PartialSig = &partialSig.PartialSig diff --git a/lnwallet/chancloser/chancloser_test.go b/lnwallet/chancloser/chancloser_test.go index e6c2b773d5..82aa9e386a 100644 --- a/lnwallet/chancloser/chancloser_test.go +++ b/lnwallet/chancloser/chancloser_test.go @@ -402,12 +402,16 @@ func TestMaxFeeBailOut(t *testing.T) { // If we're the initiator, then we expect an error at // this point. case true: - require.ErrorIs(t, err, ErrProposalExeceedsMaxFee) + require.ErrorIs( + t, err, ErrProposalExceedsMaxFee, + ) // Otherwise, we expect things to fail for some other // reason (invalid sig, etc). case false: - require.NotErrorIs(t, err, ErrProposalExeceedsMaxFee) + require.NotErrorIs( + t, err, ErrProposalExceedsMaxFee, + ) } }) } diff --git a/lnwallet/chanfunding/coin_select.go b/lnwallet/chanfunding/coin_select.go index 2f6f2ad84a..64142cb0a6 100644 --- a/lnwallet/chanfunding/coin_select.go +++ b/lnwallet/chanfunding/coin_select.go @@ -271,7 +271,7 @@ func CoinSelectUpToAmount(feeRate chainfee.SatPerKWeight, minAmount, maxAmount, ) // Get total balance from coins which we need for reserve considerations - // and fee santiy checks. + // and fee sanity checks. var totalBalance btcutil.Amount for _, coin := range coins { totalBalance += btcutil.Amount(coin.Value) diff --git a/lnwire/features.go b/lnwire/features.go index 3d29aaf730..81472a7544 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -35,7 +35,7 @@ const ( // DataLossProtectRequired is a feature bit that indicates that a peer // *requires* the other party know about the data-loss-protect optional // feature. If the remote peer does not know of such a feature, then - // the sending peer SHOLUD disconnect them. The data-loss-protect + // the sending peer SHOULD disconnect them. The data-loss-protect // feature allows a peer that's lost partial data to recover their // settled funds of the latest commitment state. DataLossProtectRequired FeatureBit = 0 diff --git a/lnwire/message_test.go b/lnwire/message_test.go index 1df0b5c558..bbb434785f 100644 --- a/lnwire/message_test.go +++ b/lnwire/message_test.go @@ -254,7 +254,7 @@ func BenchmarkReadMessage(b *testing.B) { // type. // // TODO(yy): the following testing messages are created somewhat arbitrary. We -// should standardlize each of the testing messages so that a better baseline +// should standardize each of the testing messages so that a better baseline // can be used. func makeAllMessages(t testing.TB, r *rand.Rand) []lnwire.Message { msgAll := []lnwire.Message{} diff --git a/lnwire/onion_error.go b/lnwire/onion_error.go index e6ae7437f5..12d436e7d5 100644 --- a/lnwire/onion_error.go +++ b/lnwire/onion_error.go @@ -589,14 +589,14 @@ func (f *FailInvalidOnionKey) Error() string { return fmt.Sprintf("InvalidOnionKey(onion_sha=%x)", f.OnionSHA256[:]) } -// parseChannelUpdateCompatabilityMode will attempt to parse a channel updated +// parseChannelUpdateCompatibilityMode will attempt to parse a channel updated // encoded into an onion error payload in two ways. First, we'll try the // compatibility oriented version wherein we'll _skip_ the length prefixing on // the channel update message. Older versions of c-lighting do this so we'll // attempt to parse these messages in order to retain compatibility. If we're // unable to pull out a fully valid version, then we'll fall back to the // regular parsing mechanism which includes the length prefix an NO type byte. -func parseChannelUpdateCompatabilityMode(reader io.Reader, length uint16, +func parseChannelUpdateCompatibilityMode(reader io.Reader, length uint16, chanUpdate *ChannelUpdate, pver uint32) error { // Instantiate a LimitReader because there may be additional data @@ -683,7 +683,8 @@ func (f *FailTemporaryChannelFailure) Decode(r io.Reader, pver uint32) error { if length != 0 { f.Update = &ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, f.Update, pver, ) } @@ -767,7 +768,8 @@ func (f *FailAmountBelowMinimum) Decode(r io.Reader, pver uint32) error { } f.Update = ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, &f.Update, pver, ) } @@ -835,7 +837,8 @@ func (f *FailFeeInsufficient) Decode(r io.Reader, pver uint32) error { } f.Update = ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, &f.Update, pver, ) } @@ -903,7 +906,8 @@ func (f *FailIncorrectCltvExpiry) Decode(r io.Reader, pver uint32) error { } f.Update = ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, &f.Update, pver, ) } @@ -960,7 +964,8 @@ func (f *FailExpiryTooSoon) Decode(r io.Reader, pver uint32) error { } f.Update = ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, &f.Update, pver, ) } @@ -1024,7 +1029,8 @@ func (f *FailChannelDisabled) Decode(r io.Reader, pver uint32) error { } f.Update = ChannelUpdate{} - return parseChannelUpdateCompatabilityMode( + + return parseChannelUpdateCompatibilityMode( r, length, &f.Update, pver, ) } diff --git a/lnwire/onion_error_test.go b/lnwire/onion_error_test.go index 9746cf0765..221f21951c 100644 --- a/lnwire/onion_error_test.go +++ b/lnwire/onion_error_test.go @@ -120,10 +120,10 @@ func testEncodeDecodeTlv(t *testing.T, testFailure FailureMessage) { require.Equal(t, testFailure, failure) } -// TestChannelUpdateCompatabilityParsing tests that we're able to properly read +// TestChannelUpdateCompatibilityParsing tests that we're able to properly read // out channel update messages encoded in an onion error payload that was // written in the legacy (type prefixed) format. -func TestChannelUpdateCompatabilityParsing(t *testing.T) { +func TestChannelUpdateCompatibilityParsing(t *testing.T) { t.Parallel() // We'll start by taking out test channel update, and encoding it into @@ -137,7 +137,7 @@ func TestChannelUpdateCompatabilityParsing(t *testing.T) { // able to decode it using our compatibility method, as it's a regular // encoded channel update message. var newChanUpdate ChannelUpdate - err := parseChannelUpdateCompatabilityMode( + err := parseChannelUpdateCompatibilityMode( &b, uint16(b.Len()), &newChanUpdate, 0, ) require.NoError(t, err, "unable to parse channel update") @@ -164,7 +164,7 @@ func TestChannelUpdateCompatabilityParsing(t *testing.T) { // We should be able to properly parse the encoded channel update // message even with the extra two bytes. var newChanUpdate2 ChannelUpdate - err = parseChannelUpdateCompatabilityMode( + err = parseChannelUpdateCompatibilityMode( &b, uint16(b.Len()), &newChanUpdate2, 0, ) require.NoError(t, err, "unable to parse channel update") diff --git a/pool/worker_test.go b/pool/worker_test.go index 300cb323ca..e4e73b5f24 100644 --- a/pool/worker_test.go +++ b/pool/worker_test.go @@ -125,7 +125,7 @@ func submitNonblockingGeneric(t *testing.T, p interface{}, nWorkers int) { // Now, unblock them all simultaneously. All of the tasks should then be // processed in parallel. Afterward, no more errors should come through. close(semChan) - pullParllel(t, nUnblocked, errChan) + pullParallel(t, nUnblocked, errChan) pullNothing(t, errChan) } @@ -149,7 +149,7 @@ func submitBlockingGeneric(t *testing.T, p interface{}, nWorkers int) { // Now, pull each blocking task sequentially from the pool. Afterwards, // no more errors should come through. - pullSequntial(t, nBlocked, errChan, semChan) + pullSequential(t, nBlocked, errChan, semChan) pullNothing(t, errChan) } @@ -187,12 +187,12 @@ func submitPartialBlockingGeneric(t *testing.T, p interface{}, nWorkers int) { // Now, unblock the unblocked task and pull all of them. After they have // been pulled, we should see no more tasks. close(semChanNB) - pullParllel(t, nUnblocked, errChan) + pullParallel(t, nUnblocked, errChan) pullNothing(t, errChan) // Finally, unblock each the blocked tasks we added initially, and // assert that no further errors come through. - pullSequntial(t, nBlocked, errChan, semChan) + pullSequential(t, nBlocked, errChan, semChan) pullNothing(t, errChan) } @@ -208,7 +208,7 @@ func pullNothing(t *testing.T, errChan chan error) { } } -func pullParllel(t *testing.T, n int, errChan chan error) { +func pullParallel(t *testing.T, n int, errChan chan error) { t.Helper() for i := 0; i < n; i++ { @@ -224,7 +224,10 @@ func pullParllel(t *testing.T, n int, errChan chan error) { } } -func pullSequntial(t *testing.T, n int, errChan chan error, semChan chan struct{}) { +func pullSequential( + t *testing.T, n int, errChan chan error, semChan chan struct{}, +) { + t.Helper() for i := 0; i < n; i++ { diff --git a/routing/pathfind.go b/routing/pathfind.go index e293d320de..fca0b6e25e 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -355,7 +355,7 @@ type RestrictParams struct { } // PathFindingConfig defines global parameters that control the trade-off in -// path finding between fees and probabiity. +// path finding between fees and probability. type PathFindingConfig struct { // AttemptCost is the fixed virtual cost in path finding of a failed // payment attempt. It is used to trade off potentially better routes @@ -1035,7 +1035,7 @@ func getProbabilityBasedDist(weight int64, probability float64, // Avoid cast if an overflow would occur. The maxFloat constant is // chosen to stay well below the maximum float64 value that is still - // convertable to int64. + // convertible to int64. const maxFloat = 9000000000000000000 if dist > maxFloat { return infinity diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index 4224a4f638..4923fd7ab3 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -519,7 +519,7 @@ func (g *testGraphInstance) getLink(chanID lnwire.ShortChannelID) ( // createTestGraphFromChannels returns a fully populated ChannelGraph based on a set of // test channels. Additional required information like keys are derived in -// a deterministical way and added to the channel graph. A list of nodes is +// a deterministic way and added to the channel graph. A list of nodes is // not required and derived from the channel data. The goal is to keep // instantiating a test channel graph as light weight as possible. func createTestGraphFromChannels(t *testing.T, useCache bool, diff --git a/routing/payment_lifecycle.go b/routing/payment_lifecycle.go index c6bd7e08e8..9a70925a74 100644 --- a/routing/payment_lifecycle.go +++ b/routing/payment_lifecycle.go @@ -31,7 +31,7 @@ type paymentLifecycle struct { currentHeight int32 } -// payemntState holds a number of key insights learned from a given MPPayment +// paymentState holds a number of key insights learned from a given MPPayment // that we use to determine what to do on each payment loop iteration. type paymentState struct { numShardsInFlight int diff --git a/routing/payment_session.go b/routing/payment_session.go index 8b181a04d9..bd8fff74ff 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -175,7 +175,7 @@ type paymentSession struct { getRoutingGraph func() (routingGraph, func(), error) // pathFindingConfig defines global parameters that control the - // trade-off in path finding between fees and probabiity. + // trade-off in path finding between fees and probability. pathFindingConfig PathFindingConfig missionControl MissionController diff --git a/routing/payment_session_source.go b/routing/payment_session_source.go index 9d42f6a4ae..9527e4e131 100644 --- a/routing/payment_session_source.go +++ b/routing/payment_session_source.go @@ -39,7 +39,7 @@ type SessionSource struct { MissionControl MissionController // PathFindingConfig defines global parameters that control the - // trade-off in path finding between fees and probabiity. + // trade-off in path finding between fees and probability. PathFindingConfig PathFindingConfig } diff --git a/routing/probability_apriori.go b/routing/probability_apriori.go index d5d9246e35..d37e3875ec 100644 --- a/routing/probability_apriori.go +++ b/routing/probability_apriori.go @@ -32,7 +32,7 @@ const ( // minCapacityFactor is the minimal value the capacityFactor can take. // Having a too low value can lead to discarding of paths due to the - // enforced minimal proability or to too high pathfinding weights. + // enforced minimal probability or to too high pathfinding weights. minCapacityFactor = 0.5 // minCapacityFraction is the minimum allowed value for diff --git a/routing/probability_apriori_test.go b/routing/probability_apriori_test.go index de69f9bb3b..b7df8ae6e0 100644 --- a/routing/probability_apriori_test.go +++ b/routing/probability_apriori_test.go @@ -18,7 +18,7 @@ const ( // untriedNode is a node id for which we don't record any results in // this test. This can be used to assert the probability for untried - // ndoes. + // nodes. untriedNode = 255 // Define test estimator parameters. diff --git a/routing/route/route.go b/routing/route/route.go index cac90c097d..dae216bd6b 100644 --- a/routing/route/route.go +++ b/routing/route/route.go @@ -400,7 +400,7 @@ func NewRouteFromHops(amtToSend lnwire.MilliSatoshi, timeLock uint32, } // ToSphinxPath converts a complete route into a sphinx PaymentPath that -// contains the per-hop paylods used to encoding the HTLC routing data for each +// contains the per-hop payloads used to encoding the HTLC routing data for each // hop in the route. This method also accepts an optional EOB payload for the // final hop. func (r *Route) ToSphinxPath() (*sphinx.PaymentPath, error) { diff --git a/routing/router.go b/routing/router.go index 0b09003f19..48c4a9d266 100644 --- a/routing/router.go +++ b/routing/router.go @@ -68,7 +68,7 @@ const ( // // NOTE: For payment requests, BOLT 11 stipulates that a final CLTV // delta of 9 should be used when no value is decoded. This however - // leads to inflexiblity in upgrading this default parameter, since it + // leads to inflexibility in upgrading this default parameter, since it // can create inconsistencies around the assumed value between sender // and receiver. Specifically, if the receiver assumes a higher value // than the sender, the receiver will always see the received HTLCs as diff --git a/subscribe/subscribe.go b/subscribe/subscribe.go index f95283ccc7..35bee93ba6 100644 --- a/subscribe/subscribe.go +++ b/subscribe/subscribe.go @@ -72,7 +72,7 @@ type clientUpdate struct { clientID uint64 // client is the new client that will receive updates. Will be nil in - // case this is a cancallation update. + // case this is a cancellation update. client *Client } diff --git a/watchtower/wtclient/queue.go b/watchtower/wtclient/queue.go index 262e768d53..9e680c12a4 100644 --- a/watchtower/wtclient/queue.go +++ b/watchtower/wtclient/queue.go @@ -517,7 +517,7 @@ func (q *DiskOverflowQueue[T]) feedMemQueue() { // instead persist the task to disk. After the producer, // drainInputList, has pushed an item to inputChan, it is // guaranteed to await a response on the task's success channel - // before quiting. Therefore, it is not required to listen on + // before quitting. Therefore, it is not required to listen on // the quit channel here. case task := <-q.inputChan: select { diff --git a/watchtower/wtclient/session_negotiator.go b/watchtower/wtclient/session_negotiator.go index d137d45e1a..2b1e988a1d 100644 --- a/watchtower/wtclient/session_negotiator.go +++ b/watchtower/wtclient/session_negotiator.go @@ -158,7 +158,7 @@ func (n *sessionNegotiator) Start() error { return nil } -// Stop safely shutsdown the sessionNegotiator. +// Stop safely shuts down the sessionNegotiator. func (n *sessionNegotiator) Stop() error { n.stopped.Do(func() { n.log.Debugf("Stopping session negotiator") diff --git a/watchtower/wtmock/peer.go b/watchtower/wtmock/peer.go index 636a2f72bc..6be6880fb1 100644 --- a/watchtower/wtmock/peer.go +++ b/watchtower/wtmock/peer.go @@ -95,7 +95,7 @@ func (p *MockPeer) Write(b []byte) (n int, err error) { } } -// Close tearsdown the connection, and fails any pending reads or writes. +// Close tears down the connection, and fails any pending reads or writes. func (p *MockPeer) Close() error { select { case <-p.Quit: diff --git a/zpay32/invoice.go b/zpay32/invoice.go index e0c05efc15..f23992ec9b 100644 --- a/zpay32/invoice.go +++ b/zpay32/invoice.go @@ -281,7 +281,7 @@ func PaymentAddr(addr [32]byte) func(*Invoice) { } // Metadata is a functional option that allows callers of NewInvoice to set -// the desired payment Metadata tht is advertised on the invoice. +// the desired payment Metadata that is advertised on the invoice. func Metadata(metadata []byte) func(*Invoice) { return func(i *Invoice) { i.Metadata = metadata