Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RpcNep5Tracker for uncollectible chain snapshot & ready for plugin-v2.10.3 release #131

Merged
merged 6 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions ApplicationLogs/ApplicationLogs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions CoreMetrics/CoreMetrics.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions ImportBlocks/ImportBlocks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions RpcNep5Tracker/RpcNep5Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Neo.Wallets;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
Expand Down Expand Up @@ -40,7 +41,7 @@ public override void Configure()
if (_db == null)
{
var dbPath = GetConfiguration().GetSection("DBPath").Value ?? "Nep5BalanceData";
_db = DB.Open(dbPath, new Options { CreateIfMissing = true });
_db = DB.Open(Path.GetFullPath(dbPath), new Options { CreateIfMissing = true });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this well rebased? i think that this change comes from another PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I sync it from NEO3's PR. When two nodes installed RpcNep5Tracker, they aren't able to run together on the same PC because they're using the same dbPath (relative path). This PR is able to solve this issue . I've tested it on my local.

}
_shouldTrackHistory = (GetConfiguration().GetSection("TrackHistory").Value ?? true.ToString()) != false.ToString();
_recordNullAddressHistory = (GetConfiguration().GetSection("RecordNullAddressHistory").Value ?? false.ToString()) != false.ToString();
Expand All @@ -67,10 +68,10 @@ private void ResetBatch()
private void RecordTransferHistory(Snapshot snapshot, UInt160 scriptHash, UInt160 from, UInt160 to, BigInteger amount, UInt256 txHash, ref ushort transferIndex)
{
if (!_shouldTrackHistory) return;
Header header = snapshot.GetHeader(snapshot.Height);
if (_recordNullAddressHistory || from != UInt160.Zero)
{
_transfersSent.Add(new Nep5TransferKey(from,
snapshot.GetHeader(snapshot.Height).Timestamp, scriptHash, transferIndex),
_transfersSent.Add(new Nep5TransferKey(from, header.Timestamp, scriptHash, transferIndex),
new Nep5Transfer
{
Amount = amount,
Expand All @@ -82,8 +83,7 @@ private void RecordTransferHistory(Snapshot snapshot, UInt160 scriptHash, UInt16

if (_recordNullAddressHistory || to != UInt160.Zero)
{
_transfersReceived.Add(new Nep5TransferKey(to,
snapshot.GetHeader(snapshot.Height).Timestamp, scriptHash, transferIndex),
_transfersReceived.Add(new Nep5TransferKey(to, header.Timestamp, scriptHash, transferIndex),
new Nep5Transfer
{
Amount = amount,
Expand Down Expand Up @@ -191,7 +191,7 @@ public void OnPersist(Snapshot snapshot, IReadOnlyList<Blockchain.ApplicationExe
script = sb.ToArray();
}

ApplicationEngine engine = ApplicationEngine.Run(script, snapshot);
ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, extraGAS: 100000000);
if (engine.State.HasFlag(VMState.FAULT)) continue;
if (engine.ResultStack.Count <= 0) continue;
nep5BalancePair.Value.Balance = engine.ResultStack.Pop().GetBigInteger();
Expand Down
4 changes: 2 additions & 2 deletions RpcNep5Tracker/RpcNep5Tracker.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
<LangVersion>latest</LangVersion>
Expand All @@ -12,6 +12,6 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions RpcSecurity/RpcSecurity.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions RpcSystemAssetTracker/RpcSystemAssetTracker.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>Neo.Plugins</RootNamespace>
<LangVersion>latest</LangVersion>
Expand All @@ -12,6 +12,6 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions RpcWallet/RpcWallet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions SimplePolicy.UnitTests/SimplePolicy.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Moq" Version="4.7.63" />
<PackageReference Include="Neo" Version="2.10.3" />
shargon marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SimplePolicy/SimplePolicy.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
<LangVersion>latest</LangVersion>
Expand All @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions StatesDumper/StatesDumper.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.10.2</Version>
<Version>2.10.3</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="2.10.3" />
</ItemGroup>

</Project>