rpc: fix code style

This commit is contained in:
Slyghtning 2023-04-23 20:01:11 +02:00
parent 903b5dde89
commit 8f5910bf91

View File

@ -390,8 +390,8 @@ func (w *WalletKit) ListUnspent(ctx context.Context,
// Force min_confs and max_confs to be zero if unconfirmed_only is // Force min_confs and max_confs to be zero if unconfirmed_only is
// true. // true.
if req.UnconfirmedOnly && (req.MinConfs != 0 || req.MaxConfs != 0) { if req.UnconfirmedOnly && (req.MinConfs != 0 || req.MaxConfs != 0) {
return nil, fmt.Errorf("min_confs and max_confs must be zero if " + return nil, fmt.Errorf("min_confs and max_confs must be zero " +
"unconfirmed_only is true") "if unconfirmed_only is true")
} }
// When unconfirmed_only is inactive and max_confs is zero (default // When unconfirmed_only is inactive and max_confs is zero (default
@ -674,7 +674,9 @@ func (w *WalletKit) SendOutputs(ctx context.Context,
// Then, we'll extract the minimum number of confirmations that each // Then, we'll extract the minimum number of confirmations that each
// output we use to fund the transaction should satisfy. // output we use to fund the transaction should satisfy.
minConfs, err := lnrpc.ExtractMinConfs(req.MinConfs, req.SpendUnconfirmed) minConfs, err := lnrpc.ExtractMinConfs(
req.MinConfs, req.SpendUnconfirmed,
)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -710,7 +712,8 @@ func (w *WalletKit) SendOutputs(ctx context.Context,
// requirement, we can request that the wallet attempts to create this // requirement, we can request that the wallet attempts to create this
// transaction. // transaction.
tx, err := w.cfg.Wallet.SendOutputs( tx, err := w.cfg.Wallet.SendOutputs(
outputsToCreate, chainfee.SatPerKWeight(req.SatPerKw), minConfs, label, outputsToCreate, chainfee.SatPerKWeight(req.SatPerKw), minConfs,
label,
) )
if err != nil { if err != nil {
return nil, err return nil, err
@ -944,7 +947,10 @@ func (w *WalletKit) BumpFee(ctx context.Context,
err) err)
} }
inp := input.NewBaseInput(op, witnessType, signDesc, uint32(currentHeight)) inp := input.NewBaseInput(
op, witnessType, signDesc, uint32(currentHeight),
)
sweepParams := sweep.Params{Fee: feePreference} sweepParams := sweep.Params{Fee: feePreference}
if _, err = w.cfg.Sweeper.SweepInput(inp, sweepParams); err != nil { if _, err = w.cfg.Sweeper.SweepInput(inp, sweepParams); err != nil {
return nil, err return nil, err
@ -1545,7 +1551,8 @@ func (w *WalletKit) ListAccounts(ctx context.Context,
keyScopeFilter = &keyScope keyScopeFilter = &keyScope
default: default:
return nil, fmt.Errorf("unhandled address type %v", req.AddressType) return nil, fmt.Errorf("unhandled address type %v",
req.AddressType)
} }
accounts, err := w.cfg.Wallet.ListAccounts(req.Name, keyScopeFilter) accounts, err := w.cfg.Wallet.ListAccounts(req.Name, keyScopeFilter)
@ -1659,7 +1666,8 @@ func parseAddrType(addrType AddressType,
switch addrType { switch addrType {
case AddressType_UNKNOWN: case AddressType_UNKNOWN:
if required { if required {
return nil, errors.New("an address type must be specified") return nil, fmt.Errorf("an address type must be " +
"specified")
} }
return nil, nil return nil, nil