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" "sync"
) )
// ErrEventRejected is the error returned when the state machine cannot process
// an event in the state that it is in.
var ( 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( ErrWaitForStateTimedOut = errors.New(
"timed out while waiting for event", "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( ErrWaitingForStateEarlyAbortError = errors.New(
"waiting for state early abort", "waiting for state early abort",
) )
@ -91,7 +99,7 @@ type Observer interface {
// StateMachine represents the state machine. // StateMachine represents the state machine.
type StateMachine struct { type StateMachine struct {
// Context represents the state machine context. // States represents the state machine states.
States States States States
// ActionEntryFunc is a function that is called before an action is // 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 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) { func (i *InstantOut) getInputReservations() (InputReservations, error) {
if len(i.Reservations) == 0 { if len(i.Reservations) == 0 {
return nil, errors.New("no reservations") 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. // of the reservation state machine.
func TestAsyncWaitForExpiredOrSweptAction(t *testing.T) { func TestAsyncWaitForExpiredOrSweptAction(t *testing.T) {
tests := []struct { 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. // reservation state machine.
func TestHandleSubcriptions(t *testing.T) { func TestHandleSubcriptions(t *testing.T) {
var ( var (

View file

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

View file

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

View file

@ -369,7 +369,7 @@ func (m *Manager) SetParameters(ctx context.Context,
return m.saveParams(ctx, req) 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. // provided are valid.
func (m *Manager) setParameters(ctx context.Context, func (m *Manager) setParameters(ctx context.Context,
params Parameters) error { 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. // from it.
func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters, func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
error) { 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. // looprpc package.
func marshalFixedPoint(bigIntFixedPoint *rfqmath.BigIntFixedPoint, func marshalFixedPoint(bigIntFixedPoint *rfqmath.BigIntFixedPoint,
) *looprpc.FixedPoint { ) *looprpc.FixedPoint {

View file

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

View file

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

View file

@ -43,7 +43,7 @@ const (
// canceling loop out swaps. // canceling loop out swaps.
ProtocolVersionLoopOutCancel = 7 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. // the server to perform a probe to test inbound liquidty.
ProtocolVersionProbe ProtocolVersion = 8 ProtocolVersionProbe ProtocolVersion = 8

View file

@ -98,7 +98,7 @@ var (
// value: uint32 confirmation value // value: uint32 confirmation value
confirmationsKey = []byte("confirmations") 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. // related info.
liquidityBucket = []byte("liquidity") liquidityBucket = []byte("liquidity")

View file

@ -80,7 +80,7 @@ func (s *StoreMock) FetchLoopOutSwaps(ctx context.Context) ([]*LoopOut, error) {
return result, nil 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. // NOTE: Part of the SwapStore interface.
func (s *StoreMock) FetchLoopOutSwap(ctx context.Context, func (s *StoreMock) FetchLoopOutSwap(ctx context.Context,
@ -261,7 +261,7 @@ func (s *StoreMock) Close() error {
return nil 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 { func (s *StoreMock) IsDone() error {
select { select {
case <-s.loopOutStoreChan: 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. // disk.
func (s *StoreMock) AssertLoopInState( func (s *StoreMock) AssertLoopInState(
expectedState SwapState) SwapStateData { 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 // TestVersionMigrated tests that an existing version zero database is migrated
// the latest version. // to the latest version.
func TestVersionMigrated(t *testing.T) { func TestVersionMigrated(t *testing.T) {
tempDirName, err := ioutil.TempDir("", "clientstore") tempDirName, err := ioutil.TempDir("", "clientstore")
if err != nil { if err != nil {

View file

@ -172,7 +172,7 @@ func (s SwapState) String() string {
// SwapCost is a breakdown of the final swap costs. // SwapCost is a breakdown of the final swap costs.
type SwapCost struct { type SwapCost struct {
// Swap is the amount paid to the server. // Server is the amount paid to the server.
Server btcutil.Amount Server btcutil.Amount
// Onchain is the amount paid to miners for the onchain tx. // 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. // SwapStateData is all persistent data to describe the current swap state.
type SwapStateData struct { type SwapStateData struct {
// SwapState is the state the swap is in. // State is the state the swap is in.
State SwapState State SwapState
// Cost are the accrued (final) costs so far. // 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. // to the point where the off-chain payments are made.
func testLoopOutPaymentParameters(t *testing.T) { func testLoopOutPaymentParameters(t *testing.T) {
defer test.Guard(t)() defer test.Guard(t)()

View file

@ -33,7 +33,7 @@ type Parameters struct {
// timeout path. // timeout path.
ClientPubkey *btcec.PublicKey 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. // used for the 2-of-2 funding output.
ServerPubkey *btcec.PublicKey ServerPubkey *btcec.PublicKey

View file

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

View file

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

View file

@ -31,7 +31,8 @@ const (
// channel opening. // channel opening.
defaultUtxoMinConf = 1 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 defaultConfTarget int32 = 3
) )
@ -47,8 +48,8 @@ var (
// Config is the configuration struct for the open channel manager. // Config is the configuration struct for the open channel manager.
type Config struct { type Config struct {
// StaticAddressServerClient is the client that calls the swap server // Server is the client that calls the swap server rpcs to negotiate
// rpcs to negotiate static address withdrawals. // static address withdrawals.
Server serverrpc.StaticAddressServerClient Server serverrpc.StaticAddressServerClient
// AddressManager gives the withdrawal manager access to static address // 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 is the outpoint of the channel open transaction.
ChanOutpoint *wire.OutPoint 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 err error
} }

View file

@ -135,8 +135,8 @@ type Manager struct {
// initiationHeight stores the currently best known block height. // initiationHeight stores the currently best known block height.
initiationHeight atomic.Uint32 initiationHeight atomic.Uint32
// finalizedWithdrawalTx are the finalized withdrawal transactions that // finalizedWithdrawalTxns are the finalized withdrawal transactions
// are published to the network and re-published on block arrivals. // that are published to the network and re-published on block arrivals.
finalizedWithdrawalTxns map[chainhash.Hash]*wire.MsgTx 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. // uses the v3 (taproot) htlc.
func IsTaprootSwap(swapContract *loopdb.SwapContract) bool { 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 // swapInfo constructs and returns a filled SwapInfo from

View file

@ -477,7 +477,7 @@ func (h *HtlcScriptV2) SuccessSequence() uint32 {
return 1 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 { func (h *HtlcScriptV2) SigHash() txscript.SigHashType {
return txscript.SigHashAll return txscript.SigHashAll
} }
@ -785,7 +785,7 @@ func (h *HtlcScriptV3) SuccessSequence() uint32 {
return 1 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 { func (h *HtlcScriptV3) SigHash() txscript.SigHashType {
return txscript.SigHashDefault return txscript.SigHashDefault
} }

View file

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

View file

@ -277,7 +277,7 @@ type addSweepsRequest struct {
// source. // source.
sweeps []*sweep 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. // sweep that the sweep was successful.
notifier *SpendNotifier notifier *SpendNotifier

View file

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