|
|
@ -56,15 +56,16 @@ function withMissingBlocks (reducer) { |
|
|
|
|
|
|
|
|
|
|
|
if (result.items.length < 2) return result |
|
|
|
if (result.items.length < 2) return result |
|
|
|
|
|
|
|
|
|
|
|
const maxBlock = getBlockNumber(_.first(result.items)) |
|
|
|
|
|
|
|
const minBlock = getBlockNumber(_.last(result.items)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const blockNumbersToItems = result.items.reduce((acc, item) => { |
|
|
|
const blockNumbersToItems = result.items.reduce((acc, item) => { |
|
|
|
const blockNumber = getBlockNumber(item) |
|
|
|
const blockNumber = getBlockNumber(item) |
|
|
|
acc[blockNumber] = acc[blockNumber] || item |
|
|
|
acc[blockNumber] = acc[blockNumber] || item |
|
|
|
return acc |
|
|
|
return acc |
|
|
|
}, {}) |
|
|
|
}, {}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const blockNumbers = _(blockNumbersToItems).keys().map(x => parseInt(x, 10)).value() |
|
|
|
|
|
|
|
const minBlock = _.min(blockNumbers) |
|
|
|
|
|
|
|
const maxBlock = _.max(blockNumbers) |
|
|
|
|
|
|
|
|
|
|
|
return Object.assign({}, result, { |
|
|
|
return Object.assign({}, result, { |
|
|
|
items: _.rangeRight(minBlock, maxBlock + 1) |
|
|
|
items: _.rangeRight(minBlock, maxBlock + 1) |
|
|
|
.map((blockNumber) => blockNumbersToItems[blockNumber] || placeHolderBlock(blockNumber)) |
|
|
|
.map((blockNumber) => blockNumbersToItems[blockNumber] || placeHolderBlock(blockNumber)) |
|
|
|