diff --git a/go.sum b/go.sum index 1e1a7a0bd66..445f0dbe5c8 100644 --- a/go.sum +++ b/go.sum @@ -126,6 +126,8 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/cosmos-sdk v0.40.0-rc0 h1:GY+jzuVILZ7wlx5Zic2W0rWlo47fZgN048xV458sUAo= +github.com/cosmos/cosmos-sdk v0.40.0-rc0/go.mod h1:YZcO00Tq/qqj4ncsfn+PobyTelsot7wEMGPpxEbEAT0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/iavl v0.15.0-rc4 h1:P1wmET7BueqCzfxsn+BzVkDWDLY9ij2JNwkbIdM7RG8= diff --git a/relayer/naive-strategy.go b/relayer/naive-strategy.go index 4129ff8696d..7ad25f0e378 100644 --- a/relayer/naive-strategy.go +++ b/relayer/naive-strategy.go @@ -244,6 +244,7 @@ func (nrs *NaiveStrategy) sendTxFromEventPackets(src, dst *Chain, rlyPackets []r MaxTxSize: nrs.MaxTxSize, MaxMsgLength: nrs.MaxMsgLength, } + unlock() // add the packet msgs to RelayPackets for _, rp := range rlyPackets { @@ -464,7 +465,7 @@ func relayPacketFromQueryResponse(src, dst *PathEnd, res *ctypes.ResultTx, // if we have decided not to relay this packet, don't add it switch { - case sh.GetHeight(src.ChainID) >= rp.timeout: + case rp.timeout != 0 && sh.GetHeight(dst.ChainID) >= rp.timeout: timeoutPackets = append(timeoutPackets, rp.timeoutPacket()) case rp.timeoutStamp != 0 && time.Now().UnixNano() >= int64(rp.timeoutStamp): timeoutPackets = append(timeoutPackets, rp.timeoutPacket()) diff --git a/relayer/relayMsgs.go b/relayer/relayMsgs.go index e0e06311550..fb106792ec3 100644 --- a/relayer/relayMsgs.go +++ b/relayer/relayMsgs.go @@ -4,6 +4,8 @@ import ( "fmt" "strings" + "github.com/gogo/protobuf/proto" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -60,15 +62,20 @@ func (r *RelayMsgs) Send(src, dst *Chain) { // submit batches of relay transactions for _, msg := range r.Src { + bz, err := proto.Marshal(msg) + if err != nil { + panic(err) + } + msgLen++ - txSize += uint64(len(msg.GetSignBytes())) + txSize += uint64(len(bz)) if r.IsMaxTx(msgLen, txSize) { // Submit the transactions to src chain and update its status r.success = r.success && send(src, msgs) // clear the current batch and reset variables - msgLen, txSize = 1, uint64(len(msg.GetSignBytes())) + msgLen, txSize = 1, uint64(len(bz)) msgs = []sdk.Msg{} } msgs = append(msgs, msg) @@ -84,15 +91,20 @@ func (r *RelayMsgs) Send(src, dst *Chain) { msgs = []sdk.Msg{} for _, msg := range r.Dst { + bz, err := proto.Marshal(msg) + if err != nil { + panic(err) + } + msgLen++ - txSize += uint64(len(msg.GetSignBytes())) + txSize += uint64(len(bz)) if r.IsMaxTx(msgLen, txSize) { // Submit the transaction to dst chain and update its status r.success = r.success && send(dst, msgs) // clear the current batch and reset variables - msgLen, txSize = 1, uint64(len(msg.GetSignBytes())) + msgLen, txSize = 1, uint64(len(bz)) msgs = []sdk.Msg{} } msgs = append(msgs, msg)