Skip to content

Commit

Permalink
fix(mempool): broadcast new transactions (nervosnetwork#32)
Browse files Browse the repository at this point in the history
* fix: mempool broadcast new transcation

* cargo fmt
  • Loading branch information
Eason Gao authored and yejiayu committed Oct 26, 2019
1 parent 7f737cd commit 086ec7e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use core_consensus::message::{
};
use core_executor::trie::RocksTrieDB;
use core_executor::TransactionExecutorFactory;
use core_mempool::{DefaultMemPoolAdapter, HashMemPool};
use core_mempool::{DefaultMemPoolAdapter, HashMemPool, NewTxsHandler, END_GOSSIP_NEW_TXS};
use core_network::{NetworkConfig, NetworkService};
use core_storage::{adapter::rocks::RocksAdapter, ImplStorage};

Expand Down Expand Up @@ -198,6 +198,14 @@ async fn start(cfg: &Config) -> ProtocolResult<()> {
mempool_adapter,
));

// register broadcast new transaction
network_service
.register_endpoint_handler(
END_GOSSIP_NEW_TXS,
Box::new(NewTxsHandler::new(Arc::clone(&mempool))),
)
.unwrap();

// Init trie db
let path_state = cfg.data_path_for_state();
let trie_db = Arc::new(RocksTrieDB::new(path_state, cfg.executor.light).unwrap());
Expand Down Expand Up @@ -258,6 +266,7 @@ async fn start(cfg: &Config) -> ProtocolResult<()> {
my_privkey,
consensus_adapter,
));

// register consensus
network_service
.register_endpoint_handler(
Expand Down

0 comments on commit 086ec7e

Please sign in to comment.