Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
bufrr committed Feb 28, 2023
1 parent 8058ca5 commit 8899a30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
gocache "github.com/patrickmn/go-cache"
)

// Cache is an anstract cache layer
// Cache is an abstract cache layer
type Cache interface {
Add(key []byte, value interface{}) error
Get(key []byte) (value interface{}, ok bool)
Expand Down
12 changes: 6 additions & 6 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (consensus *Consensus) startElection(height uint32, elc *election.Election)

electedBlockHash, ok := result.(common.Uint256)
if !ok {
return common.EmptyUint256, fmt.Errorf("Convert election result to block hash error")
return common.EmptyUint256, fmt.Errorf("convert election result to block hash error")
}

log.Infof("Elected block hash %s got %d/%d neighbor votes, weight: %d (%.2f%%)", electedBlockHash.ToHexString(), len(elc.GetNeighborIDsByVote(electedBlockHash)), elc.NeighborVoteCount(), absWeight, relWeight*100)
Expand Down Expand Up @@ -314,10 +314,10 @@ func (consensus *Consensus) saveAcceptedBlock(electedBlockHash common.Uint256) e

elc, loaded, err := consensus.loadOrCreateElection(block.Header.UnsignedHeader.Height)
if err != nil {
return fmt.Errorf("Error load election: %v", err)
return fmt.Errorf("error load election: %v", err)
}
if !loaded {
return fmt.Errorf("Election is created instead of loaded")
return fmt.Errorf("election is created instead of loaded")
}

neighborIDs := elc.GetNeighborIDsByVote(electedBlockHash)
Expand Down Expand Up @@ -371,12 +371,12 @@ func (consensus *Consensus) saveBlocksAcceptedDuringSync(startHeight uint32) err
value, ok := consensus.elections.Get(heightToKey(height))
consensus.electionsLock.RUnlock()
if !ok || value == nil {
return fmt.Errorf("Election at height %d not found in local cache", height)
return fmt.Errorf("election at height %d not found in local cache", height)
}

elc, ok := value.(*election.Election)
if !ok || elc == nil {
return fmt.Errorf("Convert election at height %d from cache error", height)
return fmt.Errorf("convert election at height %d from cache error", height)
}

result, _, _, err := elc.GetResult()
Expand All @@ -386,7 +386,7 @@ func (consensus *Consensus) saveBlocksAcceptedDuringSync(startHeight uint32) err

electedBlockHash, ok := result.(common.Uint256)
if !ok {
return fmt.Errorf("Convert election result to block hash error")
return fmt.Errorf("convert election result to block hash error")
}

block, err := consensus.getBlockProposal(electedBlockHash)
Expand Down
2 changes: 1 addition & 1 deletion node/remotenode.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (remoteNode *RemoteNode) SendBytesSync(buf []byte) ([]byte, error) {
func (remoteNode *RemoteNode) SendBytesSyncWithTimeout(buf []byte, replyTimeout time.Duration) ([]byte, error) {
reply, _, err := remoteNode.localNode.GetNnet().SendBytesDirectSyncWithTimeout(buf, remoteNode.NnetNode, replyTimeout)
if err != nil {
log.Debugf("Error sending sync messge to node: %v", err.Error())
log.Debugf("Error sending sync message to node: %v", err.Error())
}
return reply, err
}
Expand Down

0 comments on commit 8899a30

Please sign in to comment.