@@ -154,11 +154,6 @@ class ZcashAdapter(
154154 private val balanceCheckMutex = Mutex ()
155155 private var importUfvkError : Throwable ? = null
156156
157- init {
158- Timber .i(" ZcashAdapter type $addressSpecTyped " )
159- }
160-
161-
162157 companion object {
163158 private const val DECIMAL_COUNT = 8
164159 private val DATABASE_CORRUPTION_MESSAGES = listOf (
@@ -322,7 +317,6 @@ class ZcashAdapter(
322317 private var syncState: AdapterState = AdapterState .Connecting
323318 set(value) {
324319 if (value != field) {
325- traceSync(" state ${field.toLogString()} -> ${value.toLogString()} " )
326320 field = value
327321 adapterStateUpdatedSubject.onNext(Unit )
328322 }
@@ -831,10 +825,6 @@ class ZcashAdapter(
831825 private fun onChainError (errorHeight : BlockHeight , rewindHeight : BlockHeight ) = Unit
832826
833827 private fun onStatus (status : Synchronizer .Status ) {
834- traceSync(
835- " status=$status current=${syncState.toLogString()} " +
836- " progressDecimal=$lastDownloadProgressDecimal networkHeight=$lastNetworkHeight "
837- )
838828 syncState = when (status) {
839829 Synchronizer .Status .STOPPED -> AdapterState .NotSynced (Exception (" stopped" ))
840830 Synchronizer .Status .DISCONNECTED -> AdapterState .NotSynced (Exception (" disconnected" ))
@@ -860,18 +850,10 @@ class ZcashAdapter(
860850
861851 private fun onDownloadProgress (progress : PercentDecimal ) {
862852 lastDownloadProgressDecimal = progress.decimal
863- traceSync(" progress decimal=${progress.decimal} state=${syncState.toLogString()} " )
864853 updateSyncingState()
865854 }
866855
867856 private fun onProcessorInfo (processorInfo : CompactBlockProcessor .ProcessorInfo ) {
868- val syncRange = processorInfo.overallSyncRange
869- traceSync(
870- " processorInfo networkHeight=${processorInfo.networkBlockHeight?.value} " +
871- " range=${syncRange?.start?.value} ..${syncRange?.endInclusive?.value} " +
872- " firstUnenhanced=${processorInfo.firstUnenhancedHeight?.value} " +
873- " progressDecimal=$lastDownloadProgressDecimal state=${syncState.toLogString()} "
874- )
875857 processorInfo.networkBlockHeight?.value?.let { lastNetworkHeight = it }
876858 updateSyncingState()
877859 lastBlockUpdatedSubject.onNext(Unit )
@@ -883,12 +865,10 @@ class ZcashAdapter(
883865 // block-equivalent of the SDK's decimal so the UI reads consistently.
884866 private fun updateSyncingState () {
885867 if (syncState is AdapterState .Synced ) {
886- traceSync(" updateSyncingState skipped: already synced" )
887868 return
888869 }
889870
890871 if (lastDownloadProgressDecimal >= 1f ) {
891- traceSync(" updateSyncingState completeProgress -> processing" )
892872 syncState = AdapterState .Syncing (progress = 100.0 , blocksRemained = null )
893873 return
894874 }
@@ -900,39 +880,16 @@ class ZcashAdapter(
900880 }
901881 val rawPercent = lastDownloadProgressDecimal.toDouble() * 100.0
902882 val progressPercent = (Math .round(rawPercent * 10000.0 ) / 10000.0 ).coerceIn(0.0 , 100.0 )
903- traceSync(
904- " updateSyncingState progress=$progressPercent blocksRemained=$blocksRemained " +
905- " totalBlocks=$totalBlocks effectiveBirthday=$effectiveBirthday "
906- )
907883 syncState = AdapterState .Syncing (progress = progressPercent, blocksRemained = blocksRemained)
908884 }
909885
910886 private fun onBalance (balance : Map <AccountUuid , AccountBalance >? ) {
911- traceSync(" balance hasAccount=${zcashAccount?.accountUuid?.let { balance?.containsKey(it) }} " )
912887 balance?.get(zcashAccount?.accountUuid)?.sapling?.let {
913888 balanceUpdatedSubject.onNext(Unit )
914889 }
915890 startOneTimeAddressBalanceCheck()
916891 }
917892
918- private fun traceSync (message : String ) {
919- Timber .tag(" ZcashSync" ).d(" ${syncTraceType()} $message " )
920- }
921-
922- private fun syncTraceType (): String {
923- return addressSpecTyped?.toString() ? : " Unified"
924- }
925-
926- private fun AdapterState.toLogString (): String {
927- return when (this ) {
928- AdapterState .Synced -> " Synced"
929- AdapterState .Connecting -> " Connecting"
930- is AdapterState .Syncing -> " Syncing(progress=$progress , blocksRemained=$blocksRemained , substatus=$substatus )"
931- is AdapterState .SearchingTxs -> " SearchingTxs(count=$count )"
932- is AdapterState .NotSynced -> " NotSynced(${error.message} )"
933- }
934- }
935-
936893 private suspend fun checkTransparentAddressesBalance () = withContext(dispatcherProvider.io) {
937894 val addresses = singleUseAddressManager.getAddressesForBalanceCheck()
938895 val sdk = synchronizer as ? SdkSynchronizer ? : return @withContext
0 commit comments