Exemplo n.º 1
0
 public async Task MarkUnparallelizableAsync(IChainContext chainContext, Address contractAddress)
 {
     if (_smartContractExecutiveService.IsContractDeployOrUpdating(contractAddress))
     {
         return;
     }
     await MarkAsync(chainContext, contractAddress, true);
 }
Exemplo n.º 2
0
        private async Task <(Transaction, TransactionResourceInfo)> GetResourcesForOneWithCacheAsync(
            IChainContext chainContext,
            Transaction transaction, CancellationToken ct)
        {
            if (ct.IsCancellationRequested || _smartContractExecutiveService.IsContractDeployOrUpdating(transaction.To))
            {
                return(transaction, new TransactionResourceInfo()
                {
                    TransactionId = transaction.GetHash(),
                    ParallelType = ParallelType.NonParallelizable
                });
            }

            if (_resourceCache.TryGetValue(transaction.GetHash(), out var resourceCache))
            {
                return(transaction, resourceCache.ResourceInfo);
            }

            return(transaction, await GetResourcesForOneAsync(chainContext, transaction, ct));
        }