godoc: address copy-paste errors accross the codebase

This commit is contained in:
Slyghtning 2026-02-28 10:29:25 +01:00
parent c1036ff705
commit a9977dd5f4
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
26 changed files with 62 additions and 50 deletions

View file

@ -7,14 +7,22 @@ import (
"sync"
)
// ErrEventRejected is the error returned when the state machine cannot process
// an event in the state that it is in.
var (
ErrEventRejected = errors.New("event rejected")
// ErrEventRejected is the error returned when the state machine cannot
// process an event in the state that it is in.
ErrEventRejected = errors.New("event rejected")
// ErrWaitForStateTimedOut is returned when waiting for state times out.
ErrWaitForStateTimedOut = errors.New(
"timed out while waiting for event",
)
ErrInvalidContextType = errors.New("invalid context")
// ErrInvalidContextType is returned when an invalid context type is
// passed.
ErrInvalidContextType = errors.New("invalid context")
// ErrWaitingForStateEarlyAbortError is returned when waiting for state
// is aborted early.
ErrWaitingForStateEarlyAbortError = errors.New(
"waiting for state early abort",
)
@ -91,7 +99,7 @@ type Observer interface {
// StateMachine represents the state machine.
type StateMachine struct {
// Context represents the state machine context.
// States represents the state machine states.
States States
// ActionEntryFunc is a function that is called before an action is

View file

@ -122,7 +122,7 @@ func (i *InstantOut) createMusig2Session(ctx context.Context,
return musig2Sessions, clientNonces, nil
}
// getInputReservation returns the input reservation for the instant out.
// getInputReservations returns the input reservations for the instant out.
func (i *InstantOut) getInputReservations() (InputReservations, error) {
if len(i.Reservations) == 0 {
return nil, errors.New("no reservations")

View file

@ -313,7 +313,8 @@ func TestSubscribeToConfirmationAction(t *testing.T) {
}
}
// AsyncWaitForExpiredOrSweptAction tests the AsyncWaitForExpiredOrSweptAction
// TestAsyncWaitForExpiredOrSweptAction tests the
// AsyncWaitForExpiredOrSweptAction
// of the reservation state machine.
func TestAsyncWaitForExpiredOrSweptAction(t *testing.T) {
tests := []struct {
@ -375,7 +376,7 @@ func TestAsyncWaitForExpiredOrSweptAction(t *testing.T) {
}
}
// TesthandleSubcriptions tests the handleSubcriptions function of the
// TestHandleSubcriptions tests the handleSubcriptions function of the
// reservation state machine.
func TestHandleSubcriptions(t *testing.T) {
var (

View file

@ -18,7 +18,7 @@ type OutRequest struct {
// include the swap and miner fee.
Amount btcutil.Amount
// Destination address for the swap.
// DestAddr is the destination address for the swap.
DestAddr btcutil.Address
// IsExternalAddr indicates whether the provided destination address
@ -428,8 +428,8 @@ type LoopInQuote struct {
// sweep the htlc.
MinerFee btcutil.Amount
// Time lock delta relative to current block height that swap server
// will accept on the swap initiation call.
// CltvDelta is the time lock delta relative to current block height
// that the swap server will accept on the swap initiation call.
CltvDelta int32
}
@ -533,7 +533,7 @@ type ProbeRequest struct {
// LastHop is the last hop along the route.
LastHop *route.Vertex
// Optional hop hints.
// RouteHints are optional hop hints.
RouteHints [][]zpay32.HopHint
}

View file

@ -19,8 +19,8 @@ const (
// 1%.
defaultRoutingFeePPM = 10000
// defaultRoutingFeePPM is the default limit we place on routing fees
// for the prepay invoice, expressed as parts per million of prepay
// defaultPrepayRoutingFeePPM is the default limit we place on routing
// fees for the prepay invoice, expressed as parts per million of prepay
// volume, 0.5%.
defaultPrepayRoutingFeePPM = 5000

View file

@ -369,7 +369,7 @@ func (m *Manager) SetParameters(ctx context.Context,
return m.saveParams(ctx, req)
}
// SetParameters updates our current set of parameters if the new parameters
// setParameters updates our current set of parameters if the new parameters
// provided are valid.
func (m *Manager) setParameters(ctx context.Context,
params Parameters) error {

View file

@ -409,7 +409,7 @@ func rpcToRule(rule *clientrpc.LiquidityRule) (*SwapRule, error) {
}
}
// rpcToParameters takes a `LiquidityParameters` and creates a `Parameters`
// RpcToParameters takes a `LiquidityParameters` and creates a `Parameters`
// from it.
func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
error) {

View file

@ -2753,7 +2753,7 @@ func toClientReservation(
}
}
// marshalFixedpoint marshals a fixed point from the tap rfqmath package to the
// marshalFixedPoint marshals a fixed point from the tap rfqmath package to the
// looprpc package.
func marshalFixedPoint(bigIntFixedPoint *rfqmath.BigIntFixedPoint,
) *looprpc.FixedPoint {

View file

@ -16,7 +16,7 @@ import (
type LoopInContract struct {
SwapContract
// SweepConfTarget specifies the targeted confirmation target for the
// HtlcConfTarget specifies the targeted confirmation target for the
// client sweep tx.
HtlcConfTarget int32

View file

@ -9,7 +9,7 @@ import (
)
var (
// metaBucket stores all the meta information concerning the state of
// metaBucketKey stores all the meta information concerning the state of
// the database.
metaBucketKey = []byte("metadata")

View file

@ -43,7 +43,7 @@ const (
// canceling loop out swaps.
ProtocolVersionLoopOutCancel = 7
// ProtocolVerionProbe indicates that the client is able to request
// ProtocolVersionProbe indicates that the client is able to request
// the server to perform a probe to test inbound liquidty.
ProtocolVersionProbe ProtocolVersion = 8

View file

@ -98,7 +98,7 @@ var (
// value: uint32 confirmation value
confirmationsKey = []byte("confirmations")
// liquidtyBucket is a root bucket used to save liquidity manager
// liquidityBucket is a root bucket used to save liquidity manager
// related info.
liquidityBucket = []byte("liquidity")

View file

@ -80,7 +80,7 @@ func (s *StoreMock) FetchLoopOutSwaps(ctx context.Context) ([]*LoopOut, error) {
return result, nil
}
// FetchLoopOutSwaps returns all swaps currently in the store.
// FetchLoopOutSwap returns a swap currently in the store.
//
// NOTE: Part of the SwapStore interface.
func (s *StoreMock) FetchLoopOutSwap(ctx context.Context,
@ -261,7 +261,7 @@ func (s *StoreMock) Close() error {
return nil
}
// isDone asserts that the store mock has no pending operations.
// IsDone asserts that the store mock has no pending operations.
func (s *StoreMock) IsDone() error {
select {
case <-s.loopOutStoreChan:
@ -312,7 +312,7 @@ func (s *StoreMock) AssertLoopInStored() {
}
}
// assertLoopInState asserts that a specified state transition is persisted to
// AssertLoopInState asserts that a specified state transition is persisted to
// disk.
func (s *StoreMock) AssertLoopInState(
expectedState SwapState) SwapStateData {

View file

@ -387,8 +387,8 @@ func TestVersionNew(t *testing.T) {
}
}
// TestVersionNew tests that an existing version zero database is migrated to
// the latest version.
// TestVersionMigrated tests that an existing version zero database is migrated
// to the latest version.
func TestVersionMigrated(t *testing.T) {
tempDirName, err := ioutil.TempDir("", "clientstore")
if err != nil {

View file

@ -172,7 +172,7 @@ func (s SwapState) String() string {
// SwapCost is a breakdown of the final swap costs.
type SwapCost struct {
// Swap is the amount paid to the server.
// Server is the amount paid to the server.
Server btcutil.Amount
// Onchain is the amount paid to miners for the onchain tx.
@ -189,7 +189,7 @@ func (s SwapCost) Total() btcutil.Amount {
// SwapStateData is all persistent data to describe the current swap state.
type SwapStateData struct {
// SwapState is the state the swap is in.
// State is the state the swap is in.
State SwapState
// Cost are the accrued (final) costs so far.

View file

@ -40,7 +40,7 @@ func TestLoopOutPaymentParameters(t *testing.T) {
})
}
// TestLoopOutPaymentParameters tests the first part of the loop out process up
// testLoopOutPaymentParameters tests the first part of the loop out process up
// to the point where the off-chain payments are made.
func testLoopOutPaymentParameters(t *testing.T) {
defer test.Guard(t)()

View file

@ -33,7 +33,7 @@ type Parameters struct {
// timeout path.
ClientPubkey *btcec.PublicKey
// ClientPubkey is the client's pubkey for the static address. It is
// ServerPubkey is the server's pubkey for the static address. It is
// used for the 2-of-2 funding output.
ServerPubkey *btcec.PublicKey

View file

@ -124,8 +124,8 @@ type StaticAddressLoopIn struct {
// probing and payment.
Private bool
// Optional route hints to reach the destination through private
// channels.
// RouteHints are optional route hints to reach the destination through
// private channels.
RouteHints [][]zpay32.HopHint
// Deposits are the deposits that are part of the loop-in swap. They

View file

@ -60,10 +60,10 @@ type Config struct {
// cancel invoices.
InvoicesClient lndclient.InvoicesClient
// SwapClient is used to get loop in quotes.
// QuoteGetter is used to get loop-in quotes.
QuoteGetter QuoteGetter
// NodePubKey is used to get a loo-in quote.
// NodePubkey is used to get a loop-in quote.
NodePubkey route.Vertex
// WalletKit is the wallet client that is used to derive new keys from
@ -74,7 +74,7 @@ type Config struct {
// manager uses.
ChainParams *chaincfg.Params
// Chain is the chain notifier that is used to listen for new
// ChainNotifier is the chain notifier that is used to listen for new
// blocks.
ChainNotifier lndclient.ChainNotifierClient

View file

@ -31,7 +31,8 @@ const (
// channel opening.
defaultUtxoMinConf = 1
// Is the default confirmation target for a channel open transaction.
// defaultConfTarget is the default confirmation target for a channel
// open transaction.
defaultConfTarget int32 = 3
)
@ -47,8 +48,8 @@ var (
// Config is the configuration struct for the open channel manager.
type Config struct {
// StaticAddressServerClient is the client that calls the swap server
// rpcs to negotiate static address withdrawals.
// Server is the client that calls the swap server rpcs to negotiate
// static address withdrawals.
Server serverrpc.StaticAddressServerClient
// AddressManager gives the withdrawal manager access to static address
@ -91,7 +92,7 @@ type newOpenChannelResponse struct {
// ChanOutpoint is the outpoint of the channel open transaction.
ChanOutpoint *wire.OutPoint
// Err is the error that occurred during the channel open process.
// err is the error that occurred during the channel open process.
err error
}

View file

@ -135,8 +135,8 @@ type Manager struct {
// initiationHeight stores the currently best known block height.
initiationHeight atomic.Uint32
// finalizedWithdrawalTx are the finalized withdrawal transactions that
// are published to the network and re-published on block arrivals.
// finalizedWithdrawalTxns are the finalized withdrawal transactions
// that are published to the network and re-published on block arrivals.
finalizedWithdrawalTxns map[chainhash.Hash]*wire.MsgTx
}

View file

@ -50,10 +50,12 @@ func newSwapKit(hash lntypes.Hash, swapType swap.Type, cfg *swapConfig,
}
}
// IsTaproot returns true if the swap referenced by the passed swap contract
// IsTaprootSwap returns true if the swap referenced by the passed swap contract
// uses the v3 (taproot) htlc.
func IsTaprootSwap(swapContract *loopdb.SwapContract) bool {
return utils.GetHtlcScriptVersion(swapContract.ProtocolVersion) == swap.HtlcV3
version := utils.GetHtlcScriptVersion(swapContract.ProtocolVersion)
return version == swap.HtlcV3
}
// swapInfo constructs and returns a filled SwapInfo from

View file

@ -477,7 +477,7 @@ func (h *HtlcScriptV2) SuccessSequence() uint32 {
return 1
}
// Sighash is the signature hash to use for transactions spending from the htlc.
// SigHash is the signature hash to use for transactions spending from the htlc.
func (h *HtlcScriptV2) SigHash() txscript.SigHashType {
return txscript.SigHashAll
}
@ -785,7 +785,7 @@ func (h *HtlcScriptV3) SuccessSequence() uint32 {
return 1
}
// Sighash is the signature hash to use for transactions spending from the htlc.
// SigHash is the signature hash to use for transactions spending from the htlc.
func (h *HtlcScriptV3) SigHash() txscript.SigHashType {
return txscript.SigHashDefault
}

View file

@ -658,7 +658,7 @@ type routeCancelMetadata struct {
// outCancelDetails contains the information required to cancel a loop out swap.
type outCancelDetails struct {
// Hash is the swap's hash.
// hash is the swap's hash.
hash lntypes.Hash
// paymentAddr is the payment address for the swap's invoice.

View file

@ -277,7 +277,7 @@ type addSweepsRequest struct {
// source.
sweeps []*sweep
// Notifier is a notifier that is used to notify the requester of this
// notifier is a notifier that is used to notify the requester of this
// sweep that the sweep was successful.
notifier *SpendNotifier

View file

@ -368,9 +368,9 @@ func sufficientHints(numHints, maxHints, scalingFactor int, amount,
return false
}
// SelectHopHints will select up to numMaxHophints from the set of passed open
// channels. The set of hop hints will be returned as a slice of functional
// options that'll append the route hint to the set of all route hints.
// invoicesrpcSelectHopHints will select up to numMaxHophints from the set of
// passed open channels. The set of hop hints will be returned as a slice of
// functional options that'll append the route hint to the set of all hints.
//
// TODO(sputn1ck): remove when https://github.com/lightningnetwork/lnd/pull/7065
// is merged to a new lnd release.