qiyichain / peculiar

Golang implemention of Qiyi chain which is a high-performance permissioned public chain
https://qiyichain.cn
GNU Lesser General Public License v3.0
3 stars 1 forks source link

panic: runtime error: integer divide by zero #7

Closed youngqqcn closed 2 years ago

youngqqcn commented 2 years ago
INFO [08-19|19:24:41.001] Successfully sealed new block            number=200 sealhash=3b2230..f94e91 hash=c9f983..6611fc elapsed=2.996s
INFO [08-19|19:24:41.001] 🔗 block reached canonical chain          number=193 hash=bcde61..ad91c3
INFO [08-19|19:24:41.001] 🔨 mined potential block                  number=200 hash=c9f983..6611fc
panic: runtime error: integer divide by zero

goroutine 72 [running]:
github.com/ethereum/go-ethereum/consensus/congress.(*Snapshot).inturn(0x0?, 0xc9, {0xb4, 0x5b, 0x3b, 0x1a, 0xa3, 0x53, 0x24, 0x77, ...})
        github.com/ethereum/go-ethereum/consensus/congress/snapshot.go:203 +0xb0
github.com/ethereum/go-ethereum/consensus/congress.calcDifficulty(0xa39de29dcec6bd7f?, {0xb4, 0x5b, 0x3b, 0x1a, 0xa3, 0x53, 0x24, 0x77, 0xd8, ...})
        github.com/ethereum/go-ethereum/consensus/congress/congress.go:1119 +0x4c
github.com/ethereum/go-ethereum/consensus/congress.(*Congress).Prepare(0xc0002e75f0, {0x17dc278, 0xc00060b000}, 0xc002f22900)
        github.com/ethereum/go-ethereum/consensus/congress/congress.go:571 +0x127
github.com/ethereum/go-ethereum/miner.(*worker).commitNewWork(0xc000142000, 0xc00025bc94?, 0x0, 0x62ff72f9)
        github.com/ethereum/go-ethereum/miner/worker.go:956 +0x645
github.com/ethereum/go-ethereum/miner.(*worker).mainLoop(0xc000142000)
        github.com/ethereum/go-ethereum/miner/worker.go:474 +0x63b
created by github.com/ethereum/go-ethereum/miner.newWorker
        github.com/ethereum/go-ethereum/miner/worker.go:241 +0x78a
make: *** [Makefile:8:start] 错误 2
youngqqcn commented 2 years ago

https://github.com/qiyichain/peculiar/blob/19bdf28b4d096ce7a2a7c69113e4b96bda4462de/consensus/congress/snapshot.go#L197-L204

s.validators() 为什么会变为空?