kardiachain/go-kardia

[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:

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
Screen Shot 2020-11-20 at 4 53 39 PM
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.