From 1b5dfb3e7881f5933ed0f88f1cf4989f34867337 Mon Sep 17 00:00:00 2001 From: Artem Barger Date: Tue, 6 Dec 2016 18:23:51 +0200 Subject: [PATCH] Fix golint warning for gossip state package Fixed code comments to remove golint warnings. Change-Id: If732f1ce7067e304df47d112edb4761faaa9800e Signed-off-by: Artem Barger --- gossip/state/metastate.go | 10 +++++----- gossip/state/state.go | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gossip/state/metastate.go b/gossip/state/metastate.go index 5560b908450..2e604d8a1ca 100644 --- a/gossip/state/metastate.go +++ b/gossip/state/metastate.go @@ -21,7 +21,7 @@ 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 { @@ -29,12 +29,12 @@ type NodeMetastate struct { 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 @@ -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 } @@ -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) diff --git a/gossip/state/state.go b/gossip/state/state.go index 513c12041f3..cab2b2653cc 100644 --- a/gossip/state/state.go +++ b/gossip/state/state.go @@ -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 @@ -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) }