truechain / truechain-engineering-code

Go implementation of TrueChain
GNU Lesser General Public License v3.0
100 stars 82 forks source link

invalid merkle root #47

Open hyangl opened 5 years ago

hyangl commented 5 years ago
INFO [12-24|15:19:50.766] Peer connected success                   id=0101e8580b1ee536 conn=dyndial name=Getrue/v0.9.1-unstable-d12ad566/linux-amd64/go1.10 RemoteAddr=47.92.4.244:30313
INFO [12-24|15:20:00.100] -======================= 653983 root hash hash =03e2ec…6ce251
INFO [12-24|15:20:00.100] Finalize:                                header.SnailHash=ffa0f6…12c7c2 header.SnailNumber=6993
INFO [12-24|15:20:00.268] -======================= after ages root hash hash =35a964…26a346
INFO [12-24|15:20:00.268] --------------ValidateState  number      is=653984
INFO [12-24|15:20:00.268] ----===========================================================start state dump 
ERROR[12-24|15:20:00.268] 
########## BAD FAST BLOCK #########
Chain config: {ChainID: 18928 Engine: {MinimumDifficulty: 2000000 MinimumFruitDifficulty: 2000 DurationLimit: 600}}

Number: 653984
Hash: 0x766945a36a491bdcd022416b7f125b8712763867a67e2f82e576465853d70135

Error: invalid merkle root(remote: d076fa1b35ceb5abe5279b087e42b1d3cc6b0411162af79fccde5e9e2fb7c599 local:35a964d48fa884237b9621a691a6e4a8bd97f478902bffe3df258f3a7926a346)
##############################

WARN [12-24|15:20:00.268] Synchronisation failed, dropping peer    peer=0101e8580b1ee536 err="fast retrieved hash chain is invalid"
INFO [12-24|15:20:00.268] drop peer fast Synchronise               id=0101e8580b1ee536
INFO [12-24|15:20:00.268] fastDownloader Synchronise exit          origin=653983 height=75
ERROR[12-24|15:20:00.268] fast sync:                               err>>>>>>>>>="fast retrieved hash chain is invalid"
WARN [12-24|15:20:00.268] Synchronisation failed, retrying         err="header processing canceled (requested)"
INFO [12-24|15:20:00.268] Truechain message handling failed        id=0101e8580b1ee536 conn=dyndial err=EOF
hyangl commented 5 years ago

The fast block is a reward block for snail block 6993. When the node issues this error, it has a wrong snail block body:

> etrue.getSnail(6993)
{
  beginFruitNumber: 651510,
  difficulty: 1171643464,
  endFruitNumber: 651589,
  extraData: "0xd78209018667657472756586676f312e3131856c696e7578",
  fruitDifficulty: 2000,
  fruits: 80,
  hash: "0xffa0f681c397e552de8561247121f32c810a92c8c7800124b140d815fc12c7c2",
  miner: "0x888bf1aa85d6a05f1d18b253b3ad69d682e21f17",
  mixHash: "0x00000003680845af9aea9737c172cb43e4a535c240985e6b07facd6bcd40836c",
  nonce: "0x768b124ab9dd8568",
  number: 6993,
  parentHash: "0x73de1f6b1da8868223213d2feffa2055849bf366b291d2c55d67c6c0c6ad4d87",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 129443,
  timestamp: 1545204866,
  uncles: []
}

The right snail block body info:

> etrue.getSnail(6993)
{
  beginFruitNumber: 652287,
  difficulty: 1171643464,
  endFruitNumber: 652595,
  extraData: "0xd78209018667657472756586676f312e3131856c696e7578",
  fruitDifficulty: 2000,
  fruits: 309,
  hash: "0xffa0f681c397e552de8561247121f32c810a92c8c7800124b140d815fc12c7c2",
  miner: "0x888bf1aa85d6a05f1d18b253b3ad69d682e21f17",
  mixHash: "0x00000003680845af9aea9737c172cb43e4a535c240985e6b07facd6bcd40836c",
  nonce: "0x768b124ab9dd8568",
  number: 6993,
  parentHash: "0x73de1f6b1da8868223213d2feffa2055849bf366b291d2c55d67c6c0c6ad4d87",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 498304,
  timestamp: 1545204866,
  uncles: []
}

while the snail block 6989 body looks like the wrong block body:

> etrue.getSnail(6989)
{
  beginFruitNumber: 651510,
  difficulty: 1191831748,
  endFruitNumber: 651589,
  extraData: "0xd78209018667657472756586676f312e3131856c696e7578",
  fruitDifficulty: 2000,
  fruits: 80,
  hash: "0xec0d382db7cdf7096ac2fac43470f58c39d4c6005e192ccca7dcd4d6eeabbedb",
  miner: "0xcdfd80ed3535bd8a2a58830ab78380b5a1a64ced",
  mixHash: "0x000000027f5272410c764c465f55f03ebf05412584e74570086c4c16f5a7d6a8",
  nonce: "0x14e7a38c56d3cc73",
  number: 6989,
  parentHash: "0x29df7231f1ab9e43d6e67e97cfa967465fc66c5f6084958298c19955eaae2247",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 129443,
  timestamp: 1545198995,
  uncles: []
}