Skip to content
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

fix(wallet): allow generating transactions without persisting change addresses #2385

Merged

Conversation

aesedepece
Copy link
Member

This opens up the possibility of creating transactions in a wallet without persisting change addresses, which is needed in the case of fee estimations.

Fix #2384

) -> Result<Arc<model::Address>> {
let keychain = constants::INTERNAL_KEYCHAIN;
let account = state.account;
let index = state.next_internal_index;
let parent_key = &state.keychains[keychain as usize];

let (address, next_index) =
self.derive_and_persist_address(label, parent_key, account, keychain, index, true)?;
self.derive_and_persist_address(label, parent_key, account, keychain, index, !preview)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key point here. This will avoid persisting the change address if the transaction is being generated solely for preview purposes (e.g. estimating fees).

@aesedepece
Copy link
Member Author

For this functionality to actually make an impact, a similar change is needed on the Sheikah side, so the preview: true flag is passed to createVTT and createDRT.

@aesedepece aesedepece force-pushed the fix/wallet/sparse-internal-keychain branch from 56efa5d to cdb646b Compare July 11, 2023 16:19
@aesedepece aesedepece force-pushed the fix/wallet/sparse-internal-keychain branch 3 times, most recently from 90e2f3c to 46d9352 Compare July 27, 2023 13:19
@aesedepece aesedepece requested a review from Tommytrg July 28, 2023 09:19
@aesedepece aesedepece force-pushed the fix/wallet/sparse-internal-keychain branch 3 times, most recently from 8e740e3 to 46d9352 Compare August 3, 2023 08:27
@aesedepece aesedepece force-pushed the fix/wallet/sparse-internal-keychain branch from 46d9352 to bd6c130 Compare August 3, 2023 17:00
@aesedepece aesedepece merged commit bd6c130 into witnet:master Aug 3, 2023
@aesedepece aesedepece mentioned this pull request Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wallet is using internal addresses in a non-sequential way
1 participant