Skip to content

Commit

Permalink
P2P: allow to serialize UnknownCapability
Browse files Browse the repository at this point in the history
Otherwise it can't be properly passed through the P2P network which makes
it impossible to use UnknownCapabilities as an extensions in the existing
networks.

Follow nspcc-dev/neo-go#3778.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Dec 28, 2024
1 parent f65c193 commit d2c34e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Neo/Network/P2P/Capabilities/UnknownCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override void DeserializeWithoutType(ref MemoryReader reader)

protected override void SerializeWithoutType(BinaryWriter writer)
{
throw new InvalidOperationException("Unknown capability can't be serialized");
writer.WriteVarBytes(Data.Span);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void DeserializeUnknown()
var capab = (NodeCapability)NodeCapability.DeserializeFrom(ref br);

Assert.IsTrue(capab is UnknownCapability);
Assert.ThrowsException<InvalidOperationException>(() => capab.ToArray());
CollectionAssert.AreEqual(buffer, capab.ToArray());
}
}
}

0 comments on commit d2c34e4

Please sign in to comment.