Skip to content

Commit 39d6a27

Browse files
committed
feat: fn subscriber()
1 parent bb873b2 commit 39d6a27

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

crates/flashblocks-p2p/src/protocol/handler.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,23 @@ impl FlashblocksHandle<Subscibe> {
217217
}
218218
}
219219

220+
impl FlashblocksHandle<Publish> {
221+
pub fn subscriber(&self) -> FlashblocksHandle<Subscibe> {
222+
let publish = self.clone();
223+
let ctx = FlashblocksP2PCtx {
224+
client: Subscibe,
225+
authorizer_vk: publish.ctx.authorizer_vk,
226+
peer_tx: publish.ctx.peer_tx,
227+
flashblock_tx: publish.ctx.flashblock_tx,
228+
};
229+
230+
FlashblocksHandle {
231+
state: publish.state,
232+
ctx,
233+
}
234+
}
235+
}
236+
220237
impl<C> FlashblocksHandle<C> {
221238
pub fn flashblocks_tx(&self) -> broadcast::Sender<FlashblocksPayloadV1> {
222239
self.ctx.flashblock_tx.clone()

0 commit comments

Comments
 (0)