fix: don't do double protobuf

This commit is contained in:
0x330a 2023-10-17 15:10:45 +11:00
parent 00ad9cf39f
commit 709f0629a0

View file

@ -115,20 +115,31 @@ data class ConfigurationSyncJob(val destination: Destination) : Job {
seqNo seqNo
) )
} }
} else { } else if (destination is Destination.Contact) {
// assume our own user as check already takes place in `execute` for our own key // assume our own user as check already takes place in `execute` for our own key
// if contact // if contact
val sentTimestamp = SnodeAPI.nowWithOffset
configFactoryProtocol.getUserConfigs().filter { it.needsPush() }.map { config -> configFactoryProtocol.getUserConfigs().filter { it.needsPush() }.map { config ->
val (bytes, seqNo, obsoleteHashes) = config.push() val (push, seqNo, obsoleteHashes) = config.push()
toDelete += obsoleteHashes toDelete += obsoleteHashes
val message = val message =
messageForConfig(config, bytes, seqNo) SnodeMessage(
?: throw NullPointerException( destination.publicKey,
"SnodeBatchRequest message was null, check group keys exists" Base64.encodeBytes(push),
SnodeMessage.CONFIG_TTL,
sentTimestamp
)
ConfigMessageInformation(
SnodeAPI.buildAuthenticatedStoreBatchInfo(
config.namespace(),
message
)!!,
config,
seqNo
) )
ConfigMessageInformation(message, config, seqNo)
}
} }
} else throw InvalidDestination()
return SyncInformation(configsRequiringPush, toDelete) return SyncInformation(configsRequiringPush, toDelete)
} }