Skip to content

Commit

Permalink
make core.MsgID marshallable by protobuf
Browse files Browse the repository at this point in the history
Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Oct 16, 2023
1 parent 0a2b77f commit 38e3889
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 26 deletions.
8 changes: 4 additions & 4 deletions chains/tendermint/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]core.MsgID, error) {
var msgIDs []core.MsgID
for msgIndex := range msgs {
msgIDs = append(msgIDs, &MsgID{
txHash: res.TxHash,
msgIndex: uint32(msgIndex),
TxHash: res.TxHash,
MsgIndex: uint32(msgIndex),
})
}
return msgIDs, nil
Expand All @@ -418,7 +418,7 @@ func (c *Chain) GetMsgResult(id core.MsgID) (core.MsgResult, error) {
}

// find tx
resTx, err := c.waitForCommit(msgID.txHash)
resTx, err := c.waitForCommit(msgID.TxHash)
if err != nil {
return nil, fmt.Errorf("failed to query tx: %v", err)
}
Expand All @@ -445,7 +445,7 @@ func (c *Chain) GetMsgResult(id core.MsgID) (core.MsgResult, error) {
}

// parse the ABCI logs into core.MsgEventLog's
events, err := parseMsgEventLogs(abciLogs, msgID.msgIndex)
events, err := parseMsgEventLogs(abciLogs, msgID.MsgIndex)
if err != nil {
return nil, fmt.Errorf("failed to parse msg event log: %v", err)
}
Expand Down
11 changes: 1 addition & 10 deletions chains/tendermint/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ var (
_ core.MsgResult = (*MsgResult)(nil)
)

type MsgID struct {
core.IsMsgID

txHash string
msgIndex uint32
}

func (i *MsgID) String() string {
return fmt.Sprintf("%s:%d", i.txHash, i.msgIndex)
}
func (*MsgID) Is_MsgID() {}

type MsgResult struct {
height clienttypes.Height
Expand Down
343 changes: 343 additions & 0 deletions chains/tendermint/msgid.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 38e3889

Please sign in to comment.