Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hyperledger fabric 错误:调用期间背书失败。响应:状态:500消息:“回复”\345\244\204\347\220\206\34……”;_Hyperledger Fabric - Fatal编程技术网

Hyperledger fabric 错误:调用期间背书失败。响应:状态:500消息:“回复”\345\244\204\347\220\206\34……”;

Hyperledger fabric 错误:调用期间背书失败。响应:状态:500消息:“回复”\345\244\204\347\220\206\34……”;,hyperledger-fabric,Hyperledger Fabric,我正在使用hyperledger fabric 1.4编写名为task.go的链码。在task.go中,我编写了一个名为transferBalance的函数,它实现了两个帐户之间的转账 func(t*TaskChaincode)transferBalance(stub shim.ChaincodeStubInterface,args[]字符串)pb.Response{ if len(args) != 3{ return shim.Error("Wrong number of g

我正在使用hyperledger fabric 1.4编写名为task.go的链码。在task.go中,我编写了一个名为transferBalance的函数,它实现了两个帐户之间的转账

func(t*TaskChaincode)transferBalance(stub shim.ChaincodeStubInterface,args[]字符串)pb.Response{

if len(args) != 3{
    return shim.Error("Wrong number of given parameters")
}

source := args[0]
target := args[1]
amount,err := strconv.Atoi(args[2])

if err != nil{
    return shim.Error("Format conversion failed")
}

if amount <= 0{
    return shim.Error("The number of designated transfer tokens must be greater than 0")
}


sacc,err := stub.GetState(source)
if err != nil {
    return shim.Error("Failed to obtain account information according to the specified account")
}

if sacc == nil {
    return shim.Error("The source account does not exist")
}


tacc,err := stub.GetState(target)
if err != nil {
    return shim.Error("Failed to obtain account information according to the specified account")
}

if tacc== nil {
    return shim.Error("The source account does not exist")
}

sval,err := strconv.Atoi(string(sacc))
if err != nil {
    return shim.Error("An error occurred while processing the source account balance")
}

tval,err := strconv.Atoi(string(tacc))
if err != nil {
    return shim.Error("An error occurred while processing the target account balance")
}

if sval < amount{
    return shim.Error("Insufficient balance")
}

sval = sval - amount
tval = tval + amount

err = stub.PutState(source,[]byte(strconv.Itoa(sval)))  
if err != nil {
    return shim.Error("Failed to save the status of the source account after the transfer")
}

err = stub.PutState(target,[]byte(strconv.Itoa(tval)))  
if err != nil {
    return shim.Error("Failed to save the status of the target account after the transfer")
}

return shim.Success([]byte("Successful tr"))
如果len(args)!=3{
返回垫片错误(“给定参数数量错误”)
}
来源:=args[0]
目标:=args[1]
金额,错误:=strconv.Atoi(参数[2])
如果错误!=零{
返回垫片。错误(“格式转换失败”)
}

如果金额很好,则该消息看起来像是一个八位字节字符串,它会转换为中文,而该中文消息会转换为英文,即“处理原始帐户余额时出错”。对问题中建议的数字的解释如下。
户余额时发生错误出现此错误日志。您能给我看一下相关的代码吗?非常感谢您的回复。我想我已经找到了问题的解决方案。您能分享这个问题的解决方案吗?我面临着相同的错误。消息看起来像是一个八位字节字符串,它可以转换为中文,而中文消息也可以翻译为英文“处理原始账户余额时出错”问题中建议的数字解释如下。
户余额时发生错误出现此错误日志。您能给我看一下相关代码吗?非常感谢您的回复。我想我已经找到了问题的解决方案。您能分享此问题的解决方案吗?我面临相同的错误。