Skip to content

Commit

Permalink
review comment from @sstone
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 committed Feb 15, 2024
1 parent 7b74a3c commit 82c0d22
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class ElectrumMiniWallet(
}

suspend fun WalletState.maybeGenerateNext(generator: WalletCommand.Companion.AddressGenerator): WalletState {
val lastDerivedAddressState = this.addresses[this.lastDerivedAddress?.first]
val lastDerivedAddressState = this.lastDerivedAddress?.let { this.addresses[it.first] }
return when {
lastDerivedAddressState == null -> this.addAddress(generator, 0).maybeGenerateNext(generator) // there is no existing derived address: initialization
lastDerivedAddressState.alreadyUsed -> this.addAddress(generator, lastDerivedAddressState.meta.indexOrNull!! + 1).maybeGenerateNext(generator) // most recent derived address is used, need to generate a new one
Expand Down

0 comments on commit 82c0d22

Please sign in to comment.