-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node: allow replacing existing p2p.Reactor(s) (#3846)
* node: allow replacing existing p2p.Reactor(s) using [`CustomReactors` option](https://godoc.org/github.com/tendermint/tendermint/node#CustomReactors). Warning: beware of accidental name clashes. Here is the list of existing reactors: MEMPOOL, BLOCKCHAIN, CONSENSUS, EVIDENCE, PEX. * check the absence of "CUSTOM" prefix * merge 2 tests * add doc.go to node package
- Loading branch information
1 parent
1e3364a
commit 88e0973
Showing
5 changed files
with
86 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Package node is the main entry point, where the Node struct, which | ||
represents a full node, is defined. | ||
Adding new p2p.Reactor(s) | ||
To add a new p2p.Reactor, use the CustomReactors option: | ||
node, err := NewNode( | ||
config, | ||
privVal, | ||
nodeKey, | ||
clientCreator, | ||
genesisDocProvider, | ||
dbProvider, | ||
metricsProvider, | ||
logger, | ||
CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}), | ||
) | ||
Replacing existing p2p.Reactor(s) | ||
To replace the built-in p2p.Reactor, use the CustomReactors option: | ||
node, err := NewNode( | ||
config, | ||
privVal, | ||
nodeKey, | ||
clientCreator, | ||
genesisDocProvider, | ||
dbProvider, | ||
metricsProvider, | ||
logger, | ||
CustomReactors(map[string]p2p.Reactor{"BLOCKCHAIN": customBlockchainReactor}), | ||
) | ||
The list of existing reactors can be found in CustomReactors documentation. | ||
*/ | ||
package node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters