Null Wallet Indexer support in NEP6Wallet (for NEO 2.x) #961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
neo-express uses a custom Wallet subclass to store all of the wallets (consensus node and standard account) for a given developer blockchain instance in a single file without encryption. neo-express has export functionality to enable developer to convert these developer blockchain wallets to NEP-6 standard wallets.
NEP6Wallet's constructor takes a WalletIndexer argument, which needs to access the Blockchain.Singleton instance. When neo-express is exporting wallets, there is no running blockchain instance, so the WalletIndexer hangs attempting to access Blockchain.Singleton.
This PR enables NEP6Wallet to accept a null WalletIndexer instance. Wallet functionality that depends on the indexer, such as WalletHeight property, GetCoins and GetTransactions, have been updated to return default values when the indexer is null.
This change will not affect existing NEP6Wallet code paths as those code paths always pass in a valid WalletIndexer instance.
Note, this change is for the NEO 2.x branch. The NEO 3.x branch will not need this change due to the change from UTXO model to Native Contracts for NEO/GAS tokens.
Here is the wallet export code from neo-express that demonstrates the use of the null WalletIndexer parameter.