Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/coinstacks/thorchain-v1/api/railway.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"builder": "dockerfile",
"dockerfilePath": "go/coinstacks/thorchain-v1/build/Dockerfile",
"watchPatterns": ["go/shared/**", "go/pkg/thorchain-v1/**", "go/coinstacks/thorchain-v1/**"]
"watchPatterns": ["go/shared/**", "go/pkg/thorchain/**", "go/coinstacks/thorchain-v1/**"]
},
"deploy": {
"startCommand": "/go/bin/app -swagger swagger.json -swaggerui static/swaggerui",
Expand Down
4 changes: 4 additions & 0 deletions go/pkg/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ func ParseMessages(msgs []sdk.Msg, events cosmossdk.EventsByMsgIndex) []cosmossd
for i, msg := range msgs {
switch v := msg.(type) {
case *banktypes.MsgSend:
if len(v.Amount) == 0 {
continue
}

message := cosmossdk.Message{
Addresses: []string{v.FromAddress, v.ToAddress},
Index: strconv.Itoa(i),
Expand Down
17 changes: 17 additions & 0 deletions go/pkg/cosmos/tx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cosmos

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

func TestParseMessagesSkipsSendWithEmptyAmount(t *testing.T) {
msgs := []sdk.Msg{&banktypes.MsgSend{}}

messages := ParseMessages(msgs, nil)
if len(messages) != 0 {
t.Fatalf("expected no parsed messages, got %d", len(messages))
}
}
8 changes: 8 additions & 0 deletions go/pkg/mayachain/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ func ParseMessages(msgs []sdk.Msg, events cosmossdk.EventsByMsgIndex) []cosmossd
for i, msg := range msgs {
switch v := msg.(type) {
case *mayatypes.MsgSend:
if len(v.Amount) == 0 {
continue
}

message := cosmossdk.Message{
Addresses: []string{v.FromAddress.String(), v.ToAddress.String()},
Index: strconv.Itoa(i),
Expand Down Expand Up @@ -310,6 +314,10 @@ func ParseMessages(msgs []sdk.Msg, events cosmossdk.EventsByMsgIndex) []cosmossd
messages = append(messages, message)
}
case *banktypes.MsgSend:
if len(v.Amount) == 0 {
continue
}

message := cosmossdk.Message{
Addresses: []string{v.FromAddress, v.ToAddress},
Index: strconv.Itoa(i),
Expand Down
21 changes: 21 additions & 0 deletions go/pkg/mayachain/tx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package mayachain

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
mayatypes "gitlab.com/mayachain/mayanode/x/mayachain/types"
)

func TestParseMessagesSkipsSendWithEmptyAmount(t *testing.T) {
msgs := []sdk.Msg{
&mayatypes.MsgSend{},
&banktypes.MsgSend{},
}

messages := ParseMessages(msgs, nil)
if len(messages) != 0 {
t.Fatalf("expected no parsed messages, got %d", len(messages))
}
}
8 changes: 8 additions & 0 deletions go/pkg/thorchain/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ func ParseMessages(msgs []sdk.Msg, events cosmossdk.EventsByMsgIndex) []cosmossd
for i, msg := range msgs {
switch v := msg.(type) {
case *thorchaintypes.MsgSend:
if len(v.Amount) == 0 {
continue
}

message := cosmossdk.Message{
Addresses: []string{v.FromAddress.String(), v.ToAddress.String()},
Index: strconv.Itoa(i),
Expand Down Expand Up @@ -362,6 +366,10 @@ func ParseMessages(msgs []sdk.Msg, events cosmossdk.EventsByMsgIndex) []cosmossd
messages = append(messages, message)
}
case *banktypes.MsgSend:
if len(v.Amount) == 0 {
continue
}

message := cosmossdk.Message{
Addresses: []string{v.FromAddress, v.ToAddress},
Index: strconv.Itoa(i),
Expand Down
21 changes: 21 additions & 0 deletions go/pkg/thorchain/tx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package thorchain

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
thorchaintypes "gitlab.com/thorchain/thornode/v3/x/thorchain/types"
)

func TestParseMessagesSkipsSendWithEmptyAmount(t *testing.T) {
msgs := []sdk.Msg{
&thorchaintypes.MsgSend{},
&banktypes.MsgSend{},
}

messages := ParseMessages(msgs, nil)
if len(messages) != 0 {
t.Fatalf("expected no parsed messages, got %d", len(messages))
}
}
Loading