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

Add finalize_psbtmethod to wallet #604

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

rustaceanrob
Copy link
Contributor

Description

Add the finalize_psbt method on the wallet. One of the methods in #596

Notes to the reviewers

We keep the SignOptions default here considering that's how it is used for sign. The only reason SignOptions is used is whether we assume the height in the PSBT or not.

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

@rustaceanrob rustaceanrob changed the title feat: add finalize_psbtmethod to wallet Add finalize_psbtmethod to wallet Oct 7, 2024
Copy link
Member

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

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

ACK 9ea6013.

Awesome! I think that closes #469.

@thunderbiscuit thunderbiscuit merged commit 9ea6013 into bitcoindevkit:master Oct 8, 2024
25 checks passed
@rustaceanrob rustaceanrob deleted the finalize-10-7 branch October 8, 2024 19:08
@rustaceanrob
Copy link
Contributor Author

Ideally, @andreasgriffin can test if this resolves his issue, but I believe this should be sufficient

@andreasgriffin
Copy link
Contributor

andreasgriffin commented Oct 12, 2024

Ideally, @andreasgriffin can test if this resolves his issue, but I believe this should be sufficient

Unfortunately not.
My test code (with an unrelated wallet seed):


import bdkpython as bdk 
import datetime



network = bdk.bitcoin.Network.REGTEST
electrum = bdk.bdk.ElectrumClient("my-server:50001")

mnemonic = bdk.Mnemonic.from_string('bacon '*24)
print(mnemonic )


descriptor = bdk.Descriptor.new_bip84(
            secret_key=bdk.DescriptorSecretKey(network, mnemonic, ''),
             keychain=bdk.KeychainKind.EXTERNAL,
             network=network,
)


change_descriptor = bdk.Descriptor.new_bip84(
            secret_key=bdk.DescriptorSecretKey(network, mnemonic, ''),
             keychain=bdk.KeychainKind.INTERNAL,
             network=network,
)

 
print(f'xpub {descriptor }')



wallet = bdk.Wallet(
             descriptor=descriptor,
             change_descriptor=change_descriptor,
             network=network, 
             connection=bdk.Connection.new_in_memory()
         )


psbt_data = "cHNidP8BAIkBAAAAATuuOwH+YN3lM9CHZuaxhXU+P/xWQQUpwldxTxng2/NWAAAAAAD9////AhAnAAAAAAAAIgAgbnxIFWJ84RPQEHQJIBWYVALEGgr6e99xVLT2DDykpha+kQ0AAAAAACIAIH+2seEetNM9J6mtfXwz2EwP7E1gqjpvr0HHI97D3b5IcwAAAAABAP2HAQEAAAAAAQHSc/5077HT+IqRaNwhhb9WuzlFYINsZk1BxhahFNsqlQAAAAAA/f///wKYuQ0AAAAAACIAIKteOph2G5lDpTD98oWJkrif3i6FX/eHTr2kmU4KN1w1oIYBAAAAAAAiACBYU+aHAWVhSe4DMfwzQhq9NzO6smI694/A7MoURBK4nAQARzBEAiBFFZVQQjC5SlDRCAuC5AkoQgMXyrG54gp71Ro2W6g0fgIgTbg94g7liL0T7DwEeWqOiJfurgpuTv1Q+7bAzFlV/yQBRzBEAiB76jOyWL28VWQzn32ITyy4JlRYAASEaPB9C7mANDLtzAIgCjyov+Y9xRQicB2+v0iDA09RcC7hQHzLxXA9klITMXkBaVIhApBlhYUDvuGXybpbsvXzcXHMb+NikjYe3kqp8xvXMoeJIQPPm4n6VeT9fEoPYLoiy9a3O0mxnSA3wNRunj9xLxmoXSED6TWmEfTbB6zewl0TlxSPr3xmEqifQu5Ou9xoOocqvQlTrnMAAAABASuYuQ0AAAAAACIAIKteOph2G5lDpTD98oWJkrif3i6FX/eHTr2kmU4KN1w1IgICov3eEPPwwA+7S2NpB1FCBk3wZDu+EXBOrtIJi8IgI1lHMEQCIFuO9cKoLEM1v3juKeV+D9yotGzHONOlHdmXaA4qsa7PAiBNN4i+JleuHBXl3NFV8rQ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z9Cbs7elmC528iAQWIW104ND9B6ZI1+lOuIgICpfNLzexJfZ5G++SEVaypCms5w4g/8ExmROHke623xxEcJuv5KjAAAIABAACAAAAAgAIAAIABAAAABAAAACICAzc7rxaDI9x7Lvd7U3faPs9e34DNsrDE/V2mRVYn0WLvHPTklXQwAACAAQAAgAAAAIACAACAAQAAAAQAAAAiAgNkHWK1/HMUBxz9Cbs7elmC528iAQWIW104ND9B6ZI1+hwll+QpMAAAgAEAAIAAAACAAgAAgAEAAAAEAAAAAA=="

psbt = bdk.Psbt(psbt_data)
wallet.finalize_psbt(psbt)

I get
image

The PSBT from #469 should not require the source wallet to be finalized.

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