Skip to content

Commit

Permalink
Fix golint warning for gossip state package
Browse files Browse the repository at this point in the history
Fixed code comments to remove golint warnings.

Change-Id: If732f1ce7067e304df47d112edb4761faaa9800e
Signed-off-by: Artem Barger <bartem@il.ibm.com>
  • Loading branch information
C0rWin committed Dec 6, 2016
1 parent ede30a4 commit 1b5dfb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gossip/state/metastate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ import (
"encoding/binary"
)

// Metadata information to store the information about current
// NodeMetastate information to store the information about current
// height of the ledger (last accepted block sequence number).
type NodeMetastate struct {

// Actual ledger height
LedgerHeight uint64
}

// Create new meta data with given ledger height148.69
// NewNodeMetastate creates new meta data with given ledger height148.69
func NewNodeMetastate(height uint64) *NodeMetastate {
return &NodeMetastate{height}
}

// Decodes meta state into byte array for serialization
// Bytes decodes meta state into byte array for serialization
func (n *NodeMetastate) Bytes() ([]byte, error) {
buffer := new(bytes.Buffer)
// Explicitly specify byte order for write into the buffer
Expand All @@ -47,7 +47,7 @@ func (n *NodeMetastate) Bytes() ([]byte, error) {
return buffer.Bytes(), nil
}

// Get ledger height from the state
// Height returns ledger height from the state
func (n *NodeMetastate) Height() uint64 {
return n.LedgerHeight
}
Expand All @@ -57,7 +57,7 @@ func (n *NodeMetastate) Update(height uint64) {
n.LedgerHeight = height
}

// Encode from byte array into meta data structure
// FromBytes - encode from byte array into meta data structure
func FromBytes(buf []byte) (*NodeMetastate, error) {
state := NodeMetastate{}
reader := bytes.NewReader(buf)
Expand Down
3 changes: 3 additions & 0 deletions gossip/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ func (s *GossipStateProviderImpl) requestBlocksInRange(start uint64, end uint64)
}, peer)
}


// GetBlock return ledger block given its sequence number as a parameter
func (s *GossipStateProviderImpl) GetBlock(index uint64) *common.Block {
// Try to read missing block from the ledger, should return no nil with
// content including at least one block
Expand All @@ -377,6 +379,7 @@ func (s *GossipStateProviderImpl) GetBlock(index uint64) *common.Block {
return nil
}

// AddPayload add new payload into state
func (s *GossipStateProviderImpl) AddPayload(payload *proto.Payload) error {
return s.payloads.Push(payload)
}
Expand Down

0 comments on commit 1b5dfb3

Please sign in to comment.