Skip to content

Commit

Permalink
add address to process
Browse files Browse the repository at this point in the history
  • Loading branch information
antho1404 committed Mar 12, 2020
1 parent 101399d commit d5a0262
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 67 deletions.
140 changes: 73 additions & 67 deletions process/process.pb.go

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

4 changes: 4 additions & 0 deletions protobuf/types/process.proto
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,8 @@ message Process {
repeated Edge edges = 5 [
(gogoproto.moretags) = 'hash:"name:5" validate:"dive,required"'
];

string address = 6 [
(gogoproto.moretags) = 'hash:"-"'
];
}
2 changes: 2 additions & 0 deletions x/process/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/mesg-foundation/engine/process"
processpb "github.com/mesg-foundation/engine/process"
"github.com/mesg-foundation/engine/x/process/internal/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
)

Expand Down Expand Up @@ -46,6 +47,7 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateProcess) (*processpb
Edges: msg.Request.Edges,
}
p.Hash = hash.Dump(p)
p.Address = sdk.AccAddress(crypto.AddressHash(p.Hash)).String()
if store.Has(p.Hash) {
return nil, fmt.Errorf("process %q already exists", p.Hash)
}
Expand Down

0 comments on commit d5a0262

Please sign in to comment.