Skip to content

Commit

Permalink
Fix RelayResult issue (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
bettybao1209 authored Apr 13, 2020
1 parent d53fc24 commit 01948ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
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>

0 comments on commit 01948ba

Please sign in to comment.