From 89e3f7dc3884f49aac4bf68b7aa97dc218233907 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 20 Jun 2019 14:55:06 +0200 Subject: [PATCH] Add explanatory comment about account creation process --- wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala b/wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala index ecd1a8c8cf..d9df700c87 100644 --- a/wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala +++ b/wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala @@ -109,13 +109,16 @@ sealed abstract class Wallet .findAll() .map(_.filter(_.hdAccount.purpose == purpose)) .map(_.sortBy(_.hdAccount.index)) + // we want to the most recently created account, + // to know what the index of our new account + // should be. .map(_.lastOption) .flatMap { mostRecentOpt => val accountIndex = mostRecentOpt match { case None => 0 // no accounts present in wallet case Some(account) => account.hdAccount.index + 1 } - logger.debug( + logger.info( s"Creating new account at index $accountIndex for purpose $purpose") val newAccount = HDAccount(DEFAULT_HD_COIN, accountIndex) val xpub = {