From f13c54f582678ac3c30c7d1693e6153734f0bfe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Tue, 5 Mar 2024 15:29:24 +0100 Subject: [PATCH] fixed mqtt URI bug (#334) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adjusted to refactored path * removed go routine from attest machine msg server Signed-off-by: Jürgen Eckel --- util/machine_nft_test.go | 3 ++- util/mqtt.go | 2 +- x/machine/keeper/msg_server_attest_machine.go | 14 ++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/util/machine_nft_test.go b/util/machine_nft_test.go index 18aa82d..a87a5c8 100644 --- a/util/machine_nft_test.go +++ b/util/machine_nft_test.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/planetmint/planetmint-go/testutil/keeper" + "github.com/planetmint/planetmint-go/testutil/moduleobject" "github.com/planetmint/planetmint-go/testutil/sample" "github.com/planetmint/planetmint-go/util" "github.com/planetmint/planetmint-go/util/mocks" @@ -33,7 +34,7 @@ func TestMachineNFTIssuance(t *testing.T) { util.RegisterAssetServiceHTTPClient = &mocks.MockClient{} _, ctx := keeper.MachineKeeper(t) sk, pk := sample.KeyPair() - machine := sample.Machine(pk, pk, sk, "") + machine := moduleobject.Machine(pk, pk, sk, "") goCtx := sdk.WrapSDKContext(ctx) err := util.IssueMachineNFT(goCtx, &machine, "https", "testnet-asset.rddl.io", "/register_asset") diff --git a/util/mqtt.go b/util/mqtt.go index 6b27963..3de4bc5 100644 --- a/util/mqtt.go +++ b/util/mqtt.go @@ -39,7 +39,7 @@ func lazyLoadMQTTClient() { conf := config.GetConfig() hostPort := net.JoinHostPort(conf.MqttDomain, strconv.FormatInt(int64(conf.MqttPort), 10)) - uri := "tcp://%s" + hostPort + uri := "tcp://" + hostPort opts := mqtt.NewClientOptions().AddBroker(uri) opts.SetClientID(conf.ValidatorAddress) diff --git a/x/machine/keeper/msg_server_attest_machine.go b/x/machine/keeper/msg_server_attest_machine.go index 0a4d6e1..5176bab 100644 --- a/x/machine/keeper/msg_server_attest_machine.go +++ b/x/machine/keeper/msg_server_attest_machine.go @@ -44,14 +44,12 @@ func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMach scheme := params.AssetRegistryScheme domain := params.AssetRegistryDomain path := params.AssetRegistryPath - go func() { - localErr := util.IssueMachineNFT(goCtx, msg.Machine, scheme, domain, path) - if localErr != nil { - util.GetAppLogger().Error(ctx, "Machine NFT issuance failed : "+localErr.Error()) - } else { - util.GetAppLogger().Info(ctx, "Machine NFT issuance successful: "+msg.Machine.String()) - } - }() + localErr := util.IssueMachineNFT(goCtx, msg.Machine, scheme, domain, path) + if localErr != nil { + util.GetAppLogger().Error(ctx, "Machine NFT issuance failed : "+localErr.Error()) + } else { + util.GetAppLogger().Info(ctx, "Machine NFT issuance successful: "+msg.Machine.String()) + } } else { util.GetAppLogger().Info(ctx, "Not block proposer: skipping Machine NFT issuance") }