-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i1722-avoid-wallet-rescan-after-init #1723
base: master
Are you sure you want to change the base?
Changes from 19 commits
b6c7564
075f73c
8a0c5e9
e62289a
1ac27b8
624e363
827a065
385b199
486d63b
ea31210
a81c82b
46b57a7
6a6d6c6
0d3a9d5
24c49ba
641fb2a
e0202af
35563a5
4a0a221
6a7b4d9
43a9298
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import org.ergoplatform._ | |
import org.ergoplatform.modifiers.ErgoFullBlock | ||
import org.ergoplatform.modifiers.mempool.{ErgoTransaction, UnsignedErgoTransaction} | ||
import org.ergoplatform.nodeView.state.{ErgoStateContext, UtxoStateReader} | ||
import org.ergoplatform.nodeView.wallet.ErgoWalletActor.WalletPhase | ||
import org.ergoplatform.nodeView.wallet.ErgoWalletService.DeriveNextKeyResult | ||
import org.ergoplatform.nodeView.wallet.models.{ChangeBox, CollectedBoxes} | ||
import org.ergoplatform.nodeView.wallet.persistence.{WalletRegistry, WalletStorage} | ||
|
@@ -73,7 +74,7 @@ trait ErgoWalletService { | |
settings: ErgoSettings, | ||
mnemonic: SecretString, | ||
mnemonicPassOpt: Option[SecretString], | ||
walletPass: SecretString, | ||
walletPass: SecretString, | ||
usePre1627KeyDerivation: Boolean): Try[ErgoWalletState] | ||
|
||
/** | ||
|
@@ -563,6 +564,7 @@ class ErgoWalletServiceImpl(override val ergoSettings: ErgoSettings) extends Erg | |
block, | ||
state.outputsFilter, | ||
dustLimit, | ||
state.walletPhase == WalletPhase.Created, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why always Created here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could pass |
||
ergoSettings.walletSettings.walletProfile).map { case (reg, offReg, updatedOutputsFilter) => | ||
state.copy(registry = reg, offChainRegistry = offReg, outputsFilter = Some(updatedOutputsFilter)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ class WalletRegistry(store: LDBVersionedStore)(ws: WalletSettings) extends Score | |
* @param blockId - block identifier | ||
* @param blockHeight - block height | ||
*/ | ||
def updateOnBlock(scanResults: ScanResults, blockId: ModifierId, blockHeight: Int): Try[Unit] = { | ||
def updateOnBlock(scanResults: ScanResults, blockId: ModifierId, blockHeight: Int, walletCreated: Boolean = false): Try[Unit] = { | ||
|
||
// first, put newly created outputs and related transactions into key-value bag | ||
val bag1 = putBoxes(KeyValuePairsBag.empty, scanResults.outputs) | ||
|
@@ -252,7 +252,7 @@ class WalletRegistry(store: LDBVersionedStore)(ws: WalletSettings) extends Score | |
|
||
// and update wallet digest | ||
updateDigest(bag3) { case WalletDigest(height, wBalance, wTokensSeq) => | ||
if (height + 1 != blockHeight) { | ||
if (height + 1 != blockHeight && !walletCreated) { | ||
log.error(s"Blocks were skipped during wallet scanning, from $height until $blockHeight") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only reason why the walletPhase is being propagated down the |
||
} | ||
val spentWalletBoxes = spentBoxesWithTx.map(_._2).filter(_.scans.contains(PaymentsScanId)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, only
state.getWalletHeight == 0
is not enough as restored wallet has alsostate.getWalletHeight == 0
, that's why theWalletPhase
introduction