Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: victorkimba17 on June 25, 2018, 07:18:26 AM



Title: cpuminer requires at least two bitcoin nodes to run
Post by: victorkimba17 on June 25, 2018, 07:18:26 AM
i download this cpuminer on a cusmotmised blockchain that has different genesis block. i notice it requires at least two bitcoin nodes to run.

Is it due to the consensus algo ?

this is the cpuminer link  https://github.com/pooler/cpuminer


Title: Re: cpuminer requires at least two bitcoin nodes to run
Post by: achow101 on June 25, 2018, 07:38:03 AM
No, that is unrelated to the consensus algorithm. It is simply part of how the getblocktemplate RPC command works. It must be connected to the network before you can use the RPC call (and thus mine). So you must have at least one connection to another node.


Title: Re: cpuminer requires at least two bitcoin nodes to run
Post by: victorkimba17 on June 25, 2018, 07:57:56 AM
thanks for pointing out getblocktemplate.

In src/rpc/mining.cpp , i comment out these two lines:

Code:
   //if (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
    //    throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Bitcoin is not connected!");

and run one node only.

and getblocktemplate can work. and also cpuminer can work. So it is not necessary to have at least two nodes for mining.