Skip to content

Commit

Permalink
Use consensus mechanism for sending L2 txs
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 committed Sep 13, 2023
1 parent d06b713 commit b7db667
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libp2p-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export async function sendMessageToL2 (
},
data: any
): Promise<void> {
// Send tx to L2 only if we are the leader
if (!consensus.isLeader()) {
log('Not a leader, skipped sending L2 tx');
return;
}

const { kind, message } = data;

const contract = new ethers.Contract(contractAddress, PhisherRegistryABI, signer);
Expand Down

0 comments on commit b7db667

Please sign in to comment.