From cc600bdd5001a15bb9a655d138e47bede9d4b742 Mon Sep 17 00:00:00 2001 From: mosesyzding <893588380@qq.com> Date: Tue, 27 Sep 2022 11:09:16 +0800 Subject: [PATCH] feat:modify getContractInfo, --story=1012324 --- contractmgr/contract_manager.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/contractmgr/contract_manager.go b/contractmgr/contract_manager.go index 37da5e5..e97973c 100644 --- a/contractmgr/contract_manager.go +++ b/contractmgr/contract_manager.go @@ -311,22 +311,21 @@ func (r *ContractManagerRuntime) fetchDisabledContractList(txSimContext protocol func (r *ContractManagerRuntime) getContractInfo(txSimContext protocol.TxSimContext, parameters map[string][]byte) ( []byte, error) { name := string(parameters[syscontract.GetContractInfo_CONTRACT_NAME.String()]) - contract, err := r.GetContractInfo(txSimContext, name) + cfg, err := txSimContext.GetBlockchainStore().GetLastChainConfig() if err != nil { - cfg, e := txSimContext.GetBlockchainStore().GetLastChainConfig() - if e != nil { - return nil, err - } + return nil, err + } - if cfg.Vm.AddrType == config.AddrType_ZXL && txSimContext.GetBlockVersion() >= 2300 && - utils.CheckZxlAddrFormat(name) { - contract, err = r.GetContractInfo(txSimContext, name[2:]) - } + if cfg.Vm.AddrType == config.AddrType_ZXL && txSimContext.GetBlockVersion() >= 2300 && + utils.CheckZxlAddrFormat(name) { + name = name[2:] + } - if err != nil || len(contract.Name) == 0 { - return nil, err - } + contract, err := r.GetContractInfo(txSimContext, name) + if err != nil { + return nil, err } + // RuntimeType_GO is not exposed in v230 if contract.RuntimeType == commonPb.RuntimeType_GO { contract.RuntimeType = commonPb.RuntimeType_DOCKER_GO -- GitLab