@@ -163,7 +163,7 @@ func (m *Manager) History() ([32]types.BlockID, error) {
163
163
// present in the best chain (or, if no match is found, genesis). It also
164
164
// returns the number of blocks between the end of the returned slice and the
165
165
// 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 ) {
167
167
m .mu .Lock ()
168
168
defer m .mu .Unlock ()
169
169
var attachHeight uint64
@@ -175,10 +175,10 @@ func (m *Manager) BlocksForHistory(history []types.BlockID, max uint64) ([]types
175
175
break
176
176
}
177
177
}
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
180
180
}
181
- blocks := make ([]types.Block , max )
181
+ blocks := make ([]types.Block , maxBlocks )
182
182
for i := range blocks {
183
183
index , _ := m .store .BestIndex (attachHeight + uint64 (i ) + 1 )
184
184
b , _ , ok := m .store .Block (index .ID )
@@ -187,7 +187,7 @@ func (m *Manager) BlocksForHistory(history []types.BlockID, max uint64) ([]types
187
187
}
188
188
blocks [i ] = b
189
189
}
190
- return blocks , m .tipState .Index .Height - (attachHeight + max ), nil
190
+ return blocks , m .tipState .Index .Height - (attachHeight + maxBlocks ), nil
191
191
}
192
192
193
193
// 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 {
395
395
396
396
// UpdatesSince returns at most max updates on the path between index and the
397
397
// 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 ) {
399
399
m .mu .Lock ()
400
400
defer m .mu .Unlock ()
401
401
onBestChain := func (index types.ChainIndex ) bool {
402
402
bi , _ := m .store .BestIndex (index .Height )
403
403
return bi .ID == index .ID || index == types.ChainIndex {}
404
404
}
405
405
406
- for index != m .tipState .Index && len (rus )+ len (aus ) <= max {
406
+ for index != m .tipState .Index && len (rus )+ len (aus ) <= maxBlocks {
407
407
// revert until we are on the best chain, then apply
408
408
if ! onBestChain (index ) {
409
409
b , bs , cs , ok := blockAndParent (m .store , index .ID )
0 commit comments