mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-29 15:27:17 +00:00
RPC methods get pubsub topics from chain spec
This commit is contained in:
parent
e9181e120c
commit
f54bd79f84
@ -4,7 +4,8 @@ use beacon_chain::{BeaconChain, BeaconChainTypes, BlockProcessingOutcome};
|
||||
use eth2_libp2p::rpc::methods::*;
|
||||
use eth2_libp2p::rpc::{RPCRequest, RPCResponse, RequestId};
|
||||
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::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
@ -136,8 +136,11 @@ impl<T: BeaconChainTypes> AttestationService for AttestationServiceInstance<T> {
|
||||
"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
|
||||
let topic = types::TopicBuilder::new("attestations".to_string()).build();
|
||||
let topic = types::TopicBuilder::new(topic_string).build();
|
||||
let message = PubsubMessage::Attestation(attestation);
|
||||
|
||||
self.network_chan
|
||||
|
@ -104,9 +104,9 @@ impl<T: BeaconChainTypes> BeaconBlockService for BeaconBlockServiceInstance<T> {
|
||||
"block_root" => format!("{}", block_root),
|
||||
);
|
||||
|
||||
// TODO: Obtain topics from the network service properly.
|
||||
let topic =
|
||||
types::TopicBuilder::new("beacon_chain".to_string()).build();
|
||||
// get the network topic to send on
|
||||
let topic_string = self.chain.get_spec().beacon_chain_topic.clone();
|
||||
let topic = types::TopicBuilder::new(topic_string).build();
|
||||
let message = PubsubMessage::Block(block);
|
||||
|
||||
// Publish the block to the p2p network via gossipsub.
|
||||
|
Loading…
Reference in New Issue
Block a user