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: recover all known scripts #4397

Merged

Conversation

SWvheerden
Copy link
Collaborator

@SWvheerden SWvheerden commented Aug 5, 2022

Description

This allows the wallet to recover all known scripts.

Motivation and Context

The wallet stores a list of all known scripts and inputs required to claim them.
This PR allows the wallet to use this lest when searching for outputs to recover.

Fixes: #4231

@SWvheerden SWvheerden changed the title fix: Recover all known scripts fix: recover all known scripts Aug 5, 2022
sdbondi
sdbondi previously approved these changes Aug 8, 2022
@aviator-app aviator-app bot added the mq-failed label Aug 8, 2022
known_scripts[index].private_key.clone(),
)
} else {
let key = PrivateKey::random(&mut OsRng);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of this. I understand it was in the previous PR, but surely there's no data needed for this? It's misleading to store a public key without storing the secret

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean dont store the private key?
We do, its the script_key. For a Nop, the input stack will then be the public key of that private key.
So for Nop, which the else is, we store a random private key, as the script key(this is the key used to sign the input, aka script, aka K_s)
And then we store the input_data, that's required to "validly" claim the nop

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok I see it's saved in the db, I had missed that

@stringhandler stringhandler dismissed sdbondi’s stale review August 8, 2022 11:19

Waiting for clarification

@aviator-app aviator-app bot removed the mq-failed label Aug 8, 2022
@aviator-app aviator-app bot merged commit 7502fd6 into tari-project:development Aug 8, 2022
sdbondi added a commit to sdbondi/tari that referenced this pull request Aug 9, 2022
@SWvheerden SWvheerden deleted the sw_recover_all_Scripts branch August 10, 2022 11:41
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.

Only outputs with scripts == script!(Nop) is recover-able - can this be improved?
3 participants