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 RelayResult issue #220

Merged
merged 3 commits into from
Apr 13, 2020
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
13 changes: 7 additions & 6 deletions src/RpcServer/RpcServer.Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Neo.Network.P2P;
using Neo.Network.P2P.Payloads;
using System.Linq;
using static Neo.Ledger.Blockchain;

namespace Neo.Plugins
{
Expand Down Expand Up @@ -41,9 +42,9 @@ private JObject GetPeers(JArray _params)
return json;
}

private static JObject GetRelayResult(RelayResultReason reason, UInt256 hash)
private static JObject GetRelayResult(VerifyResult reason, UInt256 hash)
{
if (reason == RelayResultReason.Succeed)
if (reason == VerifyResult.Succeed)
{
var ret = new JObject();
ret["hash"] = hash.ToString();
Expand All @@ -70,16 +71,16 @@ private JObject GetVersion(JArray _params)
private JObject SendRawTransaction(JArray _params)
{
Transaction tx = _params[0].AsString().HexToBytes().AsSerializable<Transaction>();
RelayResultReason reason = System.Blockchain.Ask<RelayResultReason>(tx).Result;
return GetRelayResult(reason, tx.Hash);
RelayResult reason = System.Blockchain.Ask<RelayResult>(tx).Result;
return GetRelayResult(reason.Result, tx.Hash);
}

[RpcMethod]
private JObject SubmitBlock(JArray _params)
{
Block block = _params[0].AsString().HexToBytes().AsSerializable<Block>();
RelayResultReason reason = System.Blockchain.Ask<RelayResultReason>(block).Result;
return GetRelayResult(reason, block.Hash);
RelayResult reason = System.Blockchain.Ask<RelayResult>(block).Result;
return GetRelayResult(reason.Result, block.Hash);
}
}
}
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
<PackageReference Include="Neo" Version="3.0.0-CI00863" />
<PackageReference Include="Neo" Version="3.0.0-CI00883" />
</ItemGroup>

</Project>