@@ -62,7 +62,7 @@ contract SPVContract is ISPVContract, Initializable {
6262 );
6363
6464 require (
65- TargetsHelper.isTargetAdjustmentBlock (blockHeight_),
65+ blockHeight_ == 0 || TargetsHelper.isTargetAdjustmentBlock (blockHeight_),
6666 InvalidInitialBlockHeight (blockHeight_)
6767 );
6868
@@ -92,7 +92,7 @@ contract SPVContract is ISPVContract, Initializable {
9292 uint256 firstBlockHeight_ = getBlockHeight (blockHeaders_[0 ].prevBlockHash) + 1 ;
9393 bytes32 currentTarget_ = getBlockTarget (blockHeaders_[0 ].prevBlockHash);
9494
95- for (uint256 i = 0 ; i < blockHeaderRawArray_.length ; i ++ ) {
95+ for (uint256 i = 0 ; i < blockHeaderRawArray_.length ; ++ i ) {
9696 uint256 currentBlockHeight_ = firstBlockHeight_ + i;
9797
9898 currentTarget_ = _updateLastEpochCumulativeWork (currentTarget_, currentBlockHeight_);
@@ -260,7 +260,7 @@ contract SPVContract is ISPVContract, Initializable {
260260 $.blocksHeightToBlockHash[prevBlockHeight_] = prevBlockHash_;
261261
262262 prevBlockHash_ = _getBlockHeader (prevBlockHash_).prevBlockHash;
263- prevBlockHeight_ -= 1 ;
263+ -- prevBlockHeight_ ;
264264 } while (getBlockHash (prevBlockHeight_) != prevBlockHash_ && prevBlockHash_ != 0 );
265265 }
266266 }
@@ -298,7 +298,7 @@ contract SPVContract is ISPVContract, Initializable {
298298 blockHeaders_ = new BlockHeaderData [](blockHeaderRawArray_.length );
299299 blockHashes_ = new bytes32 [](blockHeaderRawArray_.length );
300300
301- for (uint256 i = 0 ; i < blockHeaderRawArray_.length ; i ++ ) {
301+ for (uint256 i = 0 ; i < blockHeaderRawArray_.length ; ++ i ) {
302302 (blockHeaders_[i], blockHashes_[i]) = _parseBlockHeaderRaw (blockHeaderRawArray_[i]);
303303
304304 if (i == 0 ) {
0 commit comments