@@ -80,11 +80,6 @@ class MTProtoOutgoingMessage extends MTProtoMessage
8080 */
8181 private ?string $ serializedBody = null ;
8282
83- /**
84- * Whether we should refresh references upon serialization of this message.
85- */
86- private bool $ refreshReferences = false ;
87-
8883 /**
8984 * When was this message sent.
9085 */
@@ -114,7 +109,7 @@ public function __construct(
114109 public readonly string $ type ,
115110 public readonly bool $ isMethod ,
116111 public readonly bool $ unencrypted ,
117- public readonly ?SpecialMethodType $ specialMethodType ,
112+ public ?SpecialMethodType $ specialMethodType ,
118113 public readonly ?Cancellation $ cancellation ,
119114 public readonly ?string $ subtype = null ,
120115 /**
@@ -400,6 +395,8 @@ public function setSerializedBody(string $serializedBody): self
400395 public function refreshReferences (): Future
401396 {
402397 $ this ->serializedBody = null ;
398+ // To avoid endless loops
399+ $ this ->specialMethodType = SpecialMethodType::FILEREF_RELATED ;
403400
404401 return async (function (): ?Closure {
405402 $ this ->connection ->API ->referenceDatabase ->refreshNextEnable ();
0 commit comments