Skip to content

Conversation

@pinheadmz
Copy link
Member

See #28363 (comment)

walletprocesspsbt currently returns a base64-encoded PSBT and a boolean indicating if the tx is "complete". If it is complete, the base64 PSBT can be finalized with finalizepsbt which returns the hex-encoded transaction suitable for sendrawtransaction.

With this patch, walletprocesspsbt return object will ALSO include the broadcast-able hex string if the tx is already final. This saves users the extra step of calling finalizepsbt assuming they have already inspected and approve the transaction from earlier steps.

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 5, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ismaelsadeeq, BrandonOdiwuor, ishaanam, Randy808, achow101
Concept ACK furszy

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #21283 (Implement BIP 370 PSBTv2 by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

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

Concept ACK

Should mention the API changes in the release notes too.

@DrahtBot DrahtBot removed the CI failed label Sep 5, 2023
Copy link
Member

@ismaelsadeeq ismaelsadeeq left a comment

Choose a reason for hiding this comment

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

Tested ACK e3d484b

I've create a psbt on regtest and process it with walletprocesspbst the output now has the hex encoded network tx, which I sendrawtransaction to the node and was accepted.

I think this is a nice automation, you dont have to call finalizepsbt if the processed psbt is complete.

assert finalized_psbt_hex == finalized_hex

# Manually selected inputs can be locked:
assert_equal(len(self.nodes[0].listlockunspent()), 0)
Copy link
Member

Choose a reason for hiding this comment

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

With this PR finalizepsbt rpc calls to get hex encoded tx after a complete walletprocesspsbt in the functional tests are not necessary

I've done that in this commit 5b93ed8
feel free to pick it in this PR.

Or I will follow up after this

Copy link
Member Author

Choose a reason for hiding this comment

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

fantastic thanks! I'll cherry-pick

luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Sep 6, 2023
Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

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

Tested ACK #e3d484b

The PR will help reduce the steps in creating PSBT transactions by finalizing transactions with walletprocesspsbt if all signatures are already present

would help improve #28363 - (check discussion)

$ ./src/bitcoin-cli -signet walletcreatefundedpsbt '[]' '[{"tb1qteq3qqhsxhzle98t6k3ecpluaapg84an65rw7l": 0.0008}]'
  
{                                                                                                                                                                                                                  
  "psbt": "cHNidP8BAHECAAAAAe+Y/3akTBUt92Mw40C6GvfDGmUpJsClkO2U9IIh4T+CAQAAAAD9////Aj4EDgAAAAAAFgAUgM1wLZlob/pSB96COtrlAxtemAWAOAEAAAAAABYAFF5BEALwNcX8lOvVo5wH/O9Cg9ezAAAAAAABAHECAAAAAduDPeZZtQlruL4IoNEoQbkaS5qT
7qHcrwVSRqIT1RyAAAAAAAD+////AvMVewEAAAAAFgAUk0uFiw1qYDauGlJX8sCWb9/ZW7RAQg8AAAAAABYAFHNQXZSO8IfJS9hVety+234E0SaEy24CAAEBH0BCDwAAAAAAFgAUc1BdlI7wh8lL2FV63L7bfgTRJoQiBgMoObTjYDiO/v1NA6150z8m1FmklkxZzDvwd4TVUztXbBi
yXiGAVAAAgAEAAIAAAACAAAAAAAAAAAAAIgIDo2i8r5PEOyf1Ev0+AFJBQHyCiIcwBO1k7rHDyuaoE/8Ysl4hgFQAAIABAACAAAAAgAEAAAAAAAAAAAA=",                                                                                            
  "fee": 0.00001410,                                                                                                                                                                                               
  "changepos": 0                                                                                
} 
$ ./src/bitcoin-cli -signet walletprocesspsbt cHNidP8BAHECAAAAAe+Y/3akTBUt92Mw40C6GvfDGmUpJsClkO2U9IIh4T+CAQAAAAD9////Aj4E
DgAAAAAAFgAUgM1wLZlob/pSB96COtrlAxtemAWAOAEAAAAAABYAFF5BEALwNcX8lOvVo5wH/O9Cg9ezAAAAAAABAHECAAAAAduDPeZZtQlruL4IoNEoQbkaS5qT7qHcrwVSRqIT1RyAAAAAAAD+////AvMVewEAAAAAFgAUk0uFiw1qYDauGlJX8sCWb9/ZW7RAQg8AAAAAABYAFHN
QXZSO8IfJS9hVety+234E0SaEy24CAAEBH0BCDwAAAAAAFgAUc1BdlI7wh8lL2FV63L7bfgTRJoQiBgMoObTjYDiO/v1NA6150z8m1FmklkxZzDvwd4TVUztXbBiyXiGAVAAAgAEAAIAAAACAAAAAAAAAAAAAIgIDo2i8r5PEOyf1Ev0+AFJBQHyCiIcwBO1k7rHDyuaoE/8Ysl4hgF
QAAIABAACAAAAAgAEAAAAAAAAAAAA=

{
  "psbt": "cHNidP8BAHECAAAAAe+Y/3akTBUt92Mw40C6GvfDGmUpJsClkO2U9IIh4T+CAQAAAAD9////Aj4EDgAAAAAAFgAUgM1wLZlob/pSB96COtrlAxtemAWAOAEAAAAAABYAFF5BEALwNcX8lOvVo5wH/O9Cg9ezAAAAAAABAHECAAAAAduDPeZZtQlruL4IoNEoQbkaS5qT
7qHcrwVSRqIT1RyAAAAAAAD+////AvMVewEAAAAAFgAUk0uFiw1qYDauGlJX8sCWb9/ZW7RAQg8AAAAAABYAFHNQXZSO8IfJS9hVety+234E0SaEy24CAAEBH0BCDwAAAAAAFgAUc1BdlI7wh8lL2FV63L7bfgTRJoQBCGsCRzBEAiAUUXjmuYYiPzB9gLi8DWam9RL6iJ+wG5Mv0+O
UeWJPgwIgANOdu3NpxlPzOQ/oC0nkV6IRQ2rCps8x63X+u/Ta0+gBIQMoObTjYDiO/v1NA6150z8m1FmklkxZzDvwd4TVUztXbAAiAgOjaLyvk8Q7J/US/T4AUkFAfIKIhzAE7WTuscPK5qgT/xiyXiGAVAAAgAEAAIAAAACAAQAAAAAAAAAAAA==",
  "complete": true,
  "hex": "02000000000101ef98ff76a44c152df76330e340ba1af7c31a652926c0a590ed94f48221e13f820100000000fdffffff023e040e000000000016001480cd702d99686ffa5207de823adae5031b5e980580380100000000001600145e411002f035c5fc94e
bd5a39c07fcef4283d7b3024730440220145178e6b986223f307d80b8bc0d66a6f512fa889fb01b932fd3e39479624f83022000d39dbb7369c653f3390fe80b49e457a211436ac2a6cf31eb75febbf4dad3e80121032839b4e360388efefd4d03ad79d33f26d459a496
4c59cc3bf07784d5533b576c00000000"
}
$ ./src/bitcoin-cli -signet sendrawtransaction 02000000000101ef98ff76a44c152df76330e340ba1af7c31a652926c0a590ed94f48221e13
f820100000000fdffffff023e040e000000000016001480cd702d99686ffa5207de823adae5031b5e980580380100000000001600145e411002f035c5fc94ebd5a39c07fcef4283d7b3024730440220145178e6b986223f307d80b8bc0d66a6f512fa889fb01b932fd3
e39479624f83022000d39dbb7369c653f3390fe80b49e457a211436ac2a6cf31eb75febbf4dad3e80121032839b4e360388efefd4d03ad79d33f26d459a4964c59cc3bf07784d5533b576c00000000

176af5a2291ce02add13ec854c817389638d3883427e47ea0e17ca28be177122

@pinheadmz
Copy link
Member Author

Thanks for the review everyone. I added a release-notes doc and cherrypicked the test cleanup commit from @ismaelsadeeq

@ismaelsadeeq
Copy link
Member

re ACK 2e249b9

@BrandonOdiwuor
Copy link
Contributor

re ACK 2e249b9

@DrahtBot DrahtBot removed the request for review from BrandonOdiwuor September 7, 2023 04:46
Copy link
Contributor

@ishaanam ishaanam left a comment

Choose a reason for hiding this comment

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

ACK 2e249b9

It would be useful if this was also implemented for descriptorprocesspsbt.

@maflcko maflcko requested a review from achow101 September 10, 2023 15:03
@Randy808
Copy link
Contributor

Randy808 commented Sep 12, 2023

Tested ACK 2e249b9

@achow101
Copy link
Member

ACK 2e249b9

@DrahtBot DrahtBot removed the request for review from achow101 September 12, 2023 16:28
@achow101 achow101 merged commit 8f9c74c into bitcoin:master Sep 12, 2023
@ismaelsadeeq
Copy link
Member

ACK 2e249b9

It would be useful if this was also implemented for descriptorprocesspsbt.

I think it would be useful for descriptorprocesspsbt also, opened PR for that @ishaanam @pinheadmz @BrandonOdiwuor
28492

Frank-GER pushed a commit to syscoin/syscoin that referenced this pull request Sep 19, 2023
…sspsbt if complete

2e249b9 doc: add release note for PR bitcoin#28414 (Matthew Zipkin)
4614332 test: remove unnecessary finalizepsbt rpc calls (ismaelsadeeq)
e3d484b wallet rpc: return final tx hex from walletprocesspsbt if complete (Matthew Zipkin)

Pull request description:

  See bitcoin#28363 (comment)

  `walletprocesspsbt` currently returns a base64-encoded PSBT and a boolean indicating if the tx is "complete". If it is complete, the base64 PSBT can be finalized with `finalizepsbt` which returns the hex-encoded transaction suitable for `sendrawtransaction`.

  With this patch, `walletprocesspsbt` return object will ALSO include the broadcast-able hex string if the tx is already final. This saves users the extra step of calling `finalizepsbt` assuming they have already inspected and approve the transaction from earlier steps.

ACKs for top commit:
  ismaelsadeeq:
    re ACK 2e249b9
  BrandonOdiwuor:
    re ACK 2e249b9
  Randy808:
    Tested ACK 2e249b9
  achow101:
    ACK 2e249b9
  ishaanam:
    ACK 2e249b9

Tree-SHA512: 229c1103265a9b4248f080935a7ad5607c3be3f9a096a9ab6554093b2cd8aa8b4d1fa55b1b97d3925ba208dbc3ccba4e4d37c40e1491db0d27ba3d9fe98f931e
achow101 added a commit to bitcoin-core/gui that referenced this pull request Sep 23, 2023
… encoded tx if complete

a99e9e6 doc: add release note (ismaelsadeeq)
2b4edf8 test: check `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)
c405207 rpc: `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)

Pull request description:

  Coming from [#28414 comment](bitcoin/bitcoin#28414 (review)) Same thing also for `descriptorprocesspsbt`.

  Before this PR `descriptorprocesspsbt` returns a boolean `complete` which indicates that the psbt is final, users then have to call `finalizepsbt` to get the hex encoded network transaction.

  In this PR if the psbt is complete the return object also has the hex encoded network transaction ready for broadcast with `sendrawtransaction`.

  This save users calling `finalizepsbt` with the descriptor, if it is already complete.

ACKs for top commit:
  achow101:
    ACK a99e9e6
  pinheadmz:
    ACK a99e9e6
  ishaanam:
    ACK a99e9e6

Tree-SHA512: c3f1b1391d4df05216c463127cd593f8703840430a99febb54890bc66fadabf9d9530860605f347ec54c1694019173247a0e7a9eb879d3cbb420f9e8d9839b75
Frank-GER pushed a commit to syscoin/syscoin that referenced this pull request Sep 25, 2023
… tx if complete

a99e9e6 doc: add release note (ismaelsadeeq)
2b4edf8 test: check `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)
c405207 rpc: `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)

Pull request description:

  Coming from [bitcoin#28414 comment](bitcoin#28414 (review)) Same thing also for `descriptorprocesspsbt`.

  Before this PR `descriptorprocesspsbt` returns a boolean `complete` which indicates that the psbt is final, users then have to call `finalizepsbt` to get the hex encoded network transaction.

  In this PR if the psbt is complete the return object also has the hex encoded network transaction ready for broadcast with `sendrawtransaction`.

  This save users calling `finalizepsbt` with the descriptor, if it is already complete.

ACKs for top commit:
  achow101:
    ACK a99e9e6
  pinheadmz:
    ACK a99e9e6
  ishaanam:
    ACK a99e9e6

Tree-SHA512: c3f1b1391d4df05216c463127cd593f8703840430a99febb54890bc66fadabf9d9530860605f347ec54c1694019173247a0e7a9eb879d3cbb420f9e8d9839b75
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 26, 2023
… tx if complete

a99e9e6 doc: add release note (ismaelsadeeq)
2b4edf8 test: check `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)
c405207 rpc: `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)

Pull request description:

  Coming from [bitcoin#28414 comment](bitcoin#28414 (review)) Same thing also for `descriptorprocesspsbt`.

  Before this PR `descriptorprocesspsbt` returns a boolean `complete` which indicates that the psbt is final, users then have to call `finalizepsbt` to get the hex encoded network transaction.

  In this PR if the psbt is complete the return object also has the hex encoded network transaction ready for broadcast with `sendrawtransaction`.

  This save users calling `finalizepsbt` with the descriptor, if it is already complete.

ACKs for top commit:
  achow101:
    ACK a99e9e6
  pinheadmz:
    ACK a99e9e6
  ishaanam:
    ACK a99e9e6

Tree-SHA512: c3f1b1391d4df05216c463127cd593f8703840430a99febb54890bc66fadabf9d9530860605f347ec54c1694019173247a0e7a9eb879d3cbb420f9e8d9839b75
@bitcoin bitcoin locked and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants