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

Introduce mintscript::SigntureOnlyChecker and use it in the wallet #1791

Merged
merged 9 commits into from
Jul 19, 2024

Conversation

azarovh
Copy link
Member

@azarovh azarovh commented Jul 5, 2024

This PR addresses a problem that was introduced by HTLC change: StandardInputSignature::raw_signature can encode additional layer with AuthorizedHashedTimelockContractSpend. Meaning that common::StandardInputSignature::verify_signtaure cannot be called directly and InputWitness must be first evaluated with mintscript.

  • added mintscript::SignatureOnlyChecker and public function in tx_verifier::verify_tx_signature
  • moved PartiallySignedTransaction to common and remove sig verification logic from inside
  • removed verify_signature call from inside of PartiallySIgnedTransaction
  • use new verify_tx_function in the wallet

@azarovh azarovh requested a review from OBorce July 5, 2024 13:30
@azarovh azarovh marked this pull request as draft July 5, 2024 13:45
@azarovh azarovh marked this pull request as ready for review July 7, 2024 07:54

use super::{InputCheckError, InputCheckErrorPayload, PerInputData};

struct InputVerifyContextSignature<'a, T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a very confusing name

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 just a name in line with others like InputVerifyContextTimelock

Comment on lines +445 to +454
pub struct SignatureOnlyReward;

impl<C: SignatureInfoProvider> TranslateInput<C> for SignatureOnlyReward {
fn translate_input(_ctx: &C) -> Result<WitnessScript, TranslationError> {
// Not used anywhere.
// But it's important to outline that if needed the reward implementation must be different
// because staking/decommissioning destinations are not the same.
unimplemented!()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why keep it if it's unused?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to make it explicit for the future. So that noone tried to use implementation from transaction with reward (it might be a problem because both implement Transactable)

@azarovh azarovh merged commit 7b6bc9b into master Jul 19, 2024
23 checks passed
@azarovh azarovh deleted the feat/wallet_htlc_verify branch July 19, 2024 08:38
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.

None yet

3 participants