diff --git a/go/coinstacks/thorchain-v1/api/railway.json b/go/coinstacks/thorchain-v1/api/railway.json index c8fca73f4..bb4f3d449 100644 --- a/go/coinstacks/thorchain-v1/api/railway.json +++ b/go/coinstacks/thorchain-v1/api/railway.json @@ -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", diff --git a/go/pkg/cosmos/tx.go b/go/pkg/cosmos/tx.go index 86cdd7c14..ef5d0c9d0 100644 --- a/go/pkg/cosmos/tx.go +++ b/go/pkg/cosmos/tx.go @@ -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), diff --git a/go/pkg/cosmos/tx_test.go b/go/pkg/cosmos/tx_test.go new file mode 100644 index 000000000..a37b2c9e4 --- /dev/null +++ b/go/pkg/cosmos/tx_test.go @@ -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)) + } +} diff --git a/go/pkg/mayachain/tx.go b/go/pkg/mayachain/tx.go index 697f0b471..3bcb7a56a 100644 --- a/go/pkg/mayachain/tx.go +++ b/go/pkg/mayachain/tx.go @@ -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), @@ -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), diff --git a/go/pkg/mayachain/tx_test.go b/go/pkg/mayachain/tx_test.go new file mode 100644 index 000000000..9b19ebc4a --- /dev/null +++ b/go/pkg/mayachain/tx_test.go @@ -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)) + } +} diff --git a/go/pkg/thorchain/tx.go b/go/pkg/thorchain/tx.go index 1f807263c..46e9ca23c 100644 --- a/go/pkg/thorchain/tx.go +++ b/go/pkg/thorchain/tx.go @@ -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), @@ -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), diff --git a/go/pkg/thorchain/tx_test.go b/go/pkg/thorchain/tx_test.go new file mode 100644 index 000000000..14863a22d --- /dev/null +++ b/go/pkg/thorchain/tx_test.go @@ -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)) + } +}