Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
electrum-related fixes from immortan and use an updated graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Oct 18, 2022
1 parent 4916285 commit 8e34eb0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
targetSdkVersion 31
minSdkVersion 26

versionName '0.1.4'
versionCode 5
versionName '0.1.5'
versionCode 6
}

dexOptions {
Expand Down Expand Up @@ -151,7 +151,7 @@ dependencies {
implementation 'org.scala-lang:scala-library:2.13.8'

// Related to Immortan
implementation 'com.fiatjaf:immortan_2.13:0.7.8'
implementation 'com.fiatjaf:immortan_2.13:0.7.9-SNAPSHOT'
implementation 'fr.acinq.secp256k1:secp256k1-kmp-jni-android:0.6.4'

// Built-in Tor
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/scala/SetupActivity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ object SetupActivity {
val compressedPlainBytes =
ByteStreams.toByteArray(host.getAssets open snapshotName)
val plainBytes =
compressedByteVecCodec.decode(BitVector.view(compressedPlainBytes))
compressedByteVecCodec
.decode(BitVector.view(compressedPlainBytes))
.require
.value
LocalBackup.copyPlainDataToDbLocation(
host,
WalletApp.dbFileNameGraph,
plainBytes.require.value
plainBytes
)
} catch none
System.err.println("[obw][info] channels graph implanted")
} catch {
case err: Throwable =>
System.err.println(s"[obw][warn] failed to implant graph: $err")
}

WalletApp.putMnemonics(context, mnemonics)
WalletApp.makeOperational(mnemonics)
Expand All @@ -56,7 +63,7 @@ class SetupActivity extends BaseActivity {
findViewById(R.id.restoreOptions).asInstanceOf[LinearLayout]
private[this] final val FILE_REQUEST_CODE = 112

private [this] lazy val enforceTor = new SettingsHolder(this) {
private[this] lazy val enforceTor = new SettingsHolder(this) {
override def updateView(): Unit =
settingsCheck.setChecked(WalletApp.ensureTor)

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/scala/WalletApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import scodec.bits.BitVector
import castor.Context.Simple.global

object WalletApp {
LNParams.chainHash = Block.LivenetGenesisBlock.hash

var chainWalletBag: SQLiteChainWallet = _
var extDataBag: SQLiteDataExtended = _
var lnUrlPayBag: SQLiteLNUrlPay = _
Expand Down Expand Up @@ -226,7 +228,6 @@ object WalletApp {
LNParams.cm = new ChannelMaster(payBag, chanBag, extDataBag, pf)

LNParams.logBag = new SQLiteLog(miscInterface)
LNParams.chainHash = Block.LivenetGenesisBlock.hash
LNParams.routerConf =
RouterConf(initRouteMaxLength = 10, LNParams.maxCltvExpiryDelta)
LNParams.connectionProvider =
Expand Down
1 change: 0 additions & 1 deletion app/src/main/scala/utils/LocalBackup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ object LocalBackup {
new File(downloadsDir, getGraphResourceName(chainHash))

// Utils

def atomicWrite(file: File, data: ByteVector): Unit = {
val atomicFile = new android.util.AtomicFile(file)
var fileOutputStream = atomicFile.startWrite
Expand Down

0 comments on commit 8e34eb0

Please sign in to comment.