Bitcoin testnet: "Bitcoin is downloading blocks..." and other problem I'm trying to setup a local testnet with multiple nodes. Currently I have three nodes, and their mining powers are almost the same.

Things have been quite ok so far, except some problems that I need to ask from you.


When I run the getblocktemplate rpc call (because I later want to run a pool), it returns the message as in the title. For example:

./src/bitcoin-cli -datadir=./localnet getblocktemplate
error: {"code":-10,"message":"Bitcoin is downloading blocks..."}


although there are already 10 blocks in the blockchain maintained by the node. Its the same for other nodes as well. So why does that happen?


The nodes do not sync up very often although they are all connected together (each node has 2 inbound connections and 2 outbound connections). It is so often that one node is 2 block ahead of other and remains so for a long time. Thus, again, why does that happen? I thought after finding a valid block, the node will broadcast that to every connected node and the network will work on top of that block?


Please let me know if you can help answer either one or all the questions.
For your first question, the message "Bitcoin is downloading blocks" is produced if the client hasn't yet downloaded all the checkpoint blocks.  For testnet, there is exactly one checkpoint block, at height 546.  So until your client has mined 546 blocks, you will continue to get this message.  

Unfortunately, when you do mine block number 546, it will be rejected since its hash won't match the hardcoded checkpoint, and you will still get this message anyway.  So you will have to remove the checkpoint from the code and replace it with a zero-height checkpoint matching your genesis block.