mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 13:49:35 +02:00
Factor out combine / finalize / extract PSBT helpers
Refactor the new CombinePSBT, FinalizePSBT, and FinalizeAndExtractPSBT general-purpose functions out of the combinepsbt and finalizepsbt RPCs, for use in the GUI code.
This commit is contained in:
27
src/psbt.h
27
src/psbt.h
@@ -544,4 +544,31 @@ bool PSBTInputSigned(PSBTInput& input);
|
||||
/** Signs a PSBTInput, verifying that all provided data matches what is being signed. */
|
||||
bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, int index, int sighash = SIGHASH_ALL);
|
||||
|
||||
/**
|
||||
* Finalizes a PSBT if possible, combining partial signatures.
|
||||
*
|
||||
* @param[in,out] &psbtx reference to PartiallySignedTransaction to finalize
|
||||
* return True if the PSBT is now complete, false otherwise
|
||||
*/
|
||||
bool FinalizePSBT(PartiallySignedTransaction& psbtx);
|
||||
|
||||
/**
|
||||
* Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
|
||||
*
|
||||
* @param[in] &psbtx reference to PartiallySignedTransaction
|
||||
* @param[out] result CMutableTransaction representing the complete transaction, if successful
|
||||
* @return True if we successfully extracted the transaction, false otherwise
|
||||
*/
|
||||
bool FinalizeAndExtractPSBT(PartiallySignedTransaction& psbtx, CMutableTransaction& result);
|
||||
|
||||
/**
|
||||
* Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial signatures from each input.
|
||||
*
|
||||
* @param[out] &out the combined PSBT, if successful
|
||||
* @param[out] &error reference to TransactionError to fill with error info on failure
|
||||
* @param[in] psbtxs the PSBTs to combine
|
||||
* @return True if we successfully combined the transactions, false if they were not compatible
|
||||
*/
|
||||
bool CombinePSBTs(PartiallySignedTransaction& out, TransactionError& error, const std::vector<PartiallySignedTransaction>& psbtxs);
|
||||
|
||||
#endif // BITCOIN_PSBT_H
|
||||
|
||||
Reference in New Issue
Block a user