add: subscribeAllSubnets feature
This commit is contained in:
parent
b33900bd35
commit
e034f30b5e
|
@ -1130,10 +1130,11 @@ proc addCapellaMessageHandlers(
|
||||||
node.addAltairMessageHandlers(forkDigest, slot)
|
node.addAltairMessageHandlers(forkDigest, slot)
|
||||||
node.network.subscribe(getBlsToExecutionChangeTopic(forkDigest), basicParams)
|
node.network.subscribe(getBlsToExecutionChangeTopic(forkDigest), basicParams)
|
||||||
|
|
||||||
proc fetchCustodySubnetCount* (node: BeaconNode, res: var uint64)=
|
proc fetchCustodySubnetCount* (node: BeaconNode): uint64=
|
||||||
res = CUSTODY_REQUIREMENT
|
var res = CUSTODY_REQUIREMENT.uint64
|
||||||
if node.config.subscribeAllSubnets:
|
if node.config.subscribeAllSubnets:
|
||||||
res = DATA_COLUMN_SIDECAR_SUBNET_COUNT
|
res = DATA_COLUMN_SIDECAR_SUBNET_COUNT.uint64
|
||||||
|
res
|
||||||
|
|
||||||
proc fetchCustodyColumnCountFromRemotePeer*(node: BeaconNode, pid: PeerId): uint64 =
|
proc fetchCustodyColumnCountFromRemotePeer*(node: BeaconNode, pid: PeerId): uint64 =
|
||||||
# Fetches the custody column count from a remote peer
|
# Fetches the custody column count from a remote peer
|
||||||
|
@ -1164,7 +1165,8 @@ proc fetchCustodyColumnCountFromRemotePeer*(node: BeaconNode, pid: PeerId): uint
|
||||||
proc addDenebMessageHandlers(
|
proc addDenebMessageHandlers(
|
||||||
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
|
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
|
||||||
node.addCapellaMessageHandlers(forkDigest, slot)
|
node.addCapellaMessageHandlers(forkDigest, slot)
|
||||||
for topic in dataColumnSidecarTopics(forkDigest):
|
let targetSubnets = node.fetchCustodySubnetCount()
|
||||||
|
for topic in dataColumnSidecarTopics(forkDigest, targetSubnets):
|
||||||
node.network.subscribe(topic, basicParams)
|
node.network.subscribe(topic, basicParams)
|
||||||
|
|
||||||
proc addElectraMessageHandlers(
|
proc addElectraMessageHandlers(
|
||||||
|
@ -1188,7 +1190,8 @@ proc removeCapellaMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
|
||||||
|
|
||||||
proc removeDenebMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
|
proc removeDenebMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
|
||||||
node.removeCapellaMessageHandlers(forkDigest)
|
node.removeCapellaMessageHandlers(forkDigest)
|
||||||
for topic in dataColumnSidecarTopics(forkDigest):
|
let targetSubnets = node.fetchCustodySubnetCount()
|
||||||
|
for topic in dataColumnSidecarTopics(forkDigest, targetSubnets):
|
||||||
node.network.unsubscribe(topic)
|
node.network.unsubscribe(topic)
|
||||||
|
|
||||||
proc removeElectraMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
|
proc removeElectraMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
|
||||||
|
|
|
@ -244,6 +244,6 @@ func getDataColumnSidecarTopic*(forkDigest: ForkDigest,
|
||||||
func compute_subnet_for_data_column_sidecar*(column_index: ColumnIndex): uint64 =
|
func compute_subnet_for_data_column_sidecar*(column_index: ColumnIndex): uint64 =
|
||||||
uint64(column_index mod DATA_COLUMN_SIDECAR_SUBNET_COUNT)
|
uint64(column_index mod DATA_COLUMN_SIDECAR_SUBNET_COUNT)
|
||||||
|
|
||||||
iterator dataColumnSidecarTopics*(forkDigest: ForkDigest): string =
|
iterator dataColumnSidecarTopics*(forkDigest: ForkDigest, targetSubnetCount: uint64): string =
|
||||||
for subnet_id in 0'u64..<DATA_COLUMN_SIDECAR_SUBNET_COUNT:
|
for subnet_id in 0'u64..<targetSubnetCount:
|
||||||
yield getDataColumnSidecarTopic(forkDigest, subnet_id)
|
yield getDataColumnSidecarTopic(forkDigest, subnet_id)
|
Loading…
Reference in New Issue