multi: fix linter issues

Fix some issues found by the new nonamedreturn rule and rename some
nolint comment to the new rule name.
This commit is contained in:
Oliver Gugger
2022-07-14 09:30:53 +02:00
parent da75619245
commit 850330a34e
3 changed files with 15 additions and 16 deletions

View File

@@ -531,7 +531,7 @@ func (ns *NurseryStore) GraduateKinder(height uint32, kid *kidOutput) error {
// FetchClass returns a list of the kindergarten and crib outputs whose timeouts // FetchClass returns a list of the kindergarten and crib outputs whose timeouts
// are expiring // are expiring
func (ns *NurseryStore) FetchClass( func (ns *NurseryStore) FetchClass(
height uint32) ([]kidOutput, []babyOutput, error) { // nolint:golint height uint32) ([]kidOutput, []babyOutput, error) { // nolint:revive
// Construct list of all crib and kindergarten outputs that need to be // Construct list of all crib and kindergarten outputs that need to be
// processed at the provided block height. // processed at the provided block height.
@@ -592,7 +592,7 @@ func (ns *NurseryStore) FetchClass(
// FetchPreschools returns a list of all outputs currently stored in the // FetchPreschools returns a list of all outputs currently stored in the
// preschool bucket. // preschool bucket.
func (ns *NurseryStore) FetchPreschools() ([]kidOutput, error) { // nolint:golint func (ns *NurseryStore) FetchPreschools() ([]kidOutput, error) { // nolint:revive
var kids []kidOutput var kids []kidOutput
if err := kvdb.View(ns.db, func(tx kvdb.RTx) error { if err := kvdb.View(ns.db, func(tx kvdb.RTx) error {
// Retrieve the existing chain bucket for this nursery store. // Retrieve the existing chain bucket for this nursery store.

View File

@@ -147,28 +147,27 @@ func MarshalUtxos(utxos []*lnwallet.Utxo, activeNetParams *chaincfg.Params) (
// MarshallOutputType translates a txscript.ScriptClass into a // MarshallOutputType translates a txscript.ScriptClass into a
// lnrpc.OutputScriptType. // lnrpc.OutputScriptType.
func MarshallOutputType(o txscript.ScriptClass) (ret OutputScriptType) { func MarshallOutputType(o txscript.ScriptClass) OutputScriptType {
// Translate txscript ScriptClass type to the proper gRPC proto // Translate txscript ScriptClass type to the proper gRPC proto
// output script type. // output script type.
switch o { switch o {
case txscript.PubKeyHashTy:
ret = OutputScriptType_SCRIPT_TYPE_PUBKEY_HASH
case txscript.ScriptHashTy: case txscript.ScriptHashTy:
ret = OutputScriptType_SCRIPT_TYPE_SCRIPT_HASH return OutputScriptType_SCRIPT_TYPE_SCRIPT_HASH
case txscript.WitnessV0PubKeyHashTy: case txscript.WitnessV0PubKeyHashTy:
ret = OutputScriptType_SCRIPT_TYPE_WITNESS_V0_PUBKEY_HASH return OutputScriptType_SCRIPT_TYPE_WITNESS_V0_PUBKEY_HASH
case txscript.WitnessV0ScriptHashTy: case txscript.WitnessV0ScriptHashTy:
ret = OutputScriptType_SCRIPT_TYPE_WITNESS_V0_SCRIPT_HASH return OutputScriptType_SCRIPT_TYPE_WITNESS_V0_SCRIPT_HASH
case txscript.PubKeyTy: case txscript.PubKeyTy:
ret = OutputScriptType_SCRIPT_TYPE_PUBKEY return OutputScriptType_SCRIPT_TYPE_PUBKEY
case txscript.MultiSigTy: case txscript.MultiSigTy:
ret = OutputScriptType_SCRIPT_TYPE_MULTISIG return OutputScriptType_SCRIPT_TYPE_MULTISIG
case txscript.NullDataTy: case txscript.NullDataTy:
ret = OutputScriptType_SCRIPT_TYPE_NULLDATA return OutputScriptType_SCRIPT_TYPE_NULLDATA
case txscript.NonStandardTy: case txscript.NonStandardTy:
ret = OutputScriptType_SCRIPT_TYPE_NON_STANDARD return OutputScriptType_SCRIPT_TYPE_NON_STANDARD
case txscript.WitnessUnknownTy: case txscript.WitnessUnknownTy:
ret = OutputScriptType_SCRIPT_TYPE_WITNESS_UNKNOWN return OutputScriptType_SCRIPT_TYPE_WITNESS_UNKNOWN
default:
return OutputScriptType_SCRIPT_TYPE_PUBKEY_HASH
} }
return
} }

View File

@@ -60,8 +60,8 @@ type testContext struct {
// newTestContext populates a new testContext struct with the constant // newTestContext populates a new testContext struct with the constant
// parameters defined in the BOLT 03 spec. // parameters defined in the BOLT 03 spec.
func newTestContext(t *testing.T) (tc *testContext) { func newTestContext(t *testing.T) *testContext {
tc = new(testContext) tc := new(testContext)
priv := func(v string) *btcec.PrivateKey { priv := func(v string) *btcec.PrivateKey {
k, err := privkeyFromHex(v) k, err := privkeyFromHex(v)