Bitcoin Forum
May 03, 2024, 05:14:52 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Having coinbase TX troubles on RegTest  (Read 148 times)
McStone (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 5


View Profile
November 25, 2020, 05:27:57 PM
 #1

Hi there,

I'm playing around with some self written mining software (using GPU) on my two node regtest network.


While submitting the first 499 blocks from my miner SW works fine, I've got the 500th block denied:

Quote
ERROR: ProcessNewBlock: AcceptBlock FAILED (bad-cb-height, block height mismatch in coinbase)

I've looked into it, and I guess that my height in the sigscript is wrong. Too bad I can't figure out the problem, as it all seems fine for me.

Block 499 coinbase tx serialized data: height is given as f3010000
Quote
02000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0a04f30100000401000000feffffff0140be4025000000001976a914cf2a342892313764d1e3 8d790bf37cf3a25f3f0688ac00000000

Block 500 coinbase tx serialized data:height is given as f4010000
Quote
02000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0a04f40100000401000000feffffff0140be4025000000001976a914cf2a342892313764d1e3 8d790bf37cf3a25f3f0688ac00000000

any thoughts / hints from your side??

Cheers & thanks

McStone

1714756492
Hero Member
*
Offline Offline

Posts: 1714756492

View Profile Personal Message (Offline)

Ignore
1714756492
Reply with quote  #2

1714756492
Report to moderator
1714756492
Hero Member
*
Offline Offline

Posts: 1714756492

View Profile Personal Message (Offline)

Ignore
1714756492
Reply with quote  #2

1714756492
Report to moderator
The network tries to produce one block per 10 minutes. It does this by automatically adjusting how difficult it is to produce blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714756492
Hero Member
*
Offline Offline

Posts: 1714756492

View Profile Personal Message (Offline)

Ignore
1714756492
Reply with quote  #2

1714756492
Report to moderator
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
November 26, 2020, 06:09:14 AM
Merited by mocacinno (1), ABCbits (1), NotATether (1)
 #2

It is because you have been applying BIP-34 wrongly. The block height has to be pushed with the minimal number of bytes:
Code:
1 -> OP_1
2 -> OP_2
...
499 -> 0x02f301
500 -> 0x02f401
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.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
McStone (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 5


View Profile
November 26, 2020, 07:04:50 AM
 #3

Thanks Coding Enthusiast!

That indeed solved the problem.

Seems there is no difficulty adjustment on a regtest network.
As far as my research goes, there is also no way to trigger difficulty adjustment on regtest?
Or do you know some way to achieve this, @Coding Enthusiast?

Cheers

McStone
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
November 26, 2020, 07:26:47 AM
 #4

Since fPowNoRetargeting is set to true for RegTest the nBits (target) never changes in blocks. I don't think you can change this anywhere apart from editing the code itself.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
McStone (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 5


View Profile
November 26, 2020, 07:40:59 AM
 #5

Thanks again,

this confirms what I thought...

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!