Skip to content

Commit

Permalink
removed print statements, basic tests passed
Browse files Browse the repository at this point in the history
  • Loading branch information
avendauz committed Aug 3, 2021
1 parent f5735d6 commit 318fa62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
23 changes: 11 additions & 12 deletions x/curium/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,22 @@ func (k Keeper) NewMsgBroadcaster(keyringDir string, cdc *codec.Codec) MsgBroadc
func DoBroadcast (resp chan *MsgBroadcasterResponse, keyringDir string, cdc *codec.Codec, curiumKeeper Keeper, accKeeper *keeper.AccountKeeper, ctx sdk.Context, msgs []sdk.Msg, from string) {

returnError := func(err error) {
fmt.Println("ERROR DURING BROADCASTING", err)

resp <- &MsgBroadcasterResponse{
Error: err,
}
}

//defer func () {
// r:= recover()
// curiumKeeper.Logger(ctx).Error("DoBroadcast", "error", r)
//
// if r != nil {
// returnError(r.(error))
// } else {
// returnError(errors.New("nil error returned"))
// }
//}()
defer func () {
r:= recover()
curiumKeeper.Logger(ctx).Error("DoBroadcast", "error", r)

if r != nil {
returnError(r.(error))
} else {
returnError(errors.New("nil error returned"))
}
}()

kr, err := getKeyring(keyringDir)

Expand Down Expand Up @@ -246,7 +246,6 @@ func DoBroadcast (resp chan *MsgBroadcasterResponse, keyringDir string, cdc *cod


if err != nil {
fmt.Println("FAILED BROADCAST TX SYNC BY BROADCASTER")
returnError(err)
return
}
Expand Down
8 changes: 2 additions & 6 deletions x/nft/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ func handleMsgPublishFile(ctx sdk.Context, k Keeper, msg *types.MsgPublishFile)

k.BtClient.RetrieveFile(&metainfo)

fmt.Println("FINISHED RETRIEVING FILE")
k.EnsureNftDirExists()
fmt.Println("BEFORE SYMLINKING")

err := os.Symlink(k.HomeDir+"/nft/"+msg.Hash, k.HomeDir+"/nft/"+msg.Vendor + "-" + msg.Id)
fmt.Println("AFTER SYMLINKING")

if err != nil {
fmt.Println("FAILED SYMLINK")
return nil, err
}
info := types.NftInfo{
Expand All @@ -103,12 +101,10 @@ func handleMsgPublishFile(ctx sdk.Context, k Keeper, msg *types.MsgPublishFile)
}
err = os.WriteFile(k.HomeDir+"/nft/"+msg.Hash+".info", k.Cdc.MustMarshalJSON(&info), 0666)
if err != nil {
fmt.Println("FAILED METADATA FILE WRITE")
return nil, err
}
err = os.Symlink(k.HomeDir+"/nft/"+msg.Hash+".info", k.HomeDir+"/nft/"+msg.Vendor + "-" + msg.Id+".info")
if err != nil {
fmt.Println("FAILED METADATA FILE SYMLINK")
return nil, err
}
return &sdk.Result{}, nil
Expand Down

0 comments on commit 318fa62

Please sign in to comment.