[Propose]Refactor node and chain modules
ngdlong91 opened this issue · 1 comments
As we're going to support light node, so I think better if we take a look into our source and how we implement before get started, since our code, imo, quite fragment right now.
Source length
Some source files take too long, for example:
Interfaces
We have some base interface defined in modules:
- https://github.com/kardiachain/go-kardiamain/blob/4ed5e4b180581662c35ccfad1cc33944f7b73f26/consensus/base_block_operations.go#L28
- https://github.com/kardiachain/go-kardiamain/blob/ce04d810e4f8f3091e0038fbb7a0a3d3b15a98ac/consensus/base_protocol.go#L25
- https://github.com/kardiachain/go-kardiamain/blob/bac833c004238ab935bd4d4bd58131b65e612ca6/node/service.go#L80
Move to kai/base package
Split code into small pieces
For example in https://github.com/kardiachain/go-kardiamain/blob/5534fcd2b708ebae183cad06444f4684ce619a11/mainchain/tx_pool/tx_pool.go
We have
which can split into small files.
Reduce duplicate code
Current in our main chain and dual chain both have blockchain and maybe, tx_pool and other modules when we come back to finish dual node, which contain a lot of duplicate code and can't reuse since import cycle. And we might have that issues with light node.
Should we move those modules into same places and extend instead have different modules for each kind of nodes.