neo icon indicating copy to clipboard operation
neo copied to clipboard

NeoSystem should send Blockchain.Initialize in StartNode instead of constructor

Open devhawk opened this issue 4 years ago • 4 comments

The last line of the NeoSystem constructor is Blockchain.Ask(new Blockchain.Initialize()).Wait();, which configures the blockchain actor. However, it's not possible to register for any of EventStream events that the Blockchain actor publishes (ApplicationExecuted, PersistCompleted and RelayResult) until after the blockchain is initialized and the genesis block created.

Shouldn't the Initialize message be sent to the blockchain actor at the top of StartNode instead of the end of the constructor?

devhawk avatar May 28 '21 23:05 devhawk

At least before plugins load, isn't it?

shargon avatar May 30 '21 09:05 shargon

Shouldn't the Initialize message be sent to the blockchain actor at the top of StartNode instead of the end of the constructor?

What do you mean top of the StartNode? Do you want to register event subscriber before genesis block?

ZhangTao1596 avatar May 31 '21 03:05 ZhangTao1596

What do you mean top of the StartNode? Do you want to register event subscriber before genesis block?

I mean the beginning of StartNode, so that someone can register for events before the genesis block is minted.

devhawk avatar May 31 '21 22:05 devhawk

What do you mean top of the StartNode? Do you want to register event subscriber before genesis block?

I mean the beginning of StartNode, so that someone can register for events before the genesis block is minted.

I see.

ZhangTao1596 avatar Jun 01 '21 01:06 ZhangTao1596