Bitcoin in RegTest throw (bad-cb-height) at block No. 500
the problem is an incorrect implementation of BIP-0034 in my code, I thought the length of height should be at least 3 bytes which I was wrong,
&quot;Coding Enthusiast&quot; says :
&quot;The block height has to be pushed with the minimal number of bytes:
Since BIP-34 activates at block 500 on RegTest, this is ignored on all blocks from height 1 to 499 and from block height 500 it starts being enforced and the invalid push is rejected.&quot;
the description of the answer is here: bitcointalk.org/index.php?topic=5293244.0