The first node starts , org.ethereum.samples.PrivateMinerSample.MinerNode, Related configuration
private final String config =
// no need for discovery in that small network
"peer.discovery.enabled = false \n" +
"peer.discovery.bind.ip = 127.0.0.1 \n" +
"peer.listen.port = 30335 \n" +
// need to have different nodeId's for the peers
"peer.privateKey = 6ef8da380c27cea8fdf7448340ea99e8e2268fc2950d79ed47cbf6f85dc977ec \n" +
// our private net ID
"peer.networkId = 555 \n" +
// we have no peers to sync with
"sync.enabled = true \n" +
// genesis with a lower initial difficulty and some predefined known funded accounts
"genesis = sample-genesis.json \n" +
// two peers need to have separate database dirs
"database.dir = sampleDB-1 \n" +
// when more than 1 miner exist on the network extraData helps to identify the block creator
"mine.extraDataHex = cccccccccccccccccccc \n" +
"mine.cpuMineThreads = 1 \n" +
"cache.flush.blocks = 1";
I only added sync.enabled = true.
second node,org.ethereum.samples.PrivateMinerSample.RegularConfig
private final String config =
// no discovery: we are connecting directly to the miner peer
"peer.discovery.enabled = false \n" +
"peer.listen.port = 30336 \n" +
"peer.privateKey = 3ec771c31cac8c0dba77a69e503765701d3c2bb62435888d4ffa38fed60c445c \n" +
"peer.networkId = 555 \n" +
// actively connecting to the miner
"peer.active = [" +
" { url = 'enode://26ba1aadaf59d7607ad7f437146927d79e80312f026cfa635c6b2ccf2c5d3521f5812ca2beb3b295b14f97110e6448c1c7ff68f14c5328d43a3c62b44143e9b1@localhost:30335' }" +
"] \n" +
"sync.enabled = true \n" +
// all peers in the same network need to use the same genesis block
"genesis = sample-genesis.json \n" +
// two peers need to have separate database dirs
"database.dir = sampleDB-2 \n";
I added a new step and started the miner when the sync is complete.
Go back to the first node.
When the second node computes a new block and broadcasts it, I will track the processNewBlock((NewBlockMessage)msg) method in Eth62 on the first node.
Found the following:
The header map in SyncQueueImpl class does not contain the value of the parent。
I think the problem is the headerRetrieveLoop method in org.ethereum.sync.BlockDownloader.
evn:
org.ethereum.samples.PrivateMinerSample.MinerNode
, Related configurationI only added
sync.enabled = true
.org.ethereum.samples.PrivateMinerSample.RegularConfig
I added a new step and started the miner when the sync is complete.
Go back to the first node.
When the second node computes a new block and broadcasts it, I will track the
processNewBlock((NewBlockMessage)msg)
method in Eth62 on the first node.Found the following:
The
header map
inSyncQueueImpl class
does not contain the value of the parent。I think the problem is the
headerRetrieveLoop
method in org.ethereum.sync.BlockDownloader.Please take a look at this problem,Thanks~!