Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacia committed Oct 27, 2018
1 parent 3f7c50a commit 79ee44c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 24 deletions.
9 changes: 9 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions bchd_checkout.sh

This file was deleted.

10 changes: 3 additions & 7 deletions blockmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,8 @@ func (b *blockManager) getCheckpointedCFHeaders(checkpoints []*chainhash.Hash,
// Each checkpoint is spaced wire.CFCheckptInterval after the
// prior one, so we'll fetch headers in batches using the
// checkpoints as a guide.
startHeightRange := uint32(
currentInterval*wire.CFCheckptInterval,
) + 1
endHeightRange := uint32(
(currentInterval + 1) * wire.CFCheckptInterval,
)
startHeightRange := currentInterval*wire.CFCheckptInterval + 1
endHeightRange := (currentInterval + 1) * wire.CFCheckptInterval

log.Tracef("Checkpointed cfheaders request start_range=%v, "+
"end_range=%v", startHeightRange, endHeightRange)
Expand All @@ -835,7 +831,7 @@ func (b *blockManager) getCheckpointedCFHeaders(checkpoints []*chainhash.Hash,
// Once we have the stop hash, we can construct the query
// message itself.
queryMsg := wire.NewMsgGetCFHeaders(
fType, uint32(startHeightRange), &stopHash,
fType, startHeightRange, &stopHash,
)

// We'll mark that the ith interval is queried by this message,
Expand Down
12 changes: 3 additions & 9 deletions headerfs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import (

// appendRaw appends a new raw header to the end of the flat file.
func (h *headerStore) appendRaw(header []byte) error {
if _, err := h.file.Write(header); err != nil {
return err
}

return nil
_, err := h.file.Write(header)
return err
}

// readRaw reads a raw header from disk from a particular seek distance. The
Expand Down Expand Up @@ -122,10 +119,7 @@ func (h *blockHeaderStore) readHeader(height uint32) (wire.BlockHeader, error) {
headerReader := bytes.NewReader(rawHeader)

// Finally, decode the raw bytes into a proper bitcoin header.
if err := header.Deserialize(headerReader); err != nil {
return header, err
}

err = header.Deserialize(headerReader)
return header, nil
}

Expand Down
1 change: 1 addition & 0 deletions headerlist/bounded_header_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (b *BoundedMemoryChain) PushBack(n Node) *Node {
return &b.chain[chainIndex]
}

// FetchHeaderAncestors will return the requested number of ancestors for the given node
func (b *BoundedMemoryChain) FetchHeaderAncestors(n *Node, numNodes int) []*wire.BlockHeader {
var headers []*wire.BlockHeader
for i := 0; i < numNodes; i++ {
Expand Down
2 changes: 1 addition & 1 deletion neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ func (s *ChainService) handleAddPeerMsg(state *peerState, sp *ServerPeer) bool {
if banEnd, ok := state.banned[host]; ok {
if time.Now().Before(banEnd) {
log.Debugf("Peer %s is banned for another %v - disconnecting",
host, banEnd.Sub(time.Now()))
host, time.Until(banEnd))
sp.Disconnect()
return false
}
Expand Down
2 changes: 1 addition & 1 deletion query.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ func (s *ChainService) GetBlock(blockHash chainhash.Hash,
}

// Add block to the cache before returning it.
err = s.BlockCache.Put(*inv, &cache.CacheableBlock{foundBlock})
err = s.BlockCache.Put(*inv, &cache.CacheableBlock{Block: foundBlock})
if err != nil {
log.Warnf("couldn't write block to cache: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
maxPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)

// blockDataNet is the expected network in the test block data.
blockDataNet = wire.MainNet
blockDataNet = wire.BitcoinNet(0xd9b4bef9)

// blockDataFile is the path to a file containing the first 256 blocks
// of the block chain.
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestBlockCache(t *testing.T) {
}
headers.WriteHeaders(header)

sz, _ := (&cache.CacheableBlock{b}).Size()
sz, _ := (&cache.CacheableBlock{Block: b}).Size()
if i < len(blocks)/2 {
size += sz
}
Expand Down
1 change: 0 additions & 1 deletion sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@ func testRandomBlocks(harness *neutrinoHarness, t *testing.T) {
if lastErr != nil {
t.Fatal(lastErr)
}
return
}

func TestNeutrinoSync(t *testing.T) {
Expand Down

0 comments on commit 79ee44c

Please sign in to comment.