Merge PR #4230: Minor cleanup in tx tags and response format

This commit is contained in:
Alexander Bezobchuk
2019-04-29 23:50:44 -04:00
committed by GitHub
parent 5344e8d768
commit f0f7b7dab7
6 changed files with 11 additions and 8 deletions
+5 -5
View File
@@ -45,7 +45,7 @@ type ABCIMessageLogs []ABCIMessageLog
// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
type ABCIMessageLog struct {
MsgIndex int `json:"msg_index"`
MsgIndex uint16 `json:"msg_index"`
Success bool `json:"success"`
Log string `json:"log"`
}
@@ -229,10 +229,6 @@ func (r TxResponse) String() string {
sb.WriteString(fmt.Sprintf(" GasUsed: %d\n", r.GasUsed))
}
if len(r.Tags) > 0 {
sb.WriteString(fmt.Sprintf(" Tags: \n%s\n", r.Tags.String()))
}
if r.Codespace != "" {
sb.WriteString(fmt.Sprintf(" Codespace: %s\n", r.Codespace))
}
@@ -241,6 +237,10 @@ func (r TxResponse) String() string {
sb.WriteString(fmt.Sprintf(" Timestamp: %s\n", r.Timestamp))
}
if len(r.Tags) > 0 {
sb.WriteString(fmt.Sprintf(" Tags: \n%s\n", r.Tags.String()))
}
return strings.TrimSpace(sb.String())
}
+1 -1
View File
@@ -24,6 +24,6 @@ func TestParseABCILog(t *testing.T) {
require.NoError(t, err)
require.Len(t, res, 1)
require.Equal(t, res[0].Log, "")
require.Equal(t, res[0].MsgIndex, 1)
require.Equal(t, res[0].MsgIndex, uint16(1))
require.True(t, res[0].Success)
}
+2 -1
View File
@@ -96,7 +96,8 @@ func (st StringTags) String() string {
for _, t := range st {
sb.WriteString(fmt.Sprintf(" - %s\n", t.String()))
}
return sb.String()
return strings.TrimRight(sb.String(), "\n")
}
// Conversion function from a []byte tag to a string tag