Skip to content

Commit

Permalink
update dslib client interface
Browse files Browse the repository at this point in the history
  • Loading branch information
dpunish3r committed Apr 24, 2024
1 parent 8af746a commit b7a2484
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions tools/datastreamer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,13 @@ func decodeEntry(cliCtx *cli.Context) error {
os.Exit(1)
}

client.FromEntry = cliCtx.Uint64("entry")
err = client.ExecCommand(datastreamer.CmdEntry)
entry, err := client.ExecCommandGetEntry(cliCtx.Uint64("entry"))
if err != nil {
log.Error(err)
os.Exit(1)
}

printEntry(client.Entry)
printEntry(entry)
return nil
}

Expand Down Expand Up @@ -597,35 +596,28 @@ func decodeL2Block(cliCtx *cli.Context) error {
Value: l2BlockNumber,
}

client.FromBookmark = bookMark.Encode()
err = client.ExecCommand(datastreamer.CmdBookmark)
firstEntry, err := client.ExecCommandGetBookmark(bookMark.Encode())
if err != nil {
log.Error(err)
os.Exit(1)
}

firstEntry := client.Entry
printEntry(firstEntry)

client.FromEntry = firstEntry.Number + 1
err = client.ExecCommand(datastreamer.CmdEntry)
secondEntry, err := client.ExecCommandGetEntry(firstEntry.Number + 1)
if err != nil {
log.Error(err)
os.Exit(1)
}

secondEntry := client.Entry
printEntry(secondEntry)

i := uint64(2) //nolint:gomnd
for secondEntry.Type == state.EntryTypeL2Tx {
client.FromEntry = firstEntry.Number + i
err = client.ExecCommand(datastreamer.CmdEntry)
entry, err := client.ExecCommandGetEntry(firstEntry.Number + i)
if err != nil {
log.Error(err)
os.Exit(1)
}
secondEntry = client.Entry
secondEntry = entry
printEntry(secondEntry)
i++
}
Expand Down

0 comments on commit b7a2484

Please sign in to comment.