-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove banned realays from mevboost pkg
- Loading branch information
1 parent
5457e78
commit ef4f606
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MevBoost } from "@dappnode/stakers"; | ||
import { Network } from "@dappnode/types"; | ||
|
||
/** | ||
* Checks for banned relays in the mevboost package enviroment variable RELAYS | ||
* and removes them from the list if they are present. Then restarts the mevboost package. | ||
*/ | ||
export async function removeBannedRelays(mevBoost: MevBoost): Promise<void> { | ||
const bannedRelays = [ | ||
"https://0xb3ee7afcf27f1f1259ac1787876318c6584ee353097a50ed84f51a1f21a323b3736f271a895c7ce918c038e4265918be@relay.edennetwork.io" | ||
]; | ||
for (const network of Object.values(Network)) { | ||
const mevBoostDnpName = MevBoost.CompatibleMevBoost[network]?.dnpName; | ||
if (mevBoostDnpName) { | ||
const relays = await mevBoost.getMevBoostCurrentRelays(mevBoostDnpName); | ||
const newRelays = relays.filter((relay) => !bannedRelays.includes(relay)); | ||
if (newRelays.length !== relays.length) { | ||
await mevBoost.setNewMevBoost(network, mevBoostDnpName, newRelays); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters