Skip to content

Commit

Permalink
Static code analysis warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
HonzaR committed Aug 12, 2024
1 parent 8e29eb0 commit c8563fd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ interface Backend {
* @throws RuntimeException as a common indicator of the operation failure
*/
@Throws(RuntimeException::class)
suspend fun decryptAndStoreTransaction(tx: ByteArray, minedHeight: Long?)
suspend fun decryptAndStoreTransaction(
tx: ByteArray,
minedHeight: Long?
)

/**
* Sets up the internal structure of the data database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,17 @@ class RustBackend private constructor(
}
}

override suspend fun decryptAndStoreTransaction(tx: ByteArray, minedHeight: Long?) =
withContext(SdkDispatchers.DATABASE_IO) {
decryptAndStoreTransaction(
dataDbFile.absolutePath,
tx,
minedHeight = minedHeight ?: -1,
networkId = networkId
)
}
override suspend fun decryptAndStoreTransaction(
tx: ByteArray,
minedHeight: Long?
) = withContext(SdkDispatchers.DATABASE_IO) {
decryptAndStoreTransaction(
dataDbFile.absolutePath,
tx,
minedHeight = minedHeight ?: -1,
networkId = networkId
)
}

override suspend fun proposeTransfer(
account: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ internal class FakeRustBackend(
TODO("Not yet implemented")
}

override suspend fun decryptAndStoreTransaction(tx: ByteArray, minedHeight: Long?) =
error("Intentionally not implemented in mocked FakeRustBackend implementation.")
override suspend fun decryptAndStoreTransaction(
tx: ByteArray,
minedHeight: Long?
) = error("Intentionally not implemented in mocked FakeRustBackend implementation.")

override suspend fun initDataDb(seed: ByteArray?): Int =
error("Intentionally not implemented in mocked FakeRustBackend implementation.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1951,8 +1951,9 @@ class CompactBlockProcessor internal constructor(
}
when (val response = downloader.fetchTransaction(rawTransactionId)) {
is Response.Success -> {
val currentMinedHeight = runCatching { response.result.height.toBlockHeight(network) }
.getOrNull()
val currentMinedHeight =
runCatching { response.result.height.toBlockHeight(network) }
.getOrNull()
transactionDataResult = Pair(response.result.data, currentMinedHeight)
}
is Response.Failure -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ internal interface TypesafeBackend {
@Throws(RuntimeException::class)
suspend fun suggestScanRanges(): List<ScanRange>

suspend fun decryptAndStoreTransaction(tx: ByteArray, minedHeight: BlockHeight?)
suspend fun decryptAndStoreTransaction(
tx: ByteArray,
minedHeight: BlockHeight?
)

fun getSaplingReceiver(ua: String): String?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ internal class TypesafeBackendImpl(private val backend: Backend) : TypesafeBacke
)
}

override suspend fun decryptAndStoreTransaction(tx: ByteArray, minedHeight: BlockHeight?) = backend
override suspend fun decryptAndStoreTransaction(
tx: ByteArray,
minedHeight: BlockHeight?
) = backend
.decryptAndStoreTransaction(tx, minedHeight?.value)

override fun getSaplingReceiver(ua: String): String? = backend.getSaplingReceiver(ua)
Expand Down

0 comments on commit c8563fd

Please sign in to comment.