Skip to content

Commit faab4a9

Browse files
chain: fix lint
1 parent d0af6e2 commit faab4a9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

chain/manager.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (m *Manager) History() ([32]types.BlockID, error) {
163163
// present in the best chain (or, if no match is found, genesis). It also
164164
// returns the number of blocks between the end of the returned slice and the
165165
// current tip.
166-
func (m *Manager) BlocksForHistory(history []types.BlockID, max uint64) ([]types.Block, uint64, error) {
166+
func (m *Manager) BlocksForHistory(history []types.BlockID, maxBlocks uint64) ([]types.Block, uint64, error) {
167167
m.mu.Lock()
168168
defer m.mu.Unlock()
169169
var attachHeight uint64
@@ -175,10 +175,10 @@ func (m *Manager) BlocksForHistory(history []types.BlockID, max uint64) ([]types
175175
break
176176
}
177177
}
178-
if max > m.tipState.Index.Height-attachHeight {
179-
max = m.tipState.Index.Height - attachHeight
178+
if maxBlocks > m.tipState.Index.Height-attachHeight {
179+
maxBlocks = m.tipState.Index.Height - attachHeight
180180
}
181-
blocks := make([]types.Block, max)
181+
blocks := make([]types.Block, maxBlocks)
182182
for i := range blocks {
183183
index, _ := m.store.BestIndex(attachHeight + uint64(i) + 1)
184184
b, _, ok := m.store.Block(index.ID)
@@ -187,7 +187,7 @@ func (m *Manager) BlocksForHistory(history []types.BlockID, max uint64) ([]types
187187
}
188188
blocks[i] = b
189189
}
190-
return blocks, m.tipState.Index.Height - (attachHeight + max), nil
190+
return blocks, m.tipState.Index.Height - (attachHeight + maxBlocks), nil
191191
}
192192

193193
// AddBlocks adds a sequence of blocks to a tracked chain. If the blocks are
@@ -395,15 +395,15 @@ func (m *Manager) reorgTo(index types.ChainIndex) error {
395395

396396
// UpdatesSince returns at most max updates on the path between index and the
397397
// Manager's current tip.
398-
func (m *Manager) UpdatesSince(index types.ChainIndex, max int) (rus []RevertUpdate, aus []ApplyUpdate, err error) {
398+
func (m *Manager) UpdatesSince(index types.ChainIndex, maxBlocks int) (rus []RevertUpdate, aus []ApplyUpdate, err error) {
399399
m.mu.Lock()
400400
defer m.mu.Unlock()
401401
onBestChain := func(index types.ChainIndex) bool {
402402
bi, _ := m.store.BestIndex(index.Height)
403403
return bi.ID == index.ID || index == types.ChainIndex{}
404404
}
405405

406-
for index != m.tipState.Index && len(rus)+len(aus) <= max {
406+
for index != m.tipState.Index && len(rus)+len(aus) <= maxBlocks {
407407
// revert until we are on the best chain, then apply
408408
if !onBestChain(index) {
409409
b, bs, cs, ok := blockAndParent(m.store, index.ID)

syncer/peer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ func (p *Peer) RelayV2TransactionSet(index types.ChainIndex, txns []types.V2Tran
199199
// SendV2Blocks requests up to n blocks from p, starting from the most recent
200200
// element of history known to p. The peer also returns the number of remaining
201201
// blocks left to sync.
202-
func (p *Peer) SendV2Blocks(history []types.BlockID, max uint64, timeout time.Duration) ([]types.Block, uint64, error) {
203-
r := &gateway.RPCSendV2Blocks{History: history, Max: max}
202+
func (p *Peer) SendV2Blocks(history []types.BlockID, maxBlocks uint64, timeout time.Duration) ([]types.Block, uint64, error) {
203+
r := &gateway.RPCSendV2Blocks{History: history, Max: maxBlocks}
204204
err := p.callRPC(r, timeout)
205205
return r.Blocks, r.Remaining, err
206206
}

0 commit comments

Comments
 (0)