go sdk上传数据时报错 Add tx failed, The tx pool has stopped
【问题分类】
- bug
- P2P网络相关(包含libp2p,liquid)
- 链账户身份与权限相关(证书问题、public、多签投票问题)
- 核心交易引擎相关(交易池、DAG)
- 共识相关
- 智能合约相关
- 存储相关
- SDK相关
- 长安链CMC工具
- 长安链管理台
- 长安链浏览器
- 长安链合约IDE
- 长安链web签名插件
- 跨链相关
- 轻节点相关
- 隐私计算相关
- 密码学相关
- 环境依赖
- 其他补充:
【问题描述】(请对问题进行描述,方便定位问题)
go sdk上传数据时报错 Add tx failed, The tx pool has stopped 上传数据到go合约的链时,调用testUserContractClaimInvoke和testUserContractInvoke(都试过了)报错
【相关日志文件】(如果有报错日志请贴图,或者上传附件)
chainmaker-go 的 log/system.log & bin/panic.log file * v2@v2.3.2/sdk_config.go:914 [SDK] use tls 2023-03-20 17:52:09.153 [DEBUG] [SDK] v2@v2.3.2/sdk_user_contract.go:164 [SDK] begin to INVOKE contract, [contractName:eduide01]/[method:invoke_contract]/[txId:]/[params:[key:"method" value:"save" key:"time" value:"202303162309" key:"sid" value:"330303202303162309" key:"sname" value:"\345\244\234\350\247\206\344\273\252" key:"suni" value:"zjjcxy" key:"scert" value:"\347\275\221\345\256\211" key:"shash" value:"hash202303162309" ]]
2023-03-20 17:52:09.170 [DEBUG] [SDK] v2@v2.3.2/sdk_client.go:260 [SDK] proposalRequest resp: code:INTERNAL_ERROR message:"Add tx failed, The tx pool has stopped, chainId:chain01, txId:174e17d86067a30ecac480634c813e57ee86e138bb4941c3978a7a4cb06f554b" tx_id:"174e17d86067a30ecac480634c813e57ee86e138bb4941c3978a7a4cb06f554b" SDK 的 sdk.log file
【系统信息】(请填写系统信息,方便定位问题)
- **chainmaker-go version * : [v2.3.1]
- **OS & version * :Linux version 4.19.91-26.an8.x86_64 (mockbuild@anolis-build-01.openanolis.cn) (gcc version 8.5.0 20210514 (Anolis 8.5.0-10.0.1) (GCC)) #1 SMP Tue May 24 13:10:09 CST 2022
- docker镜像 version:
- **管理台 version:2.3.1
- 如果是管理台的相关问题,请附带管理台版本,如果不是可忽略。
-
合约IDE version:
- 如果是合约IDE的相关问题,请附带合约IDE版本,如果不是可忽略。
package main
import (
"fmt"
"log"
"strconv"
"time"
"chainmaker.org/chainmaker/common/v2/crypto"
//"chainmaker.org/chainmaker/common/v2/random/uuid"
"github.com/google/uuid"
"chainmaker.org/chainmaker/pb-go/v2/common"
sdk "chainmaker.org/chainmaker/sdk-go/v2"
"chainmaker.org/chainmaker/sdk-go/v2/examples"
)
const (
createContractTimeout = 5
claimVersion = "1.0.1"
claimContractName = "eeduide02"
claimByteCodePath = "/root/gosdk/eduide.7z"
sdkConfigPKUser1Path = "./sdk_config_pk_user1.yml"
sdkConfigOrg1Client1Path = "./sdk_config_org1_client1.yml"
)
func main() {
testUserContractClaimInvoke(client, "invoke_contract", true)
}
func testUserContractClaimInvoke(client *sdk.ChainClient,
method string, withSyncResult bool) (string, error) {
kvs := []*common.KeyValuePair{
{
Key: "method",
Value: []byte("save"),
},
{
Key: "time",
Value: []byte("202303162309"),
},
{
Key: "sid",
Value: []byte("330303202303162309"),
},
{
Key: "sname",
Value: []byte("夜视仪"),
},
{
Key: "suni",
Value: []byte("zjschool"),
},
{
Key: "scert",
Value: []byte("网络"),
},
{
Key: "shash",
Value: []byte("hash202303162309"),
},
}
err := invokeUserContract(client, claimContractName, method, "", kvs, withSyncResult, &common.Limit{GasLimit: 200000})
if err != nil {
return "", err
}
return "fileHash", nil
}
func invokeUserContract(client *sdk.ChainClient, contractName, method, txId string,
kvs []*common.KeyValuePair, withSyncResult bool, limit *common.Limit) error {
resp, err := client.InvokeContractWithLimit(contractName, method, txId, kvs, -1, withSyncResult, limit)
if err != nil {
return err
}
if resp.Code != common.TxStatusCode_SUCCESS {
return fmt.Errorf("invoke contract failed, [code:%d]/[msg:%s]\n", resp.Code, resp.Message)
}
if !withSyncResult {
fmt.Printf("invoke contract success, resp: [code:%d]/[msg:%s]/[txId:%s]\n", resp.Code, resp.Message, resp.ContractResult.Result)
} else {
fmt.Printf("invoke contract success, resp: [code:%d]/[msg:%s]/[contractResult:%s]\n", resp.Code, resp.Message, resp.ContractResult)
}
return nil
}
func testUserContractClaimQuery(client *sdk.ChainClient, method string, kvs []*common.KeyValuePair) {
resp, err := client.QueryContract(claimContractName, method, kvs, -1)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("QUERY claim contract resp: %+v\n", resp)
}
func testContractGetTxByTxId(client *sdk.ChainClient, txId string) *common.TransactionInfo {
transactionInfo, err := client.GetTxByTxId(txId)
if err != nil {
log.Fatalln(err)
}
return transactionInfo
}
main()
2023-03-20 17:52:09.151 [DEBUG] [SDK] v2@v2.3.2/sdk_config.go:914 [SDK] use tls
2023-03-20 17:52:09.153 [DEBUG] [SDK] v2@v2.3.2/sdk_user_contract.go:164 [SDK] begin to INVOKE contract, [contractName:eduide01]/[method:invoke_contract]/[txId:]/[params:[key:"method" value:"save" key:"time" value:"202303162309" key:"sid" value:"330303202303162309" key:"sname" value:"\345\244\234\350\247\206\344\273\252" key:"suni" value:"zjjcxy" key:"scert" value:"\347\275\221\345\256\211" key:"shash" value:"hash202303162309" ]]
2023-03-20 17:52:09.170 [DEBUG] [SDK] v2@v2.3.2/sdk_client.go:260 [SDK] proposalRequest resp: code:INTERNAL_ERROR message:"Add tx failed, The tx pool has stopped, chainId:chain01, txId:174e17d86067a30ecac480634c813e57ee86e138bb4941c3978a7a4cb06f554b" tx_id:"174e17d86067a30ecac480634c813e57ee86e138bb4941c3978a7a4cb06f554b"