Fix bugs
This commit is contained in:
parent
1b37784e44
commit
2132bc14fd
|
@ -68,3 +68,6 @@ fastlane/Preview.html
|
|||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
||||
|
||||
# other
|
||||
DecompileChecker.kt
|
||||
|
|
|
@ -74,10 +74,7 @@ android {
|
|||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
// Allow the use of Result objects understanding that if the API changes, we'll have to fix it before upgrading our kotlin version
|
||||
freeCompilerArgs = ["-Xallow-result-return-type"]
|
||||
|
|
|
@ -169,7 +169,7 @@ class ActiveTransactionManager(
|
|||
twig("transaction $transactionId HAS BEEN MINED!!! updating the corresponding active transaction.")
|
||||
tx.height.set(matchingDbTransaction.height)
|
||||
twig("active transaction height updated to ${matchingDbTransaction.height} and state updated to AwaitingConfirmations(0)")
|
||||
setState(transaction, AwaitingConfirmations(0))
|
||||
setState(transaction, AwaitingConfirmations(1))
|
||||
} else {
|
||||
twig("transaction $transactionId has still not been mined.")
|
||||
}
|
||||
|
@ -217,6 +217,7 @@ class ActiveTransactionManager(
|
|||
created(activeSendTransaction, transactionId)
|
||||
|
||||
uploadRawTransaction(transactionId, activeSendTransaction, transactionRaw)
|
||||
//TODO: synchronously await confirmations by checking periodically inside a while loop until confirmations = 10
|
||||
}
|
||||
|
||||
private suspend fun uploadRawTransaction(
|
||||
|
|
|
@ -24,7 +24,9 @@ import kotlin.random.nextLong
|
|||
*/
|
||||
open class MockSynchronizer(
|
||||
private val transactionInterval: Long = 30_000L,
|
||||
private val activeTransactionUpdateFrequency: Long = 3_000L
|
||||
private val activeTransactionUpdateFrequency: Long = 3_000L,
|
||||
private val isFirstRun: Boolean = Random.nextBoolean(),
|
||||
private val isOutOfSync: Boolean = Random.nextBoolean()
|
||||
) : Synchronizer, CoroutineScope {
|
||||
|
||||
private val mockAddress = "ztestsaplingmock0000this0is0a0mock0address0do0not0send0funds0to0this0address0ok0thanks00"
|
||||
|
@ -67,7 +69,7 @@ open class MockSynchronizer(
|
|||
}
|
||||
|
||||
override suspend fun isFirstRun(): Boolean {
|
||||
return Random.nextBoolean()
|
||||
return isFirstRun
|
||||
}
|
||||
|
||||
override fun getAddress() = mockAddress
|
||||
|
|
|
@ -79,9 +79,10 @@ open class PollingTransactionRepository(
|
|||
twig("stopping")
|
||||
// when polling ends, we call stop which can result in a duplicate call to stop
|
||||
// So keep stop idempotent, rather than crashing with "Channel was closed" errors
|
||||
if (!balanceChannel.isClosedForSend) balanceChannel.cancel()
|
||||
if (!allTransactionsChannel.isClosedForSend) allTransactionsChannel.cancel()
|
||||
if (!pollingJob.isCancelled) pollingJob.cancel()
|
||||
// probably should make a safeCancel extension function for this and use it everywhere that we cancel a channel
|
||||
try{ if (!balanceChannel.isClosedForSend) balanceChannel.cancel() }catch (t:Throwable){}
|
||||
try{ if (!allTransactionsChannel.isClosedForSend) allTransactionsChannel.cancel() }catch (t:Throwable){}
|
||||
try{ if (!pollingJob.isCancelled) pollingJob.cancel() }catch (t:Throwable){}
|
||||
}
|
||||
|
||||
override fun balance(): ReceiveChannel<Long> {
|
||||
|
|
|
@ -20,7 +20,7 @@ sealed class RepositoryException(message: String, cause: Throwable? = null) : Ru
|
|||
}
|
||||
|
||||
sealed class SynchronizerException(message: String, cause: Throwable? = null) : RuntimeException(message, cause) {
|
||||
object FalseStart: SynchronizerException("Once a synchronizer has stopped it cannotbe restarted. Instead, a new " +
|
||||
object FalseStart: SynchronizerException("Once a synchronizer has stopped it cannot be restarted. Instead, a new " +
|
||||
"instance should be created.")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue