[CLI] Fix enterprise tx command
- when enterprise tx is not in block, print tx payload only
@@ -130,6 +130,7 @@ var enterpriseTxCmd = &cobra.Command{
tx *aergorpc.Tx
msgblock *aergorpc.TxInBlock
output OutConfChange
+ txInBlock bool
)
tx, err = client.GetTX(context.Background(), &aergorpc.SingleBytes{Value: txHashDecode})
if err != nil {
@@ -139,6 +140,9 @@ var enterpriseTxCmd = &cobra.Command{
return
}
tx = msgblock.Tx
+ txInBlock = true
+ } else {
+ txInBlock = false
}
output.Payload = string(tx.GetBody().Payload)
var ci types.CallInfo
@@ -146,6 +150,7 @@ var enterpriseTxCmd = &cobra.Command{
cmd.Printf("Failed: tx payload is not json %s\n", err.Error())
return
}
+ if txInBlock {
switch ci.Name {
case enterprise.ChangeCluster:
// get requestID
@@ -175,6 +180,7 @@ var enterpriseTxCmd = &cobra.Command{
Error: receipt.GetRet(),
}
}
+ }
cmd.Println(output.ToString())
return
},
