Height/syncing fixes

This commit is contained in:
pokkst 2023-12-07 18:33:43 -06:00
parent 269b910aaf
commit 911c813a7e
No known key found for this signature in database
GPG key ID: EC4FAAA66859FAA4
4 changed files with 12 additions and 6 deletions

View file

@ -980,7 +980,7 @@ Java_net_mynero_wallet_model_Wallet_isWatchOnly(JNIEnv *env, jobject instance) {
}
JNIEXPORT jlong JNICALL
Java_net_mynero_wallet_model_Wallet_getBlockChainHeight(JNIEnv *env, jobject instance) {
Java_net_mynero_wallet_model_Wallet_getBlockChainHeightJ(JNIEnv *env, jobject instance) {
Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance);
return wallet->blockChainHeight();
}
@ -993,7 +993,7 @@ Java_net_mynero_wallet_model_Wallet_getApproximateBlockChainHeight(JNIEnv *env,
}
JNIEXPORT jlong JNICALL
Java_net_mynero_wallet_model_Wallet_getDaemonBlockChainHeight(JNIEnv *env, jobject instance) {
Java_net_mynero_wallet_model_Wallet_getDaemonBlockChainHeightJ(JNIEnv *env, jobject instance) {
Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance);
return wallet->daemonBlockChainHeight();
}

View file

@ -129,7 +129,7 @@ class HomeFragment : Fragment(), TxInfoAdapterListener {
} else {
progressBar.visibility = View.INVISIBLE
progressBarText.visibility = View.VISIBLE
progressBarText.text = "Synchronized"
progressBarText.text = "Synchronized at $height"
}
}
val adapter = TransactionInfoAdapter(this)

View file

@ -234,9 +234,15 @@ class Wallet {
external fun getUnlockedBalance(accountIndex: Int): Long
external fun isWatchOnly(): Boolean
external fun getBlockChainHeight(): Long
fun getBlockChainHeight(): Long {
return getBlockChainHeightJ().minus(1)
}
private external fun getBlockChainHeightJ(): Long
external fun getApproximateBlockChainHeight(): Long
external fun getDaemonBlockChainHeight(): Long
fun getDaemonBlockChainHeight(): Long {
return getDaemonBlockChainHeightJ().minus(1)
}
private external fun getDaemonBlockChainHeightJ(): Long
external fun getDaemonBlockChainTargetHeight(): Long
fun setSynchronized() {

View file

@ -75,7 +75,7 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet)
override fun unconfirmedMoneyReceived(txId: String?, amount: Long) {}
override fun newBlock(height: Long) {
refresh(false)
BlockchainService.instance?.daemonHeight = if (wallet.isSynchronized) height else 0
BlockchainService.instance?.daemonHeight = if (wallet.isSynchronized) height else 0 // when 0 it fetches from C++
}
override fun updated() {