2019-10-23 22:21:52 -07:00
|
|
|
package cash.z.wallet.sdk
|
2019-01-02 21:31:12 -08:00
|
|
|
|
2019-11-01 13:25:28 -07:00
|
|
|
import androidx.paging.PagedList
|
2020-01-14 09:52:41 -08:00
|
|
|
import cash.z.wallet.sdk.block.CompactBlockProcessor
|
2019-11-01 13:25:28 -07:00
|
|
|
import cash.z.wallet.sdk.block.CompactBlockProcessor.WalletBalance
|
2020-06-09 19:05:30 -07:00
|
|
|
import cash.z.wallet.sdk.entity.ConfirmedTransaction
|
|
|
|
import cash.z.wallet.sdk.entity.PendingTransaction
|
|
|
|
import cash.z.wallet.sdk.ext.ConsensusBranchId
|
2020-03-25 14:58:08 -07:00
|
|
|
import cash.z.wallet.sdk.rpc.Service
|
2019-02-14 13:43:06 -08:00
|
|
|
import kotlinx.coroutines.CoroutineScope
|
2019-10-21 03:26:02 -07:00
|
|
|
import kotlinx.coroutines.flow.Flow
|
2019-01-02 21:31:12 -08:00
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* Primary interface for interacting with the SDK. Defines the contract that specific
|
|
|
|
* implementations like [MockSynchronizer] and [SdkSynchronizer] fulfill. Given the language-level
|
|
|
|
* support for coroutines, we favor their use in the SDK and incorporate that choice into this
|
|
|
|
* contract.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-02-14 13:43:06 -08:00
|
|
|
interface Synchronizer {
|
2019-01-02 21:31:12 -08:00
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
//
|
|
|
|
// Lifecycle
|
|
|
|
//
|
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
|
|
|
* Starts this synchronizer within the given scope.
|
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @param parentScope the scope to use for this synchronizer, typically something with a
|
|
|
|
* lifecycle such as an Activity. Implementations should leverage structured concurrency and
|
|
|
|
* cancel all jobs when this scope completes.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return an instance of the class so that this function can be used fluidly.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-26 12:46:31 -08:00
|
|
|
fun start(parentScope: CoroutineScope? = null): Synchronizer
|
2019-03-28 23:04:25 -07:00
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* Stop this synchronizer. Implementations should ensure that calling this method cancels all
|
|
|
|
* jobs that were created by this instance.
|
2020-06-09 19:05:30 -07:00
|
|
|
*
|
|
|
|
* Note that in most cases, there is no need to call [stop] because the Synchronizer will
|
|
|
|
* automatically stop whenever the parentScope is cancelled. For instance, if that scope is
|
|
|
|
* bound to the lifecycle of the activity, the Synchronizer will stop when the activity stops.
|
|
|
|
* However, if no scope is provided to the start method, then the Synchronizer must be stopped
|
|
|
|
* with this function.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-02-14 13:43:06 -08:00
|
|
|
fun stop()
|
2019-01-23 02:45:26 -08:00
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
//
|
2019-11-01 13:25:28 -07:00
|
|
|
// Flows
|
2019-07-14 15:13:12 -07:00
|
|
|
//
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-11-01 13:25:28 -07:00
|
|
|
/* Status */
|
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of values representing the [Status] of this Synchronizer. As the status changes, a new
|
|
|
|
* value will be emitted by this flow.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val status: Flow<Status>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of progress values, typically corresponding to this Synchronizer downloading blocks.
|
|
|
|
* Typically, any non- zero value below 100 indicates that progress indicators can be shown and
|
|
|
|
* a value of 100 signals that progress is complete and any progress indicators can be hidden.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val progress: Flow<Int>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2020-01-14 09:52:41 -08:00
|
|
|
/**
|
|
|
|
* A flow of processor details, updated every time blocks are processed to include the latest
|
|
|
|
* block height, blocks downloaded and blocks scanned. Similar to the [progress] flow but with a
|
|
|
|
* lot more detail.
|
|
|
|
*/
|
|
|
|
val processorInfo: Flow<CompactBlockProcessor.ProcessorInfo>
|
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A stream of balance values, separately reflecting both the available and total balance.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val balances: Flow<WalletBalance>
|
|
|
|
|
|
|
|
/* Transactions */
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of all the outbound pending transaction that have been sent but are awaiting
|
|
|
|
* confirmations.
|
2019-07-14 15:13:12 -07:00
|
|
|
*/
|
2019-11-22 23:18:20 -08:00
|
|
|
val pendingTransactions: Flow<List<PendingTransaction>>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of all the transactions that are on the blockchain.
|
2019-07-14 15:13:12 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val clearedTransactions: Flow<PagedList<ConfirmedTransaction>>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of all transactions related to sending funds.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val sentTransactions: Flow<PagedList<ConfirmedTransaction>>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-02-24 15:59:07 -08:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* A flow of all transactions related to receiving funds.
|
2019-02-24 15:59:07 -08:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
val receivedTransactions: Flow<PagedList<ConfirmedTransaction>>
|
2019-07-14 15:13:12 -07:00
|
|
|
|
|
|
|
|
2020-06-09 19:05:30 -07:00
|
|
|
//
|
|
|
|
// Latest Properties
|
|
|
|
//
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An in-memory reference to the latest height seen on the network.
|
|
|
|
*/
|
|
|
|
val latestHeight: Int
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An in-memory reference to the most recently calculated balance.
|
|
|
|
*/
|
|
|
|
val latestBalance: WalletBalance
|
|
|
|
|
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
//
|
|
|
|
// Operations
|
|
|
|
//
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2019-04-23 23:44:51 -07:00
|
|
|
/**
|
2019-07-14 15:13:12 -07:00
|
|
|
* Gets the address for the given account.
|
2019-04-23 23:44:51 -07:00
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @param accountId the optional accountId whose address is of interest. By default, the first
|
|
|
|
* account is used.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return the address for the given account.
|
2019-04-23 23:44:51 -07:00
|
|
|
*/
|
2019-07-14 15:13:12 -07:00
|
|
|
suspend fun getAddress(accountId: Int = 0): String
|
2019-04-23 23:44:51 -07:00
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
|
|
|
* Sends zatoshi.
|
|
|
|
*
|
2020-02-27 09:28:10 -08:00
|
|
|
* @param spendingKey the key associated with the notes that will be spent.
|
2019-03-28 23:04:25 -07:00
|
|
|
* @param zatoshi the amount of zatoshi to send.
|
|
|
|
* @param toAddress the recipient's address.
|
|
|
|
* @param memo the optional memo to include as part of the transaction.
|
2020-02-27 09:28:10 -08:00
|
|
|
* @param fromAccountIndex the optional account id to use. By default, the first account is used.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return a flow of PendingTransaction objects representing changes to the state of the
|
|
|
|
* transaction. Any time the state changes a new instance will be emitted by this flow. This is
|
|
|
|
* useful for updating the UI without needing to poll. Of course, polling is always an option
|
|
|
|
* for any wallet that wants to ignore this return value.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
fun sendToAddress(
|
|
|
|
spendingKey: String,
|
2019-07-14 15:13:12 -07:00
|
|
|
zatoshi: Long,
|
|
|
|
toAddress: String,
|
|
|
|
memo: String = "",
|
2019-11-01 13:25:28 -07:00
|
|
|
fromAccountIndex: Int = 0
|
2020-01-06 22:26:10 -08:00
|
|
|
): Flow<PendingTransaction>
|
2019-03-28 23:04:25 -07:00
|
|
|
|
2020-01-08 00:57:42 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true when the given address is a valid z-addr. Invalid addresses will throw an
|
2020-02-27 00:25:07 -08:00
|
|
|
* exception. Valid z-addresses have these characteristics: //TODO copy info from related ZIP
|
2020-01-08 00:57:42 -08:00
|
|
|
*
|
|
|
|
* @param address the address to validate.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return true when the given address is a valid z-addr.
|
|
|
|
*
|
2020-01-08 00:57:42 -08:00
|
|
|
* @throws RuntimeException when the address is invalid.
|
|
|
|
*/
|
|
|
|
suspend fun isValidShieldedAddr(address: String): Boolean
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true when the given address is a valid t-addr. Invalid addresses will throw an
|
2020-02-27 00:25:07 -08:00
|
|
|
* exception. Valid t-addresses have these characteristics: //TODO copy info from related ZIP
|
2020-01-08 00:57:42 -08:00
|
|
|
*
|
|
|
|
* @param address the address to validate.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return true when the given address is a valid t-addr.
|
|
|
|
*
|
2020-01-08 00:57:42 -08:00
|
|
|
* @throws RuntimeException when the address is invalid.
|
|
|
|
*/
|
|
|
|
suspend fun isValidTransparentAddr(address: String): Boolean
|
|
|
|
|
2020-06-09 19:05:30 -07:00
|
|
|
/**
|
|
|
|
* Validate whether the server and this SDK share the same consensus branch. This is
|
|
|
|
* particularly important to check around network updates so that any wallet that's connected to
|
|
|
|
* an incompatible server can surface that information effectively. For the SDK, the consensus
|
|
|
|
* branch is used when creating transactions as each one needs to target a specific branch. This
|
|
|
|
* function compares the server's branch id to this SDK's and returns information that helps
|
|
|
|
* determine whether they match.
|
|
|
|
*
|
|
|
|
* @return an instance of [ConsensusMatchType] that is essentially a wrapper for both branch ids
|
|
|
|
* and provides helper functions for communicating detailed errors to the user.
|
|
|
|
*/
|
|
|
|
suspend fun validateConsensusBranch(): ConsensusMatchType
|
|
|
|
|
2020-01-08 00:57:42 -08:00
|
|
|
/**
|
2020-02-27 00:25:07 -08:00
|
|
|
* Validates the given address, returning information about why it is invalid. This is a
|
|
|
|
* convenience method that combines the behavior of [isValidShieldedAddr] and
|
|
|
|
* [isValidTransparentAddr] into one call so that the developer doesn't have to worry about
|
|
|
|
* handling the exceptions that they throw. Rather, exceptions are converted to
|
|
|
|
* [AddressType.Invalid] which has a `reason` property describing why it is invalid.
|
2020-01-08 00:57:42 -08:00
|
|
|
*
|
|
|
|
* @param address the address to validate.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
|
|
|
* @return an instance of [AddressType] providing validation info regarding the given address.
|
2020-01-08 00:57:42 -08:00
|
|
|
*/
|
|
|
|
suspend fun validateAddress(address: String): AddressType
|
|
|
|
|
2019-03-28 23:04:25 -07:00
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only
|
|
|
|
* an option if the transaction has not yet been submitted to the server.
|
2019-03-28 23:04:25 -07:00
|
|
|
*
|
|
|
|
* @param transaction the transaction to cancel.
|
2020-02-27 00:25:07 -08:00
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @return true when the cancellation request was successful. False when it is too late.
|
2019-03-28 23:04:25 -07:00
|
|
|
*/
|
2019-11-01 13:25:28 -07:00
|
|
|
suspend fun cancelSpend(transaction: PendingTransaction): Boolean
|
2019-07-14 15:13:12 -07:00
|
|
|
|
2020-06-09 19:05:30 -07:00
|
|
|
/**
|
|
|
|
* Convenience function that exposes the underlying server information, like its name and
|
|
|
|
* consensus branch id. Most wallets should already have a different source of truth for the
|
|
|
|
* server(s) with which they operate and thereby not need this function.
|
|
|
|
*/
|
|
|
|
suspend fun getServerInfo(): Service.LightdInfo
|
|
|
|
|
2019-07-14 15:13:12 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Error Handling
|
|
|
|
//
|
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* Gets or sets a global error handler. This is a useful hook for handling unexpected critical
|
|
|
|
* errors.
|
2019-07-14 15:13:12 -07:00
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @return true when the error has been handled and the Synchronizer should attempt to continue.
|
|
|
|
* False when the error is unrecoverable and the Synchronizer should [stop].
|
2019-07-14 15:13:12 -07:00
|
|
|
*/
|
|
|
|
var onCriticalErrorHandler: ((Throwable?) -> Boolean)?
|
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* An error handler for exceptions during processing. For instance, a block might be missing or
|
|
|
|
* a reorg may get mishandled or the database may get corrupted.
|
2019-07-14 15:13:12 -07:00
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @return true when the error has been handled and the processor should attempt to continue.
|
|
|
|
* False when the error is unrecoverable and the processor should [stop].
|
2019-07-14 15:13:12 -07:00
|
|
|
*/
|
|
|
|
var onProcessorErrorHandler: ((Throwable?) -> Boolean)?
|
|
|
|
|
|
|
|
/**
|
2019-11-01 13:25:28 -07:00
|
|
|
* An error handler for exceptions while submitting transactions to lightwalletd. For instance,
|
|
|
|
* a transaction may get rejected because it would be a double-spend or the user might lose
|
|
|
|
* their cellphone signal.
|
2019-07-14 15:13:12 -07:00
|
|
|
*
|
2019-11-01 13:25:28 -07:00
|
|
|
* @return true when the error has been handled and the sender should attempt to resend. False
|
|
|
|
* when the error is unrecoverable and the sender should [stop].
|
2019-07-14 15:13:12 -07:00
|
|
|
*/
|
|
|
|
var onSubmissionErrorHandler: ((Throwable?) -> Boolean)?
|
2019-10-21 03:26:02 -07:00
|
|
|
|
2020-02-21 15:14:34 -08:00
|
|
|
/**
|
|
|
|
* A callback to invoke whenever a chain error is encountered. These occur whenever the
|
|
|
|
* processor detects a missing or non-chain-sequential block (i.e. a reorg).
|
|
|
|
*/
|
|
|
|
var onChainErrorHandler: ((Int, Int) -> Any)?
|
|
|
|
|
2020-02-27 00:25:07 -08:00
|
|
|
/**
|
|
|
|
* Represents the status of this Synchronizer, which is useful for communicating to the user.
|
|
|
|
*/
|
2019-10-21 03:26:02 -07:00
|
|
|
enum class Status {
|
|
|
|
/**
|
|
|
|
* Indicates that [stop] has been called on this Synchronizer and it will no longer be used.
|
|
|
|
*/
|
|
|
|
STOPPED,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that this Synchronizer is disconnected from its lightwalletd server.
|
|
|
|
* When set, a UI element may want to turn red.
|
|
|
|
*/
|
|
|
|
DISCONNECTED,
|
|
|
|
|
|
|
|
/**
|
2020-01-15 04:10:22 -08:00
|
|
|
* Indicates that this Synchronizer is actively downloading new blocks from the server.
|
2019-10-21 03:26:02 -07:00
|
|
|
*/
|
2020-01-15 04:10:22 -08:00
|
|
|
DOWNLOADING,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that this Synchronizer is actively validating new blocks that were downloaded
|
|
|
|
* from the server. Blocks need to be verified before they are scanned. This confirms that
|
|
|
|
* each block is chain-sequential, thereby detecting missing blocks and reorgs.
|
|
|
|
*/
|
|
|
|
VALIDATING,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that this Synchronizer is actively decrypting new blocks that were downloaded
|
|
|
|
* from the server.
|
|
|
|
*/
|
|
|
|
SCANNING,
|
2019-10-21 03:26:02 -07:00
|
|
|
|
2020-03-25 14:58:08 -07:00
|
|
|
/**
|
|
|
|
* Indicates that this Synchronizer is actively enhancing newly scanned blocks with
|
|
|
|
* additional transaction details, fetched from the server.
|
|
|
|
*/
|
|
|
|
ENHANCING,
|
|
|
|
|
2019-10-21 03:26:02 -07:00
|
|
|
/**
|
|
|
|
* Indicates that this Synchronizer is fully up to date and ready for all wallet functions.
|
2020-01-15 04:10:22 -08:00
|
|
|
* When set, a UI element may want to turn green. In this state, the balance can be trusted.
|
2019-10-21 03:26:02 -07:00
|
|
|
*/
|
|
|
|
SYNCED
|
|
|
|
}
|
2020-01-08 00:57:42 -08:00
|
|
|
|
2020-02-27 00:25:07 -08:00
|
|
|
/**
|
|
|
|
* Represents the types of addresses, either Shielded, Transparent or Invalid.
|
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
sealed class AddressType {
|
2020-02-27 00:25:07 -08:00
|
|
|
/**
|
|
|
|
* Marker interface for valid [AddressType] instances.
|
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
interface Valid
|
2020-02-27 00:25:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An instance of [AddressType] corresponding to a valid z-addr.
|
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
object Shielded : Valid, AddressType()
|
2020-02-27 00:25:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An instance of [AddressType] corresponding to a valid t-addr.
|
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
object Transparent : Valid, AddressType()
|
2020-02-27 00:25:07 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An instance of [AddressType] corresponding to an invalid address.
|
|
|
|
*
|
2020-03-26 04:00:04 -07:00
|
|
|
* @param reason a description of why the address was invalid.
|
2020-02-27 00:25:07 -08:00
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
class Invalid(val reason: String = "Invalid") : AddressType()
|
|
|
|
|
2020-02-27 00:25:07 -08:00
|
|
|
/**
|
|
|
|
* A convenience method that returns true when an instance of this class is invalid.
|
|
|
|
*/
|
2020-01-08 00:57:42 -08:00
|
|
|
val isNotValid get() = this !is Valid
|
|
|
|
}
|
2020-02-21 15:14:34 -08:00
|
|
|
|
2020-06-09 19:05:30 -07:00
|
|
|
/**
|
|
|
|
* Helper class that provides consensus branch information for this SDK and the server to which
|
|
|
|
* it is connected and whether they are aligned. Essentially a wrapper for both branch ids with
|
|
|
|
* helper functions for communicating detailed error information to the end-user.
|
|
|
|
*/
|
|
|
|
class ConsensusMatchType(val sdkBranch: ConsensusBranchId?, val serverBranch: ConsensusBranchId?) {
|
|
|
|
val hasServerBranch = serverBranch != null
|
|
|
|
val hasSdkBranch = sdkBranch != null
|
|
|
|
val isValid = hasServerBranch && sdkBranch == serverBranch
|
|
|
|
val hasBoth = hasServerBranch && hasSdkBranch
|
|
|
|
val hasNeither = !hasServerBranch && !hasSdkBranch
|
|
|
|
val isServerNewer = hasBoth && serverBranch!!.ordinal > sdkBranch!!.ordinal
|
|
|
|
val isSdkNewer = hasBoth && sdkBranch!!.ordinal > serverBranch!!.ordinal
|
|
|
|
|
|
|
|
val errorMessage
|
|
|
|
get() = when {
|
|
|
|
isValid -> null
|
|
|
|
hasNeither -> "Our branch is unknown and the server branch is unknown. Verify" +
|
|
|
|
" that they are both using the latest consensus branch ID."
|
|
|
|
hasServerBranch -> "The server is on $serverBranch but our branch is unknown." +
|
|
|
|
" Verify that we are fully synced."
|
|
|
|
hasSdkBranch -> "We are on $sdkBranch but the server branch is unknown. Verify" +
|
|
|
|
" the network connection."
|
|
|
|
else -> {
|
|
|
|
val newerBranch = if (isServerNewer) serverBranch else sdkBranch
|
|
|
|
val olderBranch = if (isSdkNewer) serverBranch else sdkBranch
|
|
|
|
val newerDevice = if (isServerNewer) "the server has" else "we have"
|
|
|
|
val olderDevice = if (isSdkNewer) "the server has" else "we have"
|
|
|
|
"Incompatible consensus: $newerDevice upgraded to $newerBranch but" +
|
|
|
|
" $olderDevice $olderBranch."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-26 04:00:04 -07:00
|
|
|
}
|