2

I have created two nodes and connected the 1st node with the 2nd node in regtest mode . Now when I make the getblocktemplate command using bitcoin-cli . It fails with bitcoin is downloading the block.

Bitcoin core vs v0.16

admin1@root:~/Projects/bitcoin$ ./src/bitcoin-cli -regtest -port=8333 -rpcport=8332 -rpcuser=test -rpcpassword=test getconnectioncount
1
admin1@root:~/Projects/bitcoin$ ./src/bitcoin-cli -regtest -port=8333 -rpcport=8332 -rpcuser=test -rpcpassword=test getblocktemplate
error code: -10
error message:
Bitcoin is downloading blocks.
Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
nirajkumar
  • 123
  • 3

1 Answers1

2

You need to mine a block so that the software thinks that the blockchain is fully synced. The most recent block in the regtest blockchain is probably old so you just need to mine one more block to make the blockchain "recent".

Just use the generate command. You can do:

./src/bitcoin-cli -regtest -port=8333 -rpcport=8332 -rpcuser=test -rpcpassword=test generate 1

to mine one block.

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149