diff --git a/RpcNep5Tracker/Nep5Balance.cs b/RpcNep5Tracker/Nep5Balance.cs index efdfa04df..304028d08 100644 --- a/RpcNep5Tracker/Nep5Balance.cs +++ b/RpcNep5Tracker/Nep5Balance.cs @@ -10,18 +10,20 @@ public class Nep5Balance : StateBase, ICloneable public BigInteger Balance; public uint LastUpdatedBlock; - public override int Size => base.Size + Balance.ToByteArray().GetVarSize(); + public override int Size => base.Size + Balance.ToByteArray().GetVarSize() + sizeof(uint); public override void Serialize(BinaryWriter writer) { base.Serialize(writer); writer.WriteVarBytes(Balance.ToByteArray()); + writer.Write(LastUpdatedBlock); } public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); Balance = new BigInteger(reader.ReadVarBytes(512)); + LastUpdatedBlock = reader.ReadUInt32(); } public Nep5Balance Clone() diff --git a/RpcNep5Tracker/Nep5BalanceKey.cs b/RpcNep5Tracker/Nep5BalanceKey.cs index 0af045c97..b4a1710cf 100644 --- a/RpcNep5Tracker/Nep5BalanceKey.cs +++ b/RpcNep5Tracker/Nep5BalanceKey.cs @@ -9,6 +9,8 @@ public class Nep5BalanceKey : IComparable, IEquatable 20 + 20; + public Nep5BalanceKey() : this(new UInt160(), new UInt160()) { } @@ -63,7 +65,5 @@ public void Deserialize(BinaryReader reader) ((ISerializable) UserScriptHash).Deserialize(reader); ((ISerializable) AssetScriptHash).Deserialize(reader); } - - public int Size { get; } = 20 + 20; } } \ No newline at end of file diff --git a/RpcNep5Tracker/Nep5Transfer.cs b/RpcNep5Tracker/Nep5Transfer.cs index df012634e..7ddf8c54a 100644 --- a/RpcNep5Tracker/Nep5Transfer.cs +++ b/RpcNep5Tracker/Nep5Transfer.cs @@ -2,7 +2,6 @@ using System.Numerics; using Neo.IO; using Neo.Ledger; -using Neo.Network.P2P.Payloads; namespace Neo.Plugins { @@ -13,7 +12,7 @@ public class Nep5Transfer : StateBase, ICloneable public UInt256 TxHash; public BigInteger Amount; - public override int Size => base.Size + 20 + Amount.ToByteArray().GetVarSize(); + public override int Size => base.Size + 20 + sizeof(uint) + 32 + Amount.ToByteArray().GetVarSize(); public override void Serialize(BinaryWriter writer) { diff --git a/RpcNep5Tracker/Nep5TransferKey.cs b/RpcNep5Tracker/Nep5TransferKey.cs index 3df0af23e..a1892d54a 100644 --- a/RpcNep5Tracker/Nep5TransferKey.cs +++ b/RpcNep5Tracker/Nep5TransferKey.cs @@ -11,6 +11,8 @@ public class Nep5TransferKey : IComparable, IEquatable 20 + sizeof(uint) + 20 + sizeof(ushort); + public Nep5TransferKey() : this(new UInt160(), 0, new UInt160(), 0) { } @@ -76,15 +78,13 @@ public void Serialize(BinaryWriter writer) public void Deserialize(BinaryReader reader) { - ((ISerializable) UserScriptHash).Deserialize(reader); + ((ISerializable)UserScriptHash).Deserialize(reader); byte[] timestampBytes = new byte[sizeof(uint)]; reader.Read(timestampBytes, 0, sizeof(uint)); if (BitConverter.IsLittleEndian) Array.Reverse(timestampBytes); Timestamp = BitConverter.ToUInt32(timestampBytes, 0); - ((ISerializable) AssetScriptHash).Deserialize(reader); + ((ISerializable)AssetScriptHash).Deserialize(reader); BlockXferNotificationIndex = reader.ReadUInt16(); } - - public int Size { get; } = 20 + sizeof(byte) + sizeof(uint) + 20 + sizeof(ushort); } } \ No newline at end of file