Skip to content

Commit

Permalink
Keep empty fields in the response of zkevm_getBatchByNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Jun 11, 2024
1 parent 41f02f1 commit e603dfb
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions cmd/rpcdaemon/commands/zkevm_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,30 +857,19 @@ func populateBatchDetails(batch *types.Batch) (json.RawMessage, error) {
jBatch["timestamp"] = batch.Timestamp
jBatch["blocks"] = batch.Blocks
jBatch["transactions"] = batch.Transactions
if batch.GlobalExitRoot != (common.Hash{}) {
jBatch["globalExitRoot"] = batch.GlobalExitRoot
}
jBatch["globalExitRoot"] = batch.GlobalExitRoot
jBatch["mainnetExitRoot"] = batch.MainnetExitRoot
jBatch["rollupExitRoot"] = batch.RollupExitRoot
jBatch["localExitRoot"] = batch.LocalExitRoot
jBatch["sendSequencesTxHash"] = batch.SendSequencesTxHash
jBatch["verifyBatchTxHash"] = batch.VerifyBatchTxHash

if batch.ForcedBatchNumber != nil {
jBatch["forcedBatchNumber"] = batch.ForcedBatchNumber
}
if batch.MainnetExitRoot != (common.Hash{}) {
jBatch["mainnetExitRoot"] = batch.MainnetExitRoot
}
if batch.RollupExitRoot != (common.Hash{}) {
jBatch["rollupExitRoot"] = batch.RollupExitRoot
}
if batch.LocalExitRoot != (common.Hash{}) {
jBatch["localExitRoot"] = batch.LocalExitRoot
}
if batch.AccInputHash != (common.Hash{}) {
jBatch["accInputHash"] = batch.AccInputHash
}
if batch.SendSequencesTxHash != nil {
jBatch["sendSequencesTxHash"] = batch.SendSequencesTxHash
}
if batch.VerifyBatchTxHash != nil {
jBatch["verifyBatchTxHash"] = batch.VerifyBatchTxHash
}
jBatch["closed"] = batch.Closed
if len(batch.BatchL2Data) > 0 {
jBatch["batchL2Data"] = batch.BatchL2Data
Expand Down

0 comments on commit e603dfb

Please sign in to comment.