Skip to content

Commit

Permalink
feat: if metadata is empty we don't send it
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Dec 4, 2024
1 parent 235f96a commit a90ec68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aggsender/aggsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,13 @@ func (a *AggSender) convertClaimToImportedBridgeExit(claim bridgesync.Claim) (*a
leafType = agglayer.LeafTypeMessage
}
var metaData []byte
if a.cfg.ImportedBridgeMetadataAsHash {
var MetadataIsHashed bool
if a.cfg.ImportedBridgeMetadataAsHash && len(claim.Metadata) > 0 {
metaData = crypto.Keccak256(claim.Metadata)
MetadataIsHashed = true
} else {
metaData = claim.Metadata
MetadataIsHashed = false
}

bridgeExit := &agglayer.BridgeExit{
Expand All @@ -427,7 +430,7 @@ func (a *AggSender) convertClaimToImportedBridgeExit(claim bridgesync.Claim) (*a
DestinationNetwork: claim.DestinationNetwork,
DestinationAddress: claim.DestinationAddress,
Amount: claim.Amount,
MetadataIsHashed: a.cfg.ImportedBridgeMetadataAsHash,
MetadataIsHashed: MetadataIsHashed,
Metadata: metaData,
}

Expand Down

0 comments on commit a90ec68

Please sign in to comment.