add error handling to reissueMachineNFT

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2023-07-26 15:05:45 +02:00 committed by Julian Strobl
parent 722eb60bcf
commit a63f390490
No known key found for this signature in database
GPG Key ID: E0A8F9AD733499A7

View File

@ -22,7 +22,10 @@ func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMach
}
if msg.Machine.Reissue {
k.reissueMachineNFT(msg.Machine)
err := k.reissueMachineNFT(msg.Machine)
if err != nil {
return nil, errors.New("an error occured while reissuning the machine")
}
}
k.StoreMachine(ctx, *msg.Machine)
@ -40,7 +43,7 @@ func validateIssuerLiquid(issuerLiquid string) bool {
return isValidLiquidKey
}
func (k msgServer) reissueMachineNFT(machine *types.Machine) {
func (k msgServer) reissueMachineNFT(machine *types.Machine) error {
client := osc.NewClient("localhost", 8765)
msg := osc.NewMessage("/rddl/*")
msg.Append(machine.Name)
@ -49,5 +52,6 @@ func (k msgServer) reissueMachineNFT(machine *types.Machine) {
msg.Append(machine.Amount)
msg.Append("1")
msg.Append(machine.Precision)
client.Send(msg)
err := client.Send(msg)
return err
}