Skip to content

Commit

Permalink
fix issues identified by golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Dec 6, 2023
1 parent 987d6e3 commit 5a49750
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions internal/syncerutil/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EphemeralPeerStore struct {
mu sync.Mutex
}

func (eps *EphemeralPeerStore) banned(peer string) bool {
func (eps *EphemeralPeerStore) peerBanned(peer string) bool {
host, _, err := net.SplitHostPort(peer)
if err != nil {
return false // shouldn't happen
Expand Down Expand Up @@ -60,7 +60,7 @@ func (eps *EphemeralPeerStore) Peers() []string {
defer eps.mu.Unlock()
var peers []string
for p := range eps.peers {
if !eps.banned(p) {
if !eps.peerBanned(p) {
peers = append(peers, p)
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ func (eps *EphemeralPeerStore) Ban(peer string, duration time.Duration, reason s
func (eps *EphemeralPeerStore) Banned(peer string) bool {
eps.mu.Lock()
defer eps.mu.Unlock()
return eps.banned(peer)
return eps.peerBanned(peer)
}

// NewEphemeralPeerStore initializes an EphemeralPeerStore.
Expand Down
1 change: 1 addition & 0 deletions internal/walletutil/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

var errNoWallet = errors.New("wallet does not exist")

// A ChainManager manages blockchain state.
type ChainManager interface {
AddSubscriber(s chain.Subscriber, tip types.ChainIndex) error
RemoveSubscriber(s chain.Subscriber)
Expand Down
12 changes: 7 additions & 5 deletions wallet/seed.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ outer:
for _, parent := range toSign {
for sigIndex, sig := range txn.Signatures {
if sig.ParentID == parent {
if addr, ok := sigAddr(parent); !ok {
addr, ok := sigAddr(parent)
if !ok {
return fmt.Errorf("ID %v not present in transaction", parent)
} else if index, ok := sav.addrs[addr]; !ok {
}
index, ok := sav.addrs[addr]
if !ok {
return fmt.Errorf("missing key for ID %v", parent)
} else {
SignTransaction(cs, txn, sigIndex, sav.seed.PrivateKey(index))
continue outer
}
SignTransaction(cs, txn, sigIndex, sav.seed.PrivateKey(index))
continue outer
}
}
return fmt.Errorf("signature %v not present in transaction", parent)
Expand Down
6 changes: 6 additions & 0 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ type V2FileContract struct {
Outputs []types.SiacoinElement `json:"outputs,omitempty"`
}

// An EventTransaction is a relevant transaction that happened on the Sia
// blockchain.
type EventTransaction struct {
ID types.TransactionID `json:"id"`
SiacoinInputs []types.SiacoinElement `json:"siacoinInputs"`
Expand All @@ -240,10 +242,14 @@ type EventTransaction struct {
Fee types.Currency `json:"fee"`
}

// An EventMinerPayout is a relevant miner payout that happened on the Sia
// blockchain.
type EventMinerPayout struct {
SiacoinOutput types.SiacoinElement `json:"siacoinOutput"`
}

// An EventMissedFileContract is a relevant missed file contract that happened
// on the Sia blockchain.
type EventMissedFileContract struct {
FileContract types.FileContractElement `json:"fileContract"`
MissedOutputs []types.SiacoinElement `json:"missedOutputs"`
Expand Down

0 comments on commit 5a49750

Please sign in to comment.