diff --git a/src/neo/Network/P2P/Payloads/Transaction.cs b/src/neo/Network/P2P/Payloads/Transaction.cs
index e511e17c94..41bc126474 100644
--- a/src/neo/Network/P2P/Payloads/Transaction.cs
+++ b/src/neo/Network/P2P/Payloads/Transaction.cs
@@ -127,7 +127,7 @@ public int Size
}
///
- /// Distributed to NEO holders.
+ /// Fee to be burned.
///
public long SystemFee
{
diff --git a/src/neo/SmartContract/Native/Tokens/GasToken.cs b/src/neo/SmartContract/Native/Tokens/GasToken.cs
index 7e89bd02c2..1f05114062 100644
--- a/src/neo/SmartContract/Native/Tokens/GasToken.cs
+++ b/src/neo/SmartContract/Native/Tokens/GasToken.cs
@@ -3,13 +3,8 @@
using Neo.Cryptography.ECC;
using Neo.Ledger;
using Neo.Network.P2P.Payloads;
-using Neo.Persistence;
-using Neo.VM;
-using Neo.VM.Types;
-using System;
using System.Linq;
using System.Numerics;
-using VMArray = Neo.VM.Types.Array;
namespace Neo.SmartContract.Native.Tokens
{
@@ -21,8 +16,6 @@ public sealed class GasToken : Nep5Token
public override string Symbol => "gas";
public override byte Decimals => 8;
- private const byte Prefix_SystemFeeAmount = 15;
-
internal GasToken()
{
}
@@ -44,30 +37,7 @@ protected override bool OnPersist(ApplicationEngine engine)
ECPoint[] validators = NEO.GetNextBlockValidators(engine.Snapshot);
UInt160 primary = Contract.CreateSignatureRedeemScript(validators[engine.Snapshot.PersistingBlock.ConsensusData.PrimaryIndex]).ToScriptHash();
Mint(engine, primary, engine.Snapshot.PersistingBlock.Transactions.Sum(p => p.NetworkFee));
- BigInteger sys_fee = GetSysFeeAmount(engine.Snapshot, engine.Snapshot.PersistingBlock.Index - 1) + engine.Snapshot.PersistingBlock.Transactions.Sum(p => p.SystemFee);
- StorageKey key = CreateStorageKey(Prefix_SystemFeeAmount, BitConverter.GetBytes(engine.Snapshot.PersistingBlock.Index));
- engine.Snapshot.Storages.Add(key, new StorageItem
- {
- Value = sys_fee.ToByteArrayStandard(),
- IsConstant = true
- });
return true;
}
-
- [ContractMethod(0_01000000, ContractParameterType.Integer, ParameterTypes = new[] { ContractParameterType.Integer }, ParameterNames = new[] { "index" }, SafeMethod = true)]
- private StackItem GetSysFeeAmount(ApplicationEngine engine, VMArray args)
- {
- uint index = (uint)args[0].GetBigInteger();
- return GetSysFeeAmount(engine.Snapshot, index);
- }
-
- public BigInteger GetSysFeeAmount(StoreView snapshot, uint index)
- {
- if (index == 0) return Blockchain.GenesisBlock.Transactions.Sum(p => p.SystemFee);
- StorageKey key = CreateStorageKey(Prefix_SystemFeeAmount, BitConverter.GetBytes(index));
- StorageItem storage = snapshot.Storages.TryGet(key);
- if (storage is null) return BigInteger.Zero;
- return new BigInteger(storage.Value);
- }
}
}
diff --git a/src/neo/SmartContract/Native/Tokens/NeoToken.cs b/src/neo/SmartContract/Native/Tokens/NeoToken.cs
index aaea004edf..ec19edb85f 100644
--- a/src/neo/SmartContract/Native/Tokens/NeoToken.cs
+++ b/src/neo/SmartContract/Native/Tokens/NeoToken.cs
@@ -94,7 +94,6 @@ private BigInteger CalculateBonus(StoreView snapshot, BigInteger value, uint sta
}
amount += (iend - istart) * Blockchain.GenerationAmount[ustart];
}
- amount += (GAS.GetSysFeeAmount(snapshot, end - 1) - (start == 0 ? 0 : GAS.GetSysFeeAmount(snapshot, start - 1))) / GAS.Factor;
return value * amount * GAS.Factor / TotalAmount;
}
diff --git a/tests/neo.UnitTests/SmartContract/Native/Tokens/UT_GasToken.cs b/tests/neo.UnitTests/SmartContract/Native/Tokens/UT_GasToken.cs
index 614322aa20..be6e6a1d77 100644
--- a/tests/neo.UnitTests/SmartContract/Native/Tokens/UT_GasToken.cs
+++ b/tests/neo.UnitTests/SmartContract/Native/Tokens/UT_GasToken.cs
@@ -7,7 +7,6 @@
using Neo.SmartContract.Native;
using Neo.UnitTests.Extensions;
using Neo.VM;
-using Neo.VM.Types;
using System;
using System.Linq;
using System.Numerics;
@@ -138,46 +137,5 @@ public void Check_BadScript()
NativeContract.GAS.Invoke(engine).Should().BeFalse();
}
-
- [TestMethod]
- public void TestGetSysFeeAmount1()
- {
- using (ApplicationEngine engine = NativeContract.GAS.TestCall("getSysFeeAmount", 2u))
- {
- engine.ResultStack.Peek().GetBigInteger().Should().Be(new BigInteger(0));
- engine.ResultStack.Peek().GetType().Should().Be(typeof(Integer));
- }
-
- using (ApplicationEngine engine = NativeContract.GAS.TestCall("getSysFeeAmount", 0u))
- {
- engine.ResultStack.Peek().GetBigInteger().Should().Be(new BigInteger(0));
- }
- }
-
- [TestMethod]
- public void TestGetSysFeeAmount2()
- {
- var snapshot = Blockchain.Singleton.GetSnapshot();
- NativeContract.GAS.GetSysFeeAmount(snapshot, 0).Should().Be(new BigInteger(0));
- NativeContract.GAS.GetSysFeeAmount(snapshot, 1).Should().Be(new BigInteger(0));
-
- byte[] key = BitConverter.GetBytes(1);
- StorageKey storageKey = new StorageKey
- {
- Id = NativeContract.GAS.Id,
- Key = new byte[sizeof(byte) + key.Length]
- };
- storageKey.Key[0] = 15;
- key.CopyTo(storageKey.Key.AsSpan(1));
-
- BigInteger sys_fee = new BigInteger(10);
- snapshot.Storages.Add(storageKey, new StorageItem
- {
- Value = sys_fee.ToByteArrayStandard(),
- IsConstant = true
- });
-
- NativeContract.GAS.GetSysFeeAmount(snapshot, 1).Should().Be(sys_fee);
- }
}
}