Onyx-Protocol / Onyx

Onyx

Home Page:https://Onyx.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

core/generator: restart required after failed signature

jbowens opened this issue · comments

While testing #1033, I accidentally misconfigured the signer node and didn't make it a signer. As expected that signer node 404'd when the generator called its sign-block RPC:

app=cored buildtag=? processID=chain-mba.local-40952-b596e957c19e3cf194cc at=block.go:147 t=2017-04-24T22:22:49.330034662Z error="Request to `http://localhost:1999/rpc/signer/sign-block` responded with 404 Not Found" signer=http://localhost:1999
/Users/jackson/src/chain/log/log.go:143 - chain/log.Printkv
/Users/jackson/src/chain/core/generator/block.go:147 - chain/core/generator.getSig
/usr/local/go/src/runtime/asm_amd64.s:2197 - runtime.goexit
app=cored buildtag=? processID=chain-mba.local-40952-b596e957c19e3cf194cc at=generator.go:132 t=2017-04-24T22:22:49.330196251Z error="sign: got 1 of 2 needed signatures"
/Users/jackson/src/chain/core/generator/block.go:70 - chain/core/generator.(*Generator).commitBlock
/Users/jackson/src/chain/core/generator/block.go:64 - chain/core/generator.(*Generator).makeBlock
/Users/jackson/src/chain/core/generator/generator.go:129 - chain/core/generator.(*Generator).Generate
/usr/local/go/src/runtime/asm_amd64.s:2197 - runtime.goexit

However, after reconfiguring and restarting the signer, the generator never attempted to get the block signature again. It was stuck at that height with a block saved in the postgres generator_pending_block table. Restarting the generator fixed the problem.

Looking at the code, it looks like a failed call to g.commitBlock will bubble the error up to the main generator loop where it gets logged. On the next tick, it'll try to create a new block (instead of using the previously persisted pending block).