Serialize Option[T] in DataSerializer #659
Labels
A-consensus
Area: Code used in consensus (i.e. transaction validation)
C-enhancement
Category: A PR with an enhancement or a proposed one in an issue.
P2-medium
Priority: Medium
soft-fork
Implementation requires soft-fork
Milestone
Problem
DataSerializer is used to serialize data values for any supported ErgoTree type. It is in particular used to serialize Constant values, where type is first serialized (see TypeSerializer) and then the constant value is serialized using DataSerializer).
Option[T] is supported type of constant values, i.e. it is possible to create tree node like
Constant(SOption(SInt), Some(10))
, however DataSerializer don't support serialization of Option[T] values and hence such constants are not supported.Solution
Add Option[T] case in DataSerializer using Writer.putOption method.
The text was updated successfully, but these errors were encountered: