File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed
xcode/DirectBindingsApp/DirectBindingsApp/app-batteries Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change @@ -193,15 +193,14 @@ class BlockchainObserver {
193
193
}
194
194
195
195
// create an array of the new blocks
196
- // the variable is called anchored because there should be an overlap of one
197
196
var addedBlocks = [ RPCBlockDetails] ( )
198
197
for addedBlockHeight in ( knownChaintip. height + 1 ) ... currentChaintipHeight {
199
198
let addedBlockHash = try await self . getBlockHash ( height: addedBlockHeight)
200
199
let addedBlock = try await self . getBlock ( hash: addedBlockHash)
201
200
addedBlocks. append ( addedBlock)
202
201
}
203
202
204
- while addedBlocks. first!. previousblockhash != self . connectedBlocks. last!. hash {
203
+ while addedBlocks. isEmpty || addedBlocks . first!. previousblockhash != self . connectedBlocks. last!. hash {
205
204
// we must keep popping until it matches
206
205
let trimmedLocalTip = try await self . disconnectBlock ( )
207
206
let reorgedBlockHash = try await self . getBlockHash ( height: trimmedLocalTip. height)
You can’t perform that action at this time.
0 commit comments