Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
revert error print
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangTao1596 committed Nov 18, 2021
1 parent 2a97a53 commit 2b68502
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions neo-cli/CLI/MainService.Contracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ private void OnDeployCommand(string filePath, string manifestPath = null, JObjec
{
if (NoWallet()) return;
byte[] script = LoadDeploymentScript(filePath, manifestPath, data, out var nef, out var manifest);

Transaction tx = CurrentWallet.MakeTransaction(NeoSystem.StoreView, script);

Transaction tx;
try
{
tx = CurrentWallet.MakeTransaction(NeoSystem.StoreView, script);
}
catch (InvalidOperationException e)
{
ConsoleHelper.Error(GetExceptionMessage(e));
return;
}
UInt160 hash = SmartContract.Helper.GetContractHash(tx.Sender, nef.CheckSum, manifest.Name);

ConsoleHelper.Info("Contract hash: ", $"{hash}");
Expand Down Expand Up @@ -83,8 +90,15 @@ private void OnUpdateCommand(UInt160 scriptHash, string filePath, string manifes
};

byte[] script = LoadUpdateScript(scriptHash, filePath, manifestPath, data, out var nef, out var manifest);
tx = CurrentWallet.MakeTransaction(NeoSystem.StoreView, script, sender, signers);

try
{
tx = CurrentWallet.MakeTransaction(NeoSystem.StoreView, script, sender, signers);
}
catch (InvalidOperationException e)
{
ConsoleHelper.Error(GetExceptionMessage(e));
return;
}
ContractState contract = NativeContract.ContractManagement.GetContract(NeoSystem.StoreView, scriptHash);
if (contract == null)
{
Expand Down

0 comments on commit 2b68502

Please sign in to comment.