Commit 957a16f0 authored by mdj33's avatar mdj33 Committed by vipwzw

cmd improve

parent 55589cbe
......@@ -58,8 +58,7 @@ type client struct {
commitMsgClient *commitMsgClient
blockSyncClient *blockSyncClient
multiDldCli *multiDldClient
authAccount string
privateKey crypto.PrivKey
minerPrivateKey crypto.PrivKey
wg sync.WaitGroup
subCfg *subConfig
isClosed int32
......@@ -138,15 +137,15 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
}
para := &client{
BaseClient: c,
authAccount: subcfg.AuthAccount,
privateKey: priKey,
subCfg: &subcfg,
quitCreate: make(chan struct{}),
BaseClient: c,
minerPrivateKey: priKey,
subCfg: &subcfg,
quitCreate: make(chan struct{}),
}
para.commitMsgClient = &commitMsgClient{
paraClient: para,
authAccount: subcfg.AuthAccount,
waitMainBlocks: waitBlocks4CommitMsg,
waitConsensStopTimes: waitConsensStopTimes,
consensHeight: -2,
......
......@@ -175,7 +175,7 @@ func TestAddMinerTx(t *testing.T) {
para := &client{BaseClient: &drivers.BaseClient{}}
para.SetAPI(api)
para.subCfg = new(subConfig)
para.privateKey = priKey
para.minerPrivateKey = priKey
para.commitMsgClient = new(commitMsgClient)
para.commitMsgClient.paraClient = para
......
......@@ -53,6 +53,7 @@ type commitMsgClient struct {
consensHeight int64
consensDoneHeight int64
selfConsensError int32 //自共识比主链共识更高的异常场景,需要等待自共识<=主链共识再发送
authAccount string
authAccountIn bool
isRollBack int32
checkTxCommitTimes int32
......@@ -76,7 +77,7 @@ func (client *commitMsgClient) handler() {
client.paraClient.wg.Add(1)
go client.getMainConsensusInfo()
if client.paraClient.authAccount != "" {
if client.authAccount != "" {
client.paraClient.wg.Add(1)
client.sendMsgCh = make(chan *types.Transaction, 1)
go client.sendCommitMsg()
......@@ -275,7 +276,7 @@ func (client *commitMsgClient) checkAuthAccountIn() {
if err != nil {
return
}
authExist := strings.Contains(nodes, client.paraClient.authAccount)
authExist := strings.Contains(nodes, client.authAccount)
//如果授权节点重新加入,需要从当前共识高度重新发送
if !client.authAccountIn && authExist {
......@@ -361,7 +362,7 @@ func (client *commitMsgClient) getSendingTx(startHeight, endHeight int64) (*type
for i, msg := range sendingMsgs {
plog.Debug("paracommitmsg sending", "idx", i, "height", msg.Height, "mainheight", msg.MainBlockHeight,
"blockhash", common.HashHex(msg.BlockHash), "mainHash", common.HashHex(msg.MainBlockHash),
"from", client.paraClient.authAccount)
"from", client.authAccount)
}
return signTx, count
......@@ -678,7 +679,7 @@ out:
isSync = true
}
if client.paraClient.authAccount != "" {
if client.authAccount != "" {
client.GetProperFeeRate()
}
......@@ -836,7 +837,7 @@ func (client *commitMsgClient) getNodeGroupAddrs() (string, error) {
}
func (client *commitMsgClient) onWalletStatus(status *types.WalletStatus) {
if status == nil || client.paraClient.authAccount == "" {
if status == nil || client.authAccount == "" {
return
}
if !status.IsWalletLock && client.privateKey == nil {
......@@ -858,7 +859,7 @@ func (client *commitMsgClient) onWalletStatus(status *types.WalletStatus) {
}
func (client *commitMsgClient) onWalletAccount(acc *types.Account) {
if acc == nil || client.paraClient.authAccount == "" || client.paraClient.authAccount != acc.Addr || client.privateKey != nil {
if acc == nil || client.authAccount == "" || client.authAccount != acc.Addr || client.privateKey != nil {
return
}
err := client.fetchPriKey()
......@@ -872,7 +873,7 @@ func (client *commitMsgClient) onWalletAccount(acc *types.Account) {
}
func (client *commitMsgClient) fetchPriKey() error {
req := &types.ReqString{Data: client.paraClient.authAccount}
req := &types.ReqString{Data: client.authAccount}
msg := client.paraClient.GetQueueClient().NewMessage("wallet", types.EventDumpPrivkey, req)
err := client.paraClient.GetQueueClient().Send(msg, true)
......
......@@ -561,7 +561,7 @@ out:
count = int64(len(paraTxs.Items))
}
//如果超过1个block,则认为当前正在追赶,暂不处理
if client.authAccount != "" && len(paraTxs.Items) == 1 {
if client.commitMsgClient.authAccount != "" && len(paraTxs.Items) == 1 {
client.commitMsgClient.commitTxCheckNotify(paraTxs.Items[0].TxDetails)
}
......
......@@ -231,7 +231,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
if err == nil {
isSyncCaughtUp := lastBlock.Height+1 == lastLocalHeight
client.setSyncCaughtUp(isSyncCaughtUp)
if client.paraClient.authAccount != "" {
if client.paraClient.commitMsgClient.authAccount != "" {
client.printDebugInfo("Para sync - add block commit", "isSyncCaughtUp", isSyncCaughtUp)
client.paraClient.commitMsgClient.updateChainHeightNotify(lastBlock.Height+1, false)
}
......@@ -250,7 +250,7 @@ func (client *blockSyncClient) syncBlocksIfNeed() (bool, error) {
//通知发送层
if err == nil {
client.setSyncCaughtUp(false)
if client.paraClient.authAccount != "" {
if client.paraClient.commitMsgClient.authAccount != "" {
client.printDebugInfo("Para sync - rollback block commit", "isSyncCaughtUp", false)
client.paraClient.commitMsgClient.updateChainHeightNotify(lastBlock.Height-1, true)
}
......@@ -384,7 +384,7 @@ func (client *blockSyncClient) addMinerTx(preStateHash []byte, block *types.Bloc
return err
}
tx.Sign(types.SECP256K1, client.paraClient.privateKey)
tx.Sign(types.SECP256K1, client.paraClient.minerPrivateKey)
block.Txs = append([]*types.Transaction{tx}, block.Txs...)
return nil
......
......@@ -66,7 +66,7 @@ func createParaTestInstance(t *testing.T, q queue.Queue) *client {
assert.Nil(t, err)
priKey, err := secp.PrivKeyFromBytes(pk)
assert.Nil(t, err)
para.privateKey = priKey
para.minerPrivateKey = priKey
//实例化BlockSyncClient
para.blockSyncClient = &blockSyncClient{
......
......@@ -336,11 +336,11 @@ function para_cross_transfer_withdraw() {
echo "${hash}"
query_tx "${CLI}" "${hash}"
hash=$(${CLI} send para asset_transfer --ptitle user.p.para. -a 1.4 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
hash=$(${CLI} send para asset_transfer --paraName user.p.para. -a 1.4 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
hash2=$(${CLI} send para asset_withdraw --ptitle user.p.para. -a 0.7 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
hash2=$(${CLI} send para asset_withdraw --paraName user.p.para. -a 0.7 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
local times=200
while true; do
......@@ -426,12 +426,12 @@ function para_cross_transfer_withdraw_for_token() {
query_tx "${MAIN_CLI}" "${hash}"
echo "=========== # 2.transfer asset to para chain ============="
hash=$(${CLI} send para asset_transfer --ptitle user.p.para. -s FZM -a 220 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${CLI} send para asset_transfer --paraName user.p.para. -s FZM -a 220 -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
echo "${hash}"
query_tx "${MAIN_CLI}" "${hash}"
echo "=========== # 3.asset_withdraw from parachain ============="
${CLI} send para asset_withdraw --ptitle user.p.para. -a 111 -s FZM -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
${CLI} send para asset_withdraw --paraName user.p.para. -a 111 -s FZM -n test -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
local times=100
while true; do
......
......@@ -13,4 +13,5 @@ help: ## Display this help screen
@printf "Help doc:\nUsage: make docker-compose op=[command]\n"
@printf "[command]\n"
@printf "[nodegroup]: create super node group if not create \n"
@printf "[wallet]: set node wallet private key if not set \n"
\ No newline at end of file
@printf "[wallet]: set node wallet private key if not set \n"
@printf "[miner]: unlock wallet to miner \n"
\ No newline at end of file
# 平行链授权节点一键式部署
## 需求
平行链申请超级节点步骤比较多,需要设置的地方也比较多,容易遗漏
## 使用
1. 把编译好的chain33,chain33-cli,chain33.toml,和chain33.para.toml和本脚本目录放到一起
1. 修改config文件配置项,每个配置项都有说明
1. make docker-compose 缺省启动
1. make docker-compose op=nodegroup 配置超级账户组
1. make docker-compose op=wallet 配置钱包开启共识
1. 系统缺省会把区块链数据从docker重映射到本地storage目录,以后默认启动历史数据不会丢失
1. make docker-compose down 停止当前平行链
## 系统重启
1. 系统重启使用 make docker-compose即可, 起来后 make docker-compose op=miner开启挖矿
\ No newline at end of file
paraName="test"
#genesisAccount=""
#genesisAmount=100000000
#mainStartHeight=4800000
#authAccount=()
#authPrikey=()
##docker8901端口暴露到宿主机的端口
#authPort=("18901" "18902" "18903" "18904")
#
##需要和chain33 主链保持一致
#superManager="['1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP']"
#
##nodegroup create
##申请超级账户需要在主链冻结币数量
#authFrozenCoins=0
#nodeGroupApplier=""
#applierPrikey=""
#superManagerPrikey=""
#平行链名字,这里不需要加user.p.前缀
paraName="test"
#### 测试链配置,主链配置需要把如下测试链配置屏蔽 ##########
#### 测试链配置四个节点例子,主链配置需要把如下测试链配置屏蔽 ##########
#创世账户
genesisAccount="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
#创世数量
genesisAmount=100000000
#从主链哪个高度开始同步区块
mainStartHeight=4000000
#平行链授权账户,这里的数量要和下面的authPrikey和authPort保持一致
authAccount=( "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR" "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs")
#授权账户的私钥,为了导入钱包,自动开启共识挖矿
authPrikey=("0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" "0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115" "0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71")
#授权节点的宿主机端口
authPort=("18901" "18902" "18903" "18904")
#需要和chain33 主链保持一致
......@@ -32,8 +22,12 @@ superManager="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
tokenApprs="['12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv']"
#nodegroup create
#超级账户创建
#授权账户申请需要在主链上冻结的BTY数量,申请之前需要chain33项目方沟通,需要chain33超级管理员审批通过
authFrozenCoins=0
#超级账户组申请者,需要事先在paracross合约转移必须的BTY,数量=申请的授权账户数量*authFrozenCoins
nodeGroupApplier="1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
#超级账户组申请者私钥 签名交易使用
applierPrikey="0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
superManagerPrikey="4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
\ No newline at end of file
#超级管理员私钥,在主链上申请不需要填
superManagerPrikey="4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
......@@ -87,6 +87,13 @@ function para_import_wallet() {
./$CHAIN33_CLI --rpc_laddr "http://localhost:$port" wallet status
}
function para_unlock_wallet() {
for ((i = 0; i < ${#authPort[@]}; i++)); do
echo "=========== # para unlock wallet ${authPort[$i]}============="
./$CHAIN33_CLI --rpc_laddr "http://localhost:${authPort[$i]}" wallet unlock -p 1314fuzamei -t 0
done
}
function start() {
echo "=========== # docker-compose ps ============="
docker-compose ps
......@@ -175,6 +182,7 @@ EOF
volumes:
- "../storage/parachain$i/paradatadir:/root/paradatadir"
- "../storage/parachain$i/logs:/root/logs"
- "../storage/parachain$i/parawallet:/root/parawallet"
EOF
done
......@@ -260,6 +268,10 @@ function main() {
para_set_wallet
fi
if [ "$1" == "miner" ]; then
para_unlock_wallet
fi
echo "===============================parachain startup end========================================================="
}
......
......@@ -42,6 +42,7 @@ func ParcCmd() *cobra.Command {
GetHeightCmd(),
GetBlockInfoCmd(),
GetLocalBlockInfoCmd(),
GetConsensDoneInfoCmd(),
)
return cmd
}
......@@ -66,9 +67,6 @@ func addCreateAssetTransferFlags(cmd *cobra.Command) {
cmd.Flags().StringP("note", "n", "", "transaction note info")
cmd.Flags().StringP("ptitle", "", "", "the title of para chain, like `user.p.guodun.`")
cmd.MarkFlagRequired("ptitle")
cmd.Flags().StringP("symbol", "s", "", "default for bty, symbol for token")
}
......@@ -98,9 +96,6 @@ func addCreateAssetWithdrawFlags(cmd *cobra.Command) {
cmd.Flags().StringP("note", "n", "", "transaction note info")
cmd.Flags().StringP("ptitle", "", "", "the title of para chain, like `user.p.guodun.`")
cmd.MarkFlagRequired("ptitle")
cmd.Flags().StringP("to", "t", "", "receiver account address")
cmd.MarkFlagRequired("to")
......@@ -117,7 +112,7 @@ func createAssetWithdraw(cmd *cobra.Command, args []string) {
}
func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
title, _ := cmd.Flags().GetString("title")
title, _ := cmd.Flags().GetString("paraName")
cfg := types.GetCliSysParam(title)
amount, _ := cmd.Flags().GetFloat64("amount")
......@@ -130,12 +125,11 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
note, _ := cmd.Flags().GetString("note")
symbol, _ := cmd.Flags().GetString("symbol")
ptitle, _ := cmd.Flags().GetString("ptitle")
if !strings.HasPrefix(ptitle, "user.p") {
fmt.Fprintln(os.Stderr, "ptitle is not right, title format like `user.p.guodun.`")
if !strings.HasPrefix(title, "user.p") {
fmt.Fprintln(os.Stderr, "title is not right, title format like `user.p.guodun.`")
return "", types.ErrInvalidParam
}
execName := ptitle + pt.ParaX
execName := title + pt.ParaX
param := types.CreateTx{
To: toAddr,
......@@ -269,7 +263,10 @@ func createNodeJoinTx(cmd *cobra.Command, args []string) {
opAddr, _ := cmd.Flags().GetString("addr")
coins, _ := cmd.Flags().GetFloat64("coins")
paraName, _ := cmd.Flags().GetString("paraName")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 1, Addr: opAddr, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -304,7 +301,10 @@ func createNodeVoteTx(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
val, _ := cmd.Flags().GetUint32("value")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 2, Id: id, Value: val}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -337,7 +337,10 @@ func addNodeQuitFlags(cmd *cobra.Command) {
func createNodeQuitTx(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
opAddr, _ := cmd.Flags().GetString("addr")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 3, Addr: opAddr}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -370,7 +373,10 @@ func addNodeCancelFlags(cmd *cobra.Command) {
func createNodeCancelTx(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeAddrConfig{Title: paraName, Op: 4, Id: id}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -655,6 +661,11 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
addrs, _ := cmd.Flags().GetString("addrs")
coins, _ := cmd.Flags().GetFloat64("coins")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 1, Addrs: addrs, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -691,6 +702,11 @@ func nodeGroupApprove(cmd *cobra.Command, args []string) {
id, _ := cmd.Flags().GetString("id")
coins, _ := cmd.Flags().GetFloat64("coins")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 2, Id: id, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -722,7 +738,10 @@ func addNodeGroupQuitCmdFlags(cmd *cobra.Command) {
func nodeGroupQuit(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
id, _ := cmd.Flags().GetString("id")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 3, Id: id}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -754,7 +773,10 @@ func addNodeGroupModifyCmdFlags(cmd *cobra.Command) {
func nodeGroupModify(cmd *cobra.Command, args []string) {
paraName, _ := cmd.Flags().GetString("paraName")
coins, _ := cmd.Flags().GetFloat64("coins")
if !strings.HasPrefix(paraName, "user.p") {
fmt.Fprintln(os.Stderr, "paraName is not right, paraName format like `user.p.guodun.`")
return
}
payload := &pt.ParaNodeGroupConfig{Title: paraName, Op: 4, CoinsFrozen: int64(math.Trunc((coins+0.0000001)*1e4)) * 1e4}
params := &rpctypes.CreateTxIn{
Execer: getRealExecName(paraName, pt.ParaX),
......@@ -1110,3 +1132,34 @@ func showSelfStages(cmd *cobra.Command, args []string) {
ctx := jsonclient.NewRPCCtx(rpcLaddr, "paracross.ListSelfStages", params, &res)
ctx.Run()
}
func addConsensDoneCmdFlags(cmd *cobra.Command) {
cmd.Flags().Int64P("height", "g", 0, "height to para chain")
cmd.MarkFlagRequired("height")
}
func consensDoneInfo(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
paraName, _ := cmd.Flags().GetString("paraName")
height, _ := cmd.Flags().GetInt64("height")
params := pt.ReqParacrossTitleHeight{
Title: paraName,
Height: height,
}
var res pt.RespParacrossDone
ctx := jsonclient.NewRPCCtx(rpcLaddr, "paracross.GetDoneTitleHeight", params, &res)
ctx.Run()
}
// GetConsensDoneInfoCmd get para chain done height consens info
func GetConsensDoneInfoCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "consens_done",
Short: "Get para chain done height consensus info",
Run: consensDoneInfo,
}
addConsensDoneCmdFlags(cmd)
return cmd
}
......@@ -30,6 +30,7 @@ func (e *Paracross) ExecLocal_Commit(payload *pt.ParacrossCommitAction, tx *type
} else if log.Ty == pt.TyLogParacrossCommitDone {
var g pt.ReceiptParacrossDone
types.Decode(log.Log, &g)
g.ChainExecHeight = e.GetHeight()
key := calcLocalTitleKey(g.Title)
set.KV = append(set.KV, &types.KeyValue{Key: key, Value: types.Encode(&g)})
......
......@@ -380,12 +380,13 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
}
return &pt.RespParacrossDone{
TotalNodes: st.TotalNodes,
TotalCommit: st.TotalCommit,
MostSameCommit: st.MostSameCommit,
Title: st.Title,
Height: st.Height,
TxResult: hex.EncodeToString(st.TxResult),
TotalNodes: st.TotalNodes,
TotalCommit: st.TotalCommit,
MostSameCommit: st.MostSameCommit,
Title: st.Title,
Height: st.Height,
ChainExecHeight: st.ChainExecHeight,
TxResult: hex.EncodeToString(st.TxResult),
}, nil
}
......
......@@ -328,6 +328,7 @@ message ReceiptParacrossDone {
repeated bytes crossTxHashs = 12;
bytes mainBlockHash = 13;
int64 mainBlockHeight = 14;
int64 chainExecHeight = 15;
}
message ReceiptParacrossRecord {
......@@ -356,6 +357,8 @@ message RespParacrossDone {
string stateHash = 6;
uint32 txCounts = 7;
string txResult = 8;
//commitDone chainHeight
int64 chainExecHeight= 9;
}
message RespParacrossTitles {
......
......@@ -118,6 +118,19 @@ func (c *channelClient) GetDoneTitleHeight(ctx context.Context, req *pt.ReqParac
return nil, types.ErrDecode
}
// GetAssetTxResult get asset tx result
func (c *Jrpc) GetDoneTitleHeight(req *pt.ReqParacrossTitleHeight, result *interface{}) error {
if req == nil {
return types.ErrInvalidParam
}
data, err := c.cli.GetDoneTitleHeight(context.Background(), req)
if err != nil {
return err
}
*result = data
return err
}
func (c *channelClient) GetAssetTxResult(ctx context.Context, req *types.ReqString) (*pt.ParacrossAssetRsp, error) {
cfg := c.GetConfig()
data, err := c.Query(pt.GetExecName(cfg), "GetAssetTxResult", req)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment