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

Use only spendable output related with contract #29

Closed
wants to merge 16 commits into from

Conversation

Yamaguchi
Copy link
Contributor

@Yamaguchi Yamaguchi commented Aug 7, 2024

Description

This PR implements TxBuilder#add_contract_utxo to add utxo to tx_builder related with contract

Notes to the reviewers

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@coveralls
Copy link

coveralls commented Aug 7, 2024

Pull Request Test Coverage Report for Build 10661143799

Details

  • 308 of 328 (93.9%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 82.28%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/wallet/src/wallet/signer.rs 44 46 95.65%
crates/wallet/src/wallet/tx_builder.rs 24 28 85.71%
crates/wallet/src/wallet/mod.rs 123 137 89.78%
Totals Coverage Status
Change from base Build 10481348983: 0.3%
Covered Lines: 10401
Relevant Lines: 12641

💛 - Coveralls

@Yamaguchi Yamaguchi force-pushed the use_only_spendable_output branch 5 times, most recently from 3445a1f to 7204a96 Compare August 14, 2024 13:46
Comment on lines 1046 to 1057
let index = match self
.indexed_graph
.index
.index_of_spk(ScriptBuf::new_p2pkh(&payment_base.pubkey_hash()).as_script())
{
Some(i) => i,
None => {
return Err(GenerateContractError::InvalidPublicKey {
public_key: payment_base.clone(),
})
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

index の値を使っていないようですが、必要な処理ですか?
また、この処理だと外部で作成された公開鍵をもとに pay to contract address を計算仕様とすると、InvalidPublicKey のエラーになるのではと思いますが、送金先のアドレスを計算するために、外部のウォレットの公開鍵から pay to contract address を計算するユースケースはあると思うので、エラーにするべきではないと思います。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

これ自体は
#28 (comment)
の指摘があって、追加してますが。追加する位置を変更します。

Copy link
Collaborator

Choose a reason for hiding this comment

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

なるほど。意図理解しました。よろしくお願いします。

@Yamaguchi Yamaguchi force-pushed the use_only_spendable_output branch 3 times, most recently from 2860b44 to 2d55a71 Compare August 21, 2024 18:34
@Yamaguchi Yamaguchi force-pushed the use_only_spendable_output branch from 1b08352 to 7500526 Compare September 2, 2024 05:10
@rantan
Copy link
Collaborator

rantan commented Sep 2, 2024

#31 でマージしました。

@rantan rantan closed this Sep 2, 2024
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.

3 participants