Skip to content

Commit

Permalink
Merge pull request #10 from blinklabs-io/fix/quiet-golangci-lint
Browse files Browse the repository at this point in the history
fix: quiet golangci-lint (mostly)
  • Loading branch information
wolf31o2 authored Aug 30, 2023
2 parents 986fec5 + f70f87c commit f42268d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
10 changes: 6 additions & 4 deletions internal/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Indexer struct {
}

type Datum struct {
nonce []byte
nonce uint64
state State

Check failure on line 28 in internal/indexer/indexer.go

View workflow job for this annotation

GitHub Actions / lint (1.19.x, ubuntu-latest)

field `state` is unused (unused)
}

Expand Down Expand Up @@ -147,11 +147,13 @@ func (i *Indexer) handleEvent(evt event.Event) error {
return err
}
datumFields := datum.Value().(cbor.Constructor).Fields()
nonce := datumFields[0]
state := datumFields[1]
var data = Datum{
nonce: datumFields[0].(uint64),
}
state := datumFields[1].(cbor.ByteString).String()
// TODO: do the thing

logger.Infof("found updated datum: nonce: %d, state: %#v", nonce, state)
logger.Infof("found updated datum: nonce: %d, state: %s", data.nonce, state)
}
}
return nil
Expand Down
17 changes: 16 additions & 1 deletion internal/miner/nonce.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
// Copyright 2023 Blink Labs, LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package miner

import "crypto/rand"

func GenerateNonce() []byte {
nonce := make([]byte, 16)
rand.Read(nonce)
// toss error
_, _ = rand.Read(nonce)
return nonce
}

Expand Down

0 comments on commit f42268d

Please sign in to comment.