change everything to transaction (#6440)

This commit is contained in:
Nikolay Volf
2020-06-21 13:34:19 +03:00
committed by GitHub
parent 04c62d6c5a
commit 36d2eefdc9
3 changed files with 74 additions and 73 deletions
+9 -9
View File
@@ -587,15 +587,15 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
/// All transactions will be fetched from the `TransactionPool` that was passed at
/// initialization as part of the configuration and propagated to peers.
pub fn trigger_repropagate(&self) {
let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateExtrinsics);
let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateTransactions);
}
/// You must call when new transaction is imported by the transaction pool.
///
/// This transaction will be fetched from the `TransactionPool` that was passed at
/// initialization as part of the configuration and propagated to peers.
pub fn propagate_extrinsic(&self, hash: H) {
let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateExtrinsic(hash));
pub fn propagate_transaction(&self, hash: H) {
let _ = self.to_worker.unbounded_send(ServiceToWorkerMsg::PropagateTransaction(hash));
}
/// Make sure an important block is propagated to peers.
@@ -798,8 +798,8 @@ impl<B, H> NetworkStateInfo for NetworkService<B, H>
///
/// Each entry corresponds to a method of `NetworkService`.
enum ServiceToWorkerMsg<B: BlockT, H: ExHashT> {
PropagateExtrinsic(H),
PropagateExtrinsics,
PropagateTransaction(H),
PropagateTransactions,
RequestJustification(B::Hash, NumberFor<B>),
AnnounceBlock(B::Hash, Vec<u8>),
GetValue(record::Key),
@@ -1119,10 +1119,10 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
this.network_service.user_protocol_mut().announce_block(hash, data),
ServiceToWorkerMsg::RequestJustification(hash, number) =>
this.network_service.user_protocol_mut().request_justification(&hash, number),
ServiceToWorkerMsg::PropagateExtrinsic(hash) =>
this.network_service.user_protocol_mut().propagate_extrinsic(&hash),
ServiceToWorkerMsg::PropagateExtrinsics =>
this.network_service.user_protocol_mut().propagate_extrinsics(),
ServiceToWorkerMsg::PropagateTransaction(hash) =>
this.network_service.user_protocol_mut().propagate_transaction(&hash),
ServiceToWorkerMsg::PropagateTransactions =>
this.network_service.user_protocol_mut().propagate_transactions(),
ServiceToWorkerMsg::GetValue(key) =>
this.network_service.get_value(&key),
ServiceToWorkerMsg::PutValue(key, value) =>