Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/Neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,6 @@ private ExecutionContext CallContractInternal(ContractState contract, ContractMe
throw new InvalidOperationException($"Cannot Call Method {method.Name} Of Contract {contract.Hash} From Contract {CurrentScriptHash}");
}

// Check whitelist

if (IsHardforkEnabled(Hardfork.HF_Faun) &&
NativeContract.Policy.IsWhitelistFeeContract(SnapshotCache, contract.Hash, method, out var fixedFee))
{
AddFee(fixedFee.Value * ApplicationEngine.FeeFactor);
state.WhiteListed = true;
}

if (invocationCounter.TryGetValue(contract.Hash, out var counter))
{
invocationCounter[contract.Hash] = counter + 1;
Expand All @@ -408,6 +399,13 @@ private ExecutionContext CallContractInternal(ContractState contract, ContractMe
var contextNew = LoadContract(contract, method, flags & callingFlags);
state = contextNew.GetState<ExecutionContextState>();
state.CallingContext = currentContext;
// Check whitelist
if (IsHardforkEnabled(Hardfork.HF_Faun) &&
NativeContract.Policy.IsWhitelistFeeContract(SnapshotCache, contract.Hash, method, out var fixedFee))
{
AddFee(fixedFee.Value * FeeFactor);
state.WhiteListed = true;
}

for (int i = args.Count - 1; i >= 0; i--)
contextNew.EvaluationStack.Push(args[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ public void TestWhiteListFee()
Assert.HasCount(1, engine.Notifications); // Whitelist changed
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(0, engine.ResultStack.Pop().GetInteger());
Assert.AreEqual(1045290, engine.FeeConsumed);
Assert.AreEqual(1045260, engine.FeeConsumed);

// Clean white list

Expand Down