Modify IBC to work with new proof serialization

This commit is contained in:
Ethan Frey 2017-09-08 17:48:27 +02:00
parent 46d10db990
commit f967c1dc07
3 changed files with 11 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/stack"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/go-wire/data"
"github.com/tendermint/iavl"
)
// TODO: query seeds (register/update)
@ -201,18 +202,22 @@ func packetQueryCmd(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
if len(bs) == 0 {
// TODO: what info here?
return errors.New("no such packet")
}
err = wire.ReadBinaryBytes(bs, &packet)
if err != nil {
return err
}
// create the post packet here.
post := ibc.PostPacketTx{
FromChainID: commands.GetChainID(),
FromChainHeight: height,
Key: key,
Packet: packet,
Proof: proof,
Proof: proof.(*iavl.KeyExistsProof),
}
// print json direct, as we don't need to wrap with the height

View File

@ -70,7 +70,7 @@ func makePostPacket(tree *iavl.IAVLTree, packet Packet, fromID string, fromHeigh
return PostPacketTx{
FromChainID: fromID,
FromChainHeight: uint64(fromHeight),
Proof: proof,
Proof: proof.(*iavl.KeyExistsProof),
Key: key,
Packet: packet,
}

View File

@ -115,9 +115,9 @@ type PostPacketTx struct {
// The block height in which Packet was committed, to check Proof
FromChainHeight uint64 `json:"src_height"`
// this proof must match the header and the packet.Bytes()
Proof iavl.KeyProof `json:"proof"`
Key data.Bytes `json:"key"`
Packet Packet `json:"packet"`
Proof *iavl.KeyExistsProof `json:"proof"`
Key data.Bytes `json:"key"`
Packet Packet `json:"packet"`
}
// ValidateBasic makes sure this is consistent - used to satisfy TxInner