Skip to content

Commit 394d9e3

Browse files
authored
Merge branch 'dev' into feature/improve-stringextensions-exception-messages
2 parents ad879f2 + a29922e commit 394d9e3

File tree

4 files changed

+9
-40
lines changed

4 files changed

+9
-40
lines changed

src/Plugins/RpcServer/RpcServer.Blockchain.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected internal virtual JToken GetBlock(BlockHashOrIndex blockHashOrIndex, bo
100100
block.NotNull_Or(RpcError.UnknownBlock);
101101
if (verbose)
102102
{
103-
JObject json = Utility.BlockToJson(block, system.Settings);
103+
JObject json = block.ToJson(system.Settings);
104104
json["confirmations"] = NativeContract.Ledger.CurrentIndex(snapshot) - block.Index + 1;
105105
UInt256 hash = NativeContract.Ledger.GetBlockHash(snapshot, block.Index + 1);
106106
if (hash != null)
@@ -369,7 +369,8 @@ protected internal virtual JToken GetRawTransaction(UInt256 hash, bool verbose =
369369
tx.NotNull_Or(RpcError.UnknownTransaction);
370370

371371
if (!verbose) return Convert.ToBase64String(tx.ToArray());
372-
var json = Utility.TransactionToJson(tx!, system.Settings);
372+
373+
var json = tx!.ToJson(system.Settings);
373374
if (state is not null)
374375
{
375376
var block = NativeContract.Ledger.GetTrimmedBlock(snapshot, NativeContract.Ledger.GetBlockHash(snapshot, state.BlockIndex));

src/Plugins/RpcServer/RpcServer.Wallet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ private JObject SignAndRelay(DataCache snapshot, Transaction tx)
774774
{
775775
tx.Witnesses = context.GetWitnesses();
776776
system.Blockchain.Tell(tx);
777-
return Utility.TransactionToJson(tx, system.Settings);
777+
return tx.ToJson(system.Settings);
778778
}
779779
else
780780
{

src/Plugins/RpcServer/Utility.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.Blockchain.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,10 @@ public void TestGetRawTransaction()
345345
snapshot.Commit();
346346

347347
var result = _rpcServer.GetRawTransaction(tx.Hash, true);
348-
var json = Utility.TransactionToJson(tx, _neoSystem.Settings);
348+
var json = tx.ToJson(_neoSystem.Settings);
349349
Assert.AreEqual(json.ToString(), result.ToString());
350+
Assert.IsTrue(json.ContainsProperty("sysfee"));
351+
Assert.IsTrue(json.ContainsProperty("netfee"));
350352

351353
result = _rpcServer.GetRawTransaction(tx.Hash, false);
352354
var tx2 = Convert.FromBase64String(result.AsString()).AsSerializable<Transaction>();
@@ -373,7 +375,8 @@ public void TestGetRawTransaction_Confirmed()
373375

374376
// Test verbose
375377
var resultVerbose = _rpcServer.GetRawTransaction(tx.Hash, true);
376-
var expectedJson = Utility.TransactionToJson(tx, _neoSystem.Settings);
378+
var expectedJson = tx.ToJson(_neoSystem.Settings);
379+
377380
// Add expected block-related fields
378381
expectedJson["blockhash"] = block.Hash.ToString();
379382
expectedJson["confirmations"] = NativeContract.Ledger.CurrentIndex(_neoSystem.StoreView) - block.Index + 1;

0 commit comments

Comments
 (0)