diff --git a/src/Neo.CLI/CLI/MainService.Block.cs b/src/Neo.CLI/CLI/MainService.Block.cs index b778992468..76a0be35bc 100644 --- a/src/Neo.CLI/CLI/MainService.Block.cs +++ b/src/Neo.CLI/CLI/MainService.Block.cs @@ -69,12 +69,12 @@ private void OnExportBlocksStartCountCommand(uint start, uint count = uint.MaxVa /// Reads blocks from a stream and yields blocks that are not yet in the blockchain. /// /// The stream to read blocks from. - /// If true, reads the start block index from the stream. + /// If true, reads the start block index from the stream. /// An enumerable of blocks that are not yet in the blockchain. - private IEnumerable GetBlocks(Stream stream, bool read_start = false) + private IEnumerable GetBlocks(Stream stream, bool readStart = false) { using BinaryReader r = new BinaryReader(stream); - uint start = read_start ? r.ReadUInt32() : 0; + uint start = readStart ? r.ReadUInt32() : 0; uint count = r.ReadUInt32(); uint end = start + count - 1; uint currentHeight = NativeContract.Ledger.CurrentIndex(NeoSystem.StoreView); diff --git a/src/Neo.VM/JumpTable/JumpTable.Control.cs b/src/Neo.VM/JumpTable/JumpTable.Control.cs index e3e140b9b8..8abf1389d9 100644 --- a/src/Neo.VM/JumpTable/JumpTable.Control.cs +++ b/src/Neo.VM/JumpTable/JumpTable.Control.cs @@ -534,21 +534,21 @@ public virtual void EndFinally(ExecutionEngine engine, Instruction instruction) [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual void Ret(ExecutionEngine engine, Instruction instruction) { - var context_pop = engine.InvocationStack.Pop(); - var stack_eval = engine.InvocationStack.Count == 0 ? engine.ResultStack : engine.InvocationStack.Peek().EvaluationStack; - if (context_pop.EvaluationStack != stack_eval) + var contextPop = engine.InvocationStack.Pop(); + var stackEval = engine.InvocationStack.Count == 0 ? engine.ResultStack : engine.InvocationStack.Peek().EvaluationStack; + if (contextPop.EvaluationStack != stackEval) { - if (context_pop.RVCount >= 0 && context_pop.EvaluationStack.Count != context_pop.RVCount) + if (contextPop.RVCount >= 0 && contextPop.EvaluationStack.Count != contextPop.RVCount) // This exception indicates a mismatch between the expected and actual number of stack items. // It typically occurs due to compilation errors caused by potential issues in the compiler, resulting in either too many or too few // items left on the stack compared to what was anticipated by the return value count. // When you run into this problem, try to reach core-devs at https://github.com/neo-project/neo for help. - throw new InvalidOperationException($"Return value count mismatch: expected {context_pop.RVCount}, but got {context_pop.EvaluationStack.Count} items on the evaluation stack"); - context_pop.EvaluationStack.CopyTo(stack_eval); + throw new InvalidOperationException($"Return value count mismatch: expected {contextPop.RVCount}, but got {contextPop.EvaluationStack.Count} items on the evaluation stack"); + contextPop.EvaluationStack.CopyTo(stackEval); } if (engine.InvocationStack.Count == 0) engine.State = VMState.HALT; - engine.UnloadContext(context_pop); + engine.UnloadContext(contextPop); engine.isJumping = true; } diff --git a/src/Neo.VM/ReferenceCounter.cs b/src/Neo.VM/ReferenceCounter.cs index 46aa318274..fb68c4286e 100644 --- a/src/Neo.VM/ReferenceCounter.cs +++ b/src/Neo.VM/ReferenceCounter.cs @@ -154,7 +154,7 @@ public int CheckZeroReferred() for (var node = _cachedComponents.First; node != null;) { var component = node.Value; - bool on_stack = false; + bool onStack = false; // Check if any item in the SCC is still on the stack. foreach (StackItem item in component) @@ -162,13 +162,13 @@ public int CheckZeroReferred() // An item is considered 'on stack' if it has stack references or if its parent items are still on stack. if (item.StackReferences > 0 || item.ObjectReferences?.Values.Any(p => p.References > 0 && p.Item.OnStack) == true) { - on_stack = true; + onStack = true; break; } } // If any item in the component is on stack, mark all items in the component as on stack. - if (on_stack) + if (onStack) { foreach (StackItem item in component) item.OnStack = true; diff --git a/src/Neo.VM/Types/Map.cs b/src/Neo.VM/Types/Map.cs index 6538820be3..bebef14a1f 100644 --- a/src/Neo.VM/Types/Map.cs +++ b/src/Neo.VM/Types/Map.cs @@ -51,8 +51,8 @@ public StackItem this[PrimitiveType key] if (IsReadOnly) throw new InvalidOperationException("The map is readonly, can not set value."); if (ReferenceCounter != null) { - if (_dict.TryGetValue(key, out StackItem? old_value)) - ReferenceCounter.RemoveReference(old_value, this); + if (_dict.TryGetValue(key, out StackItem? oldValue)) + ReferenceCounter.RemoveReference(oldValue, this); else ReferenceCounter.AddReference(key, this); if (value is CompoundType { ReferenceCounter: null }) diff --git a/src/Neo/BigDecimal.cs b/src/Neo/BigDecimal.cs index 0570d98458..204b792d12 100644 --- a/src/Neo/BigDecimal.cs +++ b/src/Neo/BigDecimal.cs @@ -148,12 +148,12 @@ public static bool TryParse(string s, byte decimals, out BigDecimal result) var index = s.IndexOfAny(['e', 'E']); if (index >= 0) { - if (!sbyte.TryParse(s[(index + 1)..], out var e_temp)) + if (!sbyte.TryParse(s[(index + 1)..], out var eTemp)) { result = default; return false; } - e = e_temp; + e = eTemp; s = s[..index]; } index = s.IndexOf('.'); diff --git a/src/Neo/Ledger/Blockchain.cs b/src/Neo/Ledger/Blockchain.cs index c8acb3bd0b..183dd2f491 100644 --- a/src/Neo/Ledger/Blockchain.cs +++ b/src/Neo/Ledger/Blockchain.cs @@ -277,15 +277,15 @@ private VerifyResult OnNewBlock(Block block) _blockCache.TryAdd(blockHash, block); if (block.Index == currentHeight + 1) { - var block_persist = block; + var blockPersist = block; var blocksToPersistList = new List(); while (true) { - blocksToPersistList.Add(block_persist); - if (block_persist.Index + 1 > headerHeight) break; - var header = _system.HeaderCache[block_persist.Index + 1]; + blocksToPersistList.Add(blockPersist); + if (blockPersist.Index + 1 > headerHeight) break; + var header = _system.HeaderCache[blockPersist.Index + 1]; if (header == null) break; - if (!_blockCache.TryGetValue(header.Hash, out block_persist)) break; + if (!_blockCache.TryGetValue(header.Hash, out blockPersist)) break; } var blocksPersisted = 0; @@ -443,7 +443,7 @@ private void Persist(Block block) { using (var snapshot = _system.GetSnapshotCache()) { - var all_application_executed = new List(); + var allApplicationExecuted = new List(); TransactionState[] transactionStates; using (var engine = ApplicationEngine.Create(TriggerType.OnPersist, null, snapshot, block, _system.Settings, 0)) { @@ -454,11 +454,14 @@ private void Persist(Block block) throw engine.FaultException; throw new InvalidOperationException(); } - ApplicationExecuted application_executed = new(engine); - Context.System.EventStream.Publish(application_executed); - all_application_executed.Add(application_executed); + + var applicationExecuted = new ApplicationExecuted(engine); + Context.System.EventStream.Publish(applicationExecuted); + + allApplicationExecuted.Add(applicationExecuted); transactionStates = engine.GetState(); } + var clonedSnapshot = snapshot.CloneCache(); // Warning: Do not write into variable snapshot directly. Write into variable clonedSnapshot and commit instead. foreach (var transactionState in transactionStates) @@ -475,10 +478,12 @@ private void Persist(Block block) { clonedSnapshot = snapshot.CloneCache(); } - ApplicationExecuted application_executed = new(engine); - Context.System.EventStream.Publish(application_executed); - all_application_executed.Add(application_executed); + + var applicationExecuted = new ApplicationExecuted(engine); + Context.System.EventStream.Publish(applicationExecuted); + allApplicationExecuted.Add(applicationExecuted); } + using (var engine = ApplicationEngine.Create(TriggerType.PostPersist, null, snapshot, block, _system.Settings, 0)) { engine.LoadScript(s_postPersistScript); @@ -488,13 +493,16 @@ private void Persist(Block block) throw engine.FaultException; throw new InvalidOperationException(); } - ApplicationExecuted application_executed = new(engine); - Context.System.EventStream.Publish(application_executed); - all_application_executed.Add(application_executed); + + var applicationExecuted = new ApplicationExecuted(engine); + Context.System.EventStream.Publish(applicationExecuted); + allApplicationExecuted.Add(applicationExecuted); } - InvokeCommitting(_system, block, snapshot, all_application_executed); + + InvokeCommitting(_system, block, snapshot, allApplicationExecuted); snapshot.Commit(); } + InvokeCommitted(_system, block); _system.MemPool.UpdatePoolForBlockPersisted(block, _system.StoreView); _extensibleWitnessWhiteList = null; diff --git a/src/Neo/Persistence/DataCache.cs b/src/Neo/Persistence/DataCache.cs index 2e20f9cadd..eaf6866561 100644 --- a/src/Neo/Persistence/DataCache.cs +++ b/src/Neo/Persistence/DataCache.cs @@ -256,55 +256,57 @@ public void Delete(StorageKey key) } /// - public IEnumerable<(StorageKey Key, StorageItem Value)> Find(StorageKey? key_prefix = null, SeekDirection direction = SeekDirection.Forward) + public IEnumerable<(StorageKey Key, StorageItem Value)> Find(StorageKey? keyPrefix = null, SeekDirection direction = SeekDirection.Forward) { - var key = key_prefix?.ToArray(); + var key = keyPrefix?.ToArray(); return Find(key, direction); } /// /// Finds the entries starting with the specified prefix. /// - /// The prefix of the key. + /// The prefix of the key. /// The search direction. /// The entries found with the desired prefix. - public IEnumerable<(StorageKey Key, StorageItem Value)> Find(byte[]? key_prefix = null, SeekDirection direction = SeekDirection.Forward) + public IEnumerable<(StorageKey Key, StorageItem Value)> Find(byte[]? keyPrefix = null, SeekDirection direction = SeekDirection.Forward) { - var seek_prefix = key_prefix; + var seekPrefix = keyPrefix; if (direction == SeekDirection.Backward) { - ArgumentNullException.ThrowIfNull(key_prefix); - if (key_prefix.Length == 0) + ArgumentNullException.ThrowIfNull(keyPrefix); + if (keyPrefix.Length == 0) { // Backwards seek for zero prefix is not supported for now. - throw new ArgumentOutOfRangeException(nameof(key_prefix)); + throw new ArgumentOutOfRangeException(nameof(keyPrefix)); } - seek_prefix = null; - for (var i = key_prefix.Length - 1; i >= 0; i--) + seekPrefix = null; + for (var i = keyPrefix.Length - 1; i >= 0; i--) { - if (key_prefix[i] < 0xff) + if (keyPrefix[i] < 0xff) { - seek_prefix = key_prefix.Take(i + 1).ToArray(); - // The next key after the key_prefix. - seek_prefix[i]++; + seekPrefix = keyPrefix.Take(i + 1).ToArray(); + // The next key after the keyPrefix. + seekPrefix[i]++; break; } } - if (seek_prefix == null) + if (seekPrefix == null) { - throw new ArgumentException($"{nameof(key_prefix)} with all bytes being 0xff is not supported now"); + throw new ArgumentException($"{nameof(keyPrefix)} with all bytes being 0xff is not supported now"); } } - return FindInternal(key_prefix, seek_prefix, direction); + return FindInternal(keyPrefix, seekPrefix, direction); } - private IEnumerable<(StorageKey Key, StorageItem Value)> FindInternal(byte[]? key_prefix, byte[]? seek_prefix, SeekDirection direction) + private IEnumerable<(StorageKey Key, StorageItem Value)> FindInternal(byte[]? keyPrefix, byte[]? seekPrefix, SeekDirection direction) { - foreach (var (key, value) in Seek(seek_prefix, direction)) - if (key_prefix == null || key.ToArray().AsSpan().StartsWith(key_prefix)) + foreach (var (key, value) in Seek(seekPrefix, direction)) + { + if (keyPrefix == null || key.ToArray().AsSpan().StartsWith(keyPrefix)) yield return (key, value); - else if (direction == SeekDirection.Forward || (seek_prefix == null || !key.ToArray().SequenceEqual(seek_prefix))) + else if (direction == SeekDirection.Forward || (seekPrefix == null || !key.ToArray().SequenceEqual(seekPrefix))) yield break; + } } /// @@ -320,10 +322,12 @@ public void Delete(StorageKey key) ? ByteArrayComparer.Default : ByteArrayComparer.Reverse; foreach (var (key, value) in Seek(start, direction)) + { if (comparer.Compare(key.ToArray(), end) < 0) yield return (key, value); else yield break; + } } /// diff --git a/src/Neo/Persistence/IReadOnlyStore.cs b/src/Neo/Persistence/IReadOnlyStore.cs index ec3cd0536c..b15ccf4bf7 100644 --- a/src/Neo/Persistence/IReadOnlyStore.cs +++ b/src/Neo/Persistence/IReadOnlyStore.cs @@ -69,10 +69,10 @@ public TValue this[TKey key] /// /// Finds the entries starting with the specified prefix. /// - /// The prefix of the key. + /// The prefix of the key. /// The search direction. /// The entries found with the desired prefix. - public IEnumerable<(TKey Key, TValue Value)> Find(TKey? key_prefix = null, SeekDirection direction = SeekDirection.Forward); + public IEnumerable<(TKey Key, TValue Value)> Find(TKey? keyPrefix = null, SeekDirection direction = SeekDirection.Forward); } } diff --git a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs index bbdef2e7d4..9aca67043d 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs @@ -41,7 +41,7 @@ partial class ApplicationEngine /// public const int MaxNotificationCount = 512; - private uint random_times = 0; + private uint randomTimes = 0; /// /// The of System.Runtime.Platform. @@ -314,7 +314,7 @@ protected internal BigInteger GetRandom() long price; if (IsHardforkEnabled(Hardfork.HF_Aspidochelone)) { - buffer = Cryptography.Helper.Murmur128(nonceData, ProtocolSettings.Network + random_times++); + buffer = Cryptography.Helper.Murmur128(nonceData, ProtocolSettings.Network + randomTimes++); price = 1 << 13; } else diff --git a/src/Neo/SmartContract/Native/FungibleToken.cs b/src/Neo/SmartContract/Native/FungibleToken.cs index 7b99c0da7c..3ed5268786 100644 --- a/src/Neo/SmartContract/Native/FungibleToken.cs +++ b/src/Neo/SmartContract/Native/FungibleToken.cs @@ -136,37 +136,38 @@ private protected async ContractTask Transfer(ApplicationEngine engine, UI if (amount.Sign < 0) throw new ArgumentOutOfRangeException(nameof(amount), "cannot be negative"); if (!from.Equals(engine.CallingScriptHash) && !engine.CheckWitnessInternal(from)) return false; - StorageKey key_from = CreateStorageKey(Prefix_Account, from); - StorageItem storage_from = engine.SnapshotCache.GetAndChange(key_from); + + StorageKey keyFrom = CreateStorageKey(Prefix_Account, from); + StorageItem storageFrom = engine.SnapshotCache.GetAndChange(keyFrom); if (amount.IsZero) { - if (storage_from != null) + if (storageFrom != null) { - TState state_from = storage_from.GetInteroperable(); - OnBalanceChanging(engine, from, state_from, amount); + TState stateFrom = storageFrom.GetInteroperable(); + OnBalanceChanging(engine, from, stateFrom, amount); } } else { - if (storage_from is null) return false; - TState state_from = storage_from.GetInteroperable(); - if (state_from.Balance < amount) return false; + if (storageFrom is null) return false; + TState stateFrom = storageFrom.GetInteroperable(); + if (stateFrom.Balance < amount) return false; if (from.Equals(to)) { - OnBalanceChanging(engine, from, state_from, BigInteger.Zero); + OnBalanceChanging(engine, from, stateFrom, BigInteger.Zero); } else { - OnBalanceChanging(engine, from, state_from, -amount); - if (state_from.Balance == amount) - engine.SnapshotCache.Delete(key_from); + OnBalanceChanging(engine, from, stateFrom, -amount); + if (stateFrom.Balance == amount) + engine.SnapshotCache.Delete(keyFrom); else - state_from.Balance -= amount; - StorageKey key_to = CreateStorageKey(Prefix_Account, to); - StorageItem storage_to = engine.SnapshotCache.GetAndChange(key_to, () => new StorageItem(new TState())); - TState state_to = storage_to.GetInteroperable(); - OnBalanceChanging(engine, to, state_to, amount); - state_to.Balance += amount; + stateFrom.Balance -= amount; + StorageKey keyTo = CreateStorageKey(Prefix_Account, to); + StorageItem storageTo = engine.SnapshotCache.GetAndChange(keyTo, () => new StorageItem(new TState())); + TState stateTo = storageTo.GetInteroperable(); + OnBalanceChanging(engine, to, stateTo, amount); + stateTo.Balance += amount; } } await PostTransferAsync(engine, from, to, amount, data, true); diff --git a/src/Neo/SmartContract/Native/NativeContract.cs b/src/Neo/SmartContract/Native/NativeContract.cs index 4a22c91b53..e2e3d640db 100644 --- a/src/Neo/SmartContract/Native/NativeContract.cs +++ b/src/Neo/SmartContract/Native/NativeContract.cs @@ -55,7 +55,7 @@ public CacheEntry GetAllowedMethods(NativeContract native, ApplicationEngine eng private readonly ImmutableHashSet _usedHardforks; private readonly ReadOnlyCollection _methodDescriptors; private readonly ReadOnlyCollection _eventsDescriptors; - private static int id_counter = 0; + private static int idCounter = 0; #region Named Native Contracts @@ -134,7 +134,7 @@ public CacheEntry GetAllowedMethods(NativeContract native, ApplicationEngine eng /// /// The id of the native contract. /// - public int Id { get; } = --id_counter; + public int Id { get; } = --idCounter; /// /// Initializes a new instance of the class. diff --git a/src/Neo/SmartContract/Native/NeoToken.cs b/src/Neo/SmartContract/Native/NeoToken.cs index 137c4e45aa..63341f9738 100644 --- a/src/Neo/SmartContract/Native/NeoToken.cs +++ b/src/Neo/SmartContract/Native/NeoToken.cs @@ -412,52 +412,53 @@ private bool UnregisterCandidate(ApplicationEngine engine, ECPoint pubkey) private async ContractTask Vote(ApplicationEngine engine, UInt160 account, ECPoint voteTo) { if (!engine.CheckWitnessInternal(account)) return false; - NeoAccountState state_account = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_Account, account))?.GetInteroperable(); - if (state_account is null) return false; - if (state_account.Balance == 0) return false; - CandidateState validator_new = null; + NeoAccountState stateAccount = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_Account, account))?.GetInteroperable(); + if (stateAccount is null) return false; + if (stateAccount.Balance == 0) return false; + + CandidateState validatorNew = null; if (voteTo != null) { - validator_new = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_Candidate, voteTo))?.GetInteroperable(); - if (validator_new is null) return false; - if (!validator_new.Registered) return false; + validatorNew = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_Candidate, voteTo))?.GetInteroperable(); + if (validatorNew is null) return false; + if (!validatorNew.Registered) return false; } - if (state_account.VoteTo is null ^ voteTo is null) + if (stateAccount.VoteTo is null ^ voteTo is null) { StorageItem item = engine.SnapshotCache.GetAndChange(_votersCount); - if (state_account.VoteTo is null) - item.Add(state_account.Balance); + if (stateAccount.VoteTo is null) + item.Add(stateAccount.Balance); else - item.Add(-state_account.Balance); + item.Add(-stateAccount.Balance); } - GasDistribution gasDistribution = DistributeGas(engine, account, state_account); - if (state_account.VoteTo != null) + GasDistribution gasDistribution = DistributeGas(engine, account, stateAccount); + if (stateAccount.VoteTo != null) { - StorageKey key = CreateStorageKey(Prefix_Candidate, state_account.VoteTo); - StorageItem storage_validator = engine.SnapshotCache.GetAndChange(key); - CandidateState state_validator = storage_validator.GetInteroperable(); - state_validator.Votes -= state_account.Balance; - CheckCandidate(engine.SnapshotCache, state_account.VoteTo, state_validator); + StorageKey key = CreateStorageKey(Prefix_Candidate, stateAccount.VoteTo); + StorageItem storageValidator = engine.SnapshotCache.GetAndChange(key); + CandidateState stateValidator = storageValidator.GetInteroperable(); + stateValidator.Votes -= stateAccount.Balance; + CheckCandidate(engine.SnapshotCache, stateAccount.VoteTo, stateValidator); } - if (voteTo != null && voteTo != state_account.VoteTo) + if (voteTo != null && voteTo != stateAccount.VoteTo) { StorageKey voterRewardKey = CreateStorageKey(Prefix_VoterRewardPerCommittee, voteTo); var latestGasPerVote = engine.SnapshotCache.TryGet(voterRewardKey) ?? BigInteger.Zero; - state_account.LastGasPerVote = latestGasPerVote; + stateAccount.LastGasPerVote = latestGasPerVote; } - ECPoint from = state_account.VoteTo; - state_account.VoteTo = voteTo; + ECPoint from = stateAccount.VoteTo; + stateAccount.VoteTo = voteTo; - if (validator_new != null) + if (validatorNew != null) { - validator_new.Votes += state_account.Balance; + validatorNew.Votes += stateAccount.Balance; } else { - state_account.LastGasPerVote = 0; + stateAccount.LastGasPerVote = 0; } engine.SendNotification(Hash, "Vote", - new VM.Types.Array(engine.ReferenceCounter) { account.ToArray(), from?.ToArray() ?? StackItem.Null, voteTo?.ToArray() ?? StackItem.Null, state_account.Balance }); + new VM.Types.Array(engine.ReferenceCounter) { account.ToArray(), from?.ToArray() ?? StackItem.Null, voteTo?.ToArray() ?? StackItem.Null, stateAccount.Balance }); if (gasDistribution is not null) await GAS.Mint(engine, gasDistribution.Account, gasDistribution.Amount, true); return true; diff --git a/src/Neo/SmartContract/Native/OracleContract.cs b/src/Neo/SmartContract/Native/OracleContract.cs index bf1036b1e8..66adb73fa3 100644 --- a/src/Neo/SmartContract/Native/OracleContract.cs +++ b/src/Neo/SmartContract/Native/OracleContract.cs @@ -225,9 +225,9 @@ private async ContractTask Request(ApplicationEngine engine, string url, string await GAS.Mint(engine, Hash, gasForResponse, false); //Increase the request id - var item_id = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_RequestId)); - var id = (ulong)(BigInteger)item_id; - item_id.Add(1); + var itemId = engine.SnapshotCache.GetAndChange(CreateStorageKey(Prefix_RequestId)); + var id = (ulong)(BigInteger)itemId; + itemId.Add(1); //Put the request to storage if (!ContractManagement.IsContract(engine.SnapshotCache, engine.CallingScriptHash)) diff --git a/src/Neo/Wallets/NEP6/NEP6Wallet.cs b/src/Neo/Wallets/NEP6/NEP6Wallet.cs index e9d99d9c77..c21e8abda0 100644 --- a/src/Neo/Wallets/NEP6/NEP6Wallet.cs +++ b/src/Neo/Wallets/NEP6/NEP6Wallet.cs @@ -106,26 +106,26 @@ private void AddAccount(NEP6Account account) { lock (accounts) { - if (accounts.TryGetValue(account.ScriptHash, out NEP6Account account_old)) + if (accounts.TryGetValue(account.ScriptHash, out var accountOld)) { - account.Label = account_old.Label; - account.IsDefault = account_old.IsDefault; - account.Lock = account_old.Lock; + account.Label = accountOld.Label; + account.IsDefault = accountOld.IsDefault; + account.Lock = accountOld.Lock; if (account.Contract == null) { - account.Contract = account_old.Contract; + account.Contract = accountOld.Contract; } else { - NEP6Contract contract_old = (NEP6Contract)account_old.Contract; - if (contract_old != null) + var contractOld = (NEP6Contract)accountOld.Contract; + if (contractOld != null) { NEP6Contract contract = (NEP6Contract)account.Contract; - contract.ParameterNames = contract_old.ParameterNames; - contract.Deployed = contract_old.Deployed; + contract.ParameterNames = contractOld.ParameterNames; + contract.Deployed = contractOld.Deployed; } } - account.Extra = account_old.Extra; + account.Extra = accountOld.Extra; } accounts[account.ScriptHash] = account; }