Skip to content

Commit 8e18072

Browse files
committed
chore(cmd/immuclient): include precommit state when quering status
Signed-off-by: Jeronimo Irazabal <[email protected]> Signed-off-by: Bartłomiej Święcki <[email protected]>
1 parent 50056da commit 8e18072

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cmd/immuclient/immuc/print.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,17 @@ func PrintState(root *schema.ImmutableState) string {
8282

8383
str := strings.Builder{}
8484

85-
str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
86-
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
87-
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
85+
if root.PrecommittedTxId == 0 {
86+
str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
87+
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
88+
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
89+
} else {
90+
str.WriteString(fmt.Sprintf("database: %s\n", root.Db))
91+
str.WriteString(fmt.Sprintf("txID: %d\n", root.TxId))
92+
str.WriteString(fmt.Sprintf("hash: %x\n", root.TxHash))
93+
str.WriteString(fmt.Sprintf("precommittedTxID: %d\n", root.PrecommittedTxId))
94+
str.WriteString(fmt.Sprintf("precommittedHash: %x\n", root.PrecommittedTxHash))
95+
}
8896

8997
return str.String()
9098
}

0 commit comments

Comments
 (0)