nochowderforyou / clams

Clam Project
MIT License
62 stars 58 forks source link

clamd 2.0.0-rc1 blockchain fork #310

Closed haraldg closed 4 years ago

haraldg commented 7 years ago

Hi,

looks like 2.0.0-rc1 doesn't accept a recent block:

ERROR: CheckProofOfStake() : INFO: read txPrev failed
WARNING: ProcessBlock(): check proof-of-stake failed for block ca142c33d815b5e8c9500172b40c733a9c528e3a65c40c28719993ad8f3e6b34
ProcessBlock: ORPHAN BLOCK 0, 0 MB out of 41943040, prev=ca142c33d815b5e8c9500172b40c733a9c528e3a65c40c28719993ad8f3e6b34
ProcessBlock: ORPHAN BLOCK 1, 2998 MB out of 41943040, prev=b473b861ae52563b3be61fda687a2ae8eca8f0a629b2dcfb1a6defb8b3cbd7da
ProcessBlock: ORPHAN BLOCK 2, 3476 MB out of 41943040, prev=9e4592aae7c70c8f40680251447a03b9492955a0236f0f1bfe98b1c6408d559d
ProcessBlock: ORPHAN BLOCK 3, 5081 MB out of 41943040, prev=98ed5222f2a625d77c8c565ee3ff135079b1d6d027f7726c55bad92c34578fd4
ProcessBlock: ORPHAN BLOCK 4, 6421 MB out of 41943040, prev=fd11ec5e39c635cd55fd21c134a2979da15dafcf858226021d09bbb8d828842f
ProcessBlock: ORPHAN BLOCK 5, 6840 MB out of 41943040, prev=8ee570b54019c40159e8f33163f73fe7401b45a2743dc881b694e24cb9f67c72
ProcessBlock: ORPHAN BLOCK 6, 8512 MB out of 41943040, prev=9e8ea974776941dde8bc0939f508cb6ec100ace311517e0ca86404a842a0c66a
ProcessBlock: ORPHAN BLOCK 7, 9762 MB out of 41943040, prev=64404dcdf7175419cb8659e1bb0240511f48c09e68ed80c2ff86c2ae3e63d24f
ProcessBlock: ORPHAN BLOCK 8, 13089 MB out of 41943040, prev=07bbacdf96bd2c4cd8fcbfa854edbc856be4ff092945741af042ebe45270c090

I haven't figured out yet why this happens. Any help in tracking this down would be appreciated.

tryphe commented 7 years ago

I'm running the same branch and didn't get forked: $ cc2 getblock ca142c33d815b5e8c9500172b40c733a9c528e3a65c40c28719993ad8f3e6b34 { "hash" : "ca142c33d815b5e8c9500172b40c733a9c528e3a65c40c28719993ad8f3e6b34", "confirmations" : 2006, "size" : 2283, "height" : 1519156, "version" : 7, "merkleroot" : "586dee9603ed40efac098908c43d9dab57e2eb179165527225bae022bda5f40e", "mint" : 1.00020000, "moneysupply" : 16189208.13048927, "digsupply" : 866475.04837934, "stakesupply" : 1414806.72641731, "activesupply" : 2281281.77479665, "time" : 1495296608, "nonce" : 0, "bits" : "1b00d3bd", "difficulty" : 79234.42044091874, "blocktrust" : "13583a125a541", "chaintrust" : "19e4b5b099418c2542", "previousblockhash" : "19ba5373a55d4ed096afaf445dfdff60c5c49e863f1e15ddb27e1bbbe47bec0a", "nextblockhash" : "b473b861ae52563b3be61fda687a2ae8eca8f0a629b2dcfb1a6defb8b3cbd7da", "flags" : "proof-of-stake", "proofhash" : "0000455df458a60a91a49ff454aa854de2f1b63f891a94276e7334d055152cda", "entropybit" : 0, "modifier" : "13135fd37bc47460", "tx" : [ "509b81886046d10f6cedbd683196d13e5a5d3929040ef72cdbdddc3eecf12067", "85fcd168548c31776269ebc2f8f8431ae284394a5c6a9294ae6e181add9c8aca", "5ec3e7e04ca519068ba4513988c11a1112b922ee4acc92f91bae912e2e5f608d" ], "signature" : "3045022100f3242a74b8bdef42f61abc1b0cd5f7d1bc24e3b767b57f27afbda8026c2fa52c0220792a941deecee6acdcba9c443e85890811bdc7b0275fe7a10cebbb6f373df163" }

haraldg commented 7 years ago

Thanks for the input. I synced the blockchain from scratch and got past the point where i had been stuck, too. I guess the local copy of the blockchain or the tx db got corrupted. However not sure how to debug this further?

tryphe commented 7 years ago

I believe this branch has a bug where if you stake a block, there's a pointer or two (notably txPrev) that can cause a race condition with another thread, giving some undefined result. It doesn't seem to happen with the master branch.

I went through the whole diff a while back but unfortunately couldn't spot any obvious change that might cause it.

After thinking about this a bit further, maybe it could just be another issue since there's no crash here.

haraldg commented 7 years ago

@tryphe what crash are you talking about? #290?

I'm pretty sure that my issue is different.

tryphe commented 7 years ago

Yes, it's a different bug; but it's likely caused by the same changes.

haraldg commented 7 years ago

Hi, got stuck again, but this time with a different error message:

SetBestChain: new best=a36e81d1ce546163cb2b9c472b44958d7006d4139084082c26da78a5de030af5  height=1533839  trust=482451057790379292898  blocktrust=2835711873930950882  dat
e=05/30/17 22:53:36
ProcessBlock: ACCEPTED
ProcessBlock() : block 2933b5ac6fa2b0920685d9a756036ce11c6beaf299c90e1a9a43f823b5f94027 uses the same stake as the best block. Cancelling the best block
invalid workInvalidChainFound: invalid block=a36e81d1ce546163cb2b9c472b44958d7006d4139084082c26da78a5de030af5  height=1533839  log2_work=68.708944  date=2017-05-30 22:53:36
InvalidChainFound:  current best=a36e81d1ce546163cb2b9c472b44958d7006d4139084082c26da78a5de030af5  height=1533839  log2_work=68.708944  date=2017-05-30 22:53:36
REORGANIZE: Disconnect 1 blocks; cbd6c5ae5c9d08164e520d545d74f1b9a5fbc7adb248d8355c3eccc53a55bdf2..
REORGANIZE: Connect 0 blocks; ..cbd6c5ae5c9d08164e520d545d74f1b9a5fbc7adb248d8355c3eccc53a55bdf2
out 102.5003 - in 101.50 = reward 1.0003
Committing 4 changed transactions to coin database...
SetBestChain: new best=cbd6c5ae5c9d08164e520d545d74f1b9a5fbc7adb248d8355c3eccc53a55bdf2  height=1533838  trust=482450681993445813371  blocktrust=2835336076997471355  date=05/30/17 22:51:44

At receiving the next block clamd crashed in the usual (pindexprev=0) way. On restarting clamd was stuck and the only way to get it to work again was to start syncing the blockchain from scratch.

Since error messages are different I guess this is yet an other bug, so reporting this too.

l0rdicon commented 4 years ago

Closing issue, unrelated to client v2.1.0