Skip to content

Commit

Permalink
chore(cmd/immuclient): include precommit state when quering status
Browse files Browse the repository at this point in the history
Signed-off-by: Jeronimo Irazabal <[email protected]>
Signed-off-by: Bartłomiej Święcki <[email protected]>
  • Loading branch information
jeroiraz committed Oct 12, 2022
1 parent 50056da commit 8e18072
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/immuclient/immuc/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ func PrintState(root *schema.ImmutableState) string {

str := strings.Builder{}

str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
if root.PrecommittedTxId == 0 {
str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
} else {
str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
str.WriteString(fmt.Sprintf("precommittedTxID: %d\n", root.PrecommittedTxId))
str.WriteString(fmt.Sprintf("precommittedHash: %x\n", root.PrecommittedTxHash))
}

return str.String()
}
Expand Down

0 comments on commit 8e18072

Please sign in to comment.