RPC methods get pubsub topics from chain spec
This commit is contained in:
parent
4e24c8e651
commit
a31d6bcb22
@ -4,7 +4,8 @@ use beacon_chain::{BeaconChain, BeaconChainTypes, BlockProcessingOutcome};
|
|||||||
use eth2_libp2p::rpc::methods::*;
|
use eth2_libp2p::rpc::methods::*;
|
||||||
use eth2_libp2p::rpc::{RPCRequest, RPCResponse, RequestId};
|
use eth2_libp2p::rpc::{RPCRequest, RPCResponse, RequestId};
|
||||||
use eth2_libp2p::PeerId;
|
use eth2_libp2p::PeerId;
|
||||||
use slog::{debug, error, info, o, warn};
|
use slog::{debug, error, info, o, trace, warn};
|
||||||
|
use ssz::TreeHash;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -136,8 +136,11 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
|
|||||||
"type" => "valid_attestation",
|
"type" => "valid_attestation",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// get the network topic to send on
|
||||||
|
let topic_string = self.chain.get_spec().shard_topic_prefix.clone();
|
||||||
|
|
||||||
// valid attestation, propagate to the network
|
// valid attestation, propagate to the network
|
||||||
let topic = types::TopicBuilder::new("attestations".to_string()).build();
|
let topic = types::TopicBuilder::new(topic_string).build();
|
||||||
let message = PubsubMessage::Attestation(attestation);
|
let message = PubsubMessage::Attestation(attestation);
|
||||||
|
|
||||||
self.network_chan
|
self.network_chan
|
||||||
|
@ -104,9 +104,9 @@ impl<T: BeaconChainTypes> BeaconBlockService for BeaconBlockServiceInstance<T> {
|
|||||||
"block_root" => format!("{}", block_root),
|
"block_root" => format!("{}", block_root),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Obtain topics from the network service properly.
|
// get the network topic to send on
|
||||||
let topic =
|
let topic_string = self.chain.get_spec().beacon_chain_topic.clone();
|
||||||
types::TopicBuilder::new("beacon_chain".to_string()).build();
|
let topic = types::TopicBuilder::new(topic_string).build();
|
||||||
let message = PubsubMessage::Block(block);
|
let message = PubsubMessage::Block(block);
|
||||||
|
|
||||||
// Publish the block to the p2p network via gossipsub.
|
// Publish the block to the p2p network via gossipsub.
|
||||||
|
Loading…
Reference in New Issue
Block a user