mirror of
				https://github.com/bitcoin/bips.git
				synced 2025-10-27 14:09:10 +00:00 
			
		
		
		
	bip 8: simplify MUST_SIGNAL check
This commit is contained in:
		
							parent
							
								
									518fd3fe07
								
							
						
					
					
						commit
						63d2800fab
					
				| @ -181,16 +181,16 @@ Blocks received while in the MUST_SIGNAL phase must be checked to ensure that th | |||||||
| 
 | 
 | ||||||
|     if (GetStateForBlock(block) == MUST_SIGNAL) { |     if (GetStateForBlock(block) == MUST_SIGNAL) { | ||||||
|         int nonsignal = 0; |         int nonsignal = 0; | ||||||
|         int count = 1 + (block.nHeight % 2016); |  | ||||||
|         walk = block; |         walk = block; | ||||||
|         while (count > 0) { |         while (true) { | ||||||
|             --count; |  | ||||||
|             if ((walk.nVersion & 0xE0000000) != 0x20000000 || ((walk.nVersion >> bit) & 1) != 1) { |             if ((walk.nVersion & 0xE0000000) != 0x20000000 || ((walk.nVersion >> bit) & 1) != 1) { | ||||||
|                 ++nonsignal; |                 ++nonsignal; | ||||||
|                 if (nonsignal + threshold > 2016) { |                 if (nonsignal > 2016 - threshold) { | ||||||
|                     return state.Invalid(BlockValidationResult::RECENT_CONSENSUS_CHANGE, "bad-version-bip8-must-signal"); |                     return state.Invalid(BlockValidationResult::RECENT_CONSENSUS_CHANGE, "bad-version-bip8-must-signal"); | ||||||
|                 } |                 } | ||||||
|             } else if (nonsignal == 0) { |             } | ||||||
|  |             if (walk.nHeight % 2016 == 0) { | ||||||
|  |                 // checked every block in this retarget period | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             walk = walk.parent; |             walk = walk.parent; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user