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.**
break;
        }
        if (pblock->nNonce == nInnerLoopCount) {
            continue;
        }
        std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
        if (!ProcessNewBlock(Params(), shared_pblock, true, nullptr))
            throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
        ++nHeight;
        blockHashes.push_back(pblock->GetHash().GetHex());
        
        if (keepScript)
        {
            coinbaseScript->KeepScript();
        }
    }
    return blockHashes;
}
static UniValue generatetoaddress(const JSONRPCRequest& request)
{
    if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
        throw std::runtime_error(
            RPCHelpMan{"generatetoaddress",
                "\nMine blocks immediately to a specified address (before the RPC call returns)\n",
                {
                    {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
                    {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address to send the newly generated bitcoin to."},
                    {"maxtries", RPCArg::Type::NUM,  "1000000", "How many iterations to try."},
                },
                RPCResult{