Skip to content

Commit

Permalink
Fix #1128 (#1129)
Browse files Browse the repository at this point in the history
* Fix #1128

* Update BlockBase.cs
  • Loading branch information
igormcoelho authored and vncoelho committed Oct 30, 2019
1 parent 0aed29f commit 1b7d1ec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions neo/Network/P2P/Payloads/BlockBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public UInt256 Hash
sizeof(ulong) + //Timestamp
sizeof(uint) + //Index
UInt160.Length + //NextConsensus
1 + //
1 + //Witness array count
Witness.Size; //Witness

Witness[] IVerifiable.Witnesses
Expand All @@ -59,8 +59,9 @@ Witness[] IVerifiable.Witnesses
public virtual void Deserialize(BinaryReader reader)
{
((IVerifiable)this).DeserializeUnsigned(reader);
if (reader.ReadByte() != 1) throw new FormatException();
Witness = reader.ReadSerializable<Witness>();
Witness[] witnesses = reader.ReadSerializableArray<Witness>(1);
if (witnesses.Length != 1) throw new FormatException();
Witness = witnesses[0];
}

void IVerifiable.DeserializeUnsigned(BinaryReader reader)
Expand All @@ -84,7 +85,7 @@ UInt160[] IVerifiable.GetScriptHashesForVerifying(Snapshot snapshot)
public virtual void Serialize(BinaryWriter writer)
{
((IVerifiable)this).SerializeUnsigned(writer);
writer.Write((byte)1); writer.Write(Witness);
writer.Write(new Witness[] { Witness });
}

void IVerifiable.SerializeUnsigned(BinaryWriter writer)
Expand Down

0 comments on commit 1b7d1ec

Please sign in to comment.