Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds runtime APIs to add/remove monitored address types and to change the primary address type without rebuilding the node. Previously,
address_typeandaddress_types_to_monitorwere fixed at build time viaConfig.Changes
Node API
add_address_type_to_monitor(address_type, seed_bytes)/add_address_type_to_monitor_with_mnemonic(...)— Add an address type to the monitored set. The wallet is created from the given seed (or loaded from kv-store if previously monitored) and included in subsequent sync cycles. Fails withAddressTypeAlreadyMonitoredorAddressTypeIsPrimarywhen invalid.remove_address_type_from_monitor(address_type)— Remove an address type from monitoring and unload its wallet. Persisted state remains in the kv-store; re-adding the type recovers funds on the next sync. Fails withAddressTypeNotMonitoredorAddressTypeIsPrimarywhen invalid.set_primary_address_type(address_type, seed_bytes)/set_primary_address_type_with_mnemonic(...)— Change the primary address type used for new addresses and change outputs. The previous primary is demoted to the monitored set. If the new primary has never been synced, the next sync performs a full scan.Implementation
AddressTypeRuntimeConfig— New runtime struct (primary + monitored list) initialized fromConfigand updated by the new APIs. Esplora and Electrum chain sources now take and use this forcollect_additional_sync_requests, so sync reflects the current set of address types.operation_lockto serialize add/remove/set_primary; holdskv_store,address_type_runtime_config, andnode_metrics. Shared helpercreate_wallet_for_address_typebuilds a wallet from seed and attaches it at the current best block.add_wallet,set_primary,remove_wallet; new errors:WalletAlreadyExists,CannotRemovePrimary(and existingWalletNotFound).