/// <exception cref="IOException"/>
public override void BitcoinSerializeToStream(Stream stream)
{
Debug.Assert(_scriptBytes != null);
Utils.Uint64ToByteStreamLe(Value, stream);
// TODO: Move script serialization into the Script class, where it belongs.
stream.Write(new VarInt((ulong)_scriptBytes.Length).Encode());
stream.Write(_scriptBytes);
}