Bitcoin
Functions
psbt.cpp File Reference
#include <psbt.h>
#include <util/strencodings.h>
#include <numeric>

Functions

bool PSBTInputSigned (const PSBTInput &input)
 
void UpdatePSBTOutput (const SigningProvider &provider, PartiallySignedTransaction &psbt, int index)
 
bool SignPSBTInput (const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, int sighash, SignatureData *out_sigdata, bool use_dummy)
 
bool FinalizePSBT (PartiallySignedTransaction &psbtx)
 
bool FinalizeAndExtractPSBT (PartiallySignedTransaction &psbtx, CMutableTransaction &result)
 
TransactionError CombinePSBTs (PartiallySignedTransaction &out, const std::vector< PartiallySignedTransaction > &psbtxs)
 
std::string PSBTRoleName (PSBTRole role)
 
bool DecodeBase64PSBT (PartiallySignedTransaction &psbt, const std::string &base64_tx, std::string &error)
 Decode a base64ed PSBT into a PartiallySignedTransaction. More...
 
bool DecodeRawPSBT (PartiallySignedTransaction &psbt, const std::string &tx_data, std::string &error)
 Decode a raw (binary blob) PSBT into a PartiallySignedTransaction. More...
 

Function Documentation

◆ CombinePSBTs()

TransactionError CombinePSBTs ( PartiallySignedTransaction out,
const std::vector< PartiallySignedTransaction > &  psbtxs 
)

Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial signatures from each input.

Parameters
[out]&outthe combined PSBT, if successful
[in]psbtxsthe PSBTs to combine
Returns
error (OK if we successfully combined the transactions, other error if they were not compatible)

◆ DecodeBase64PSBT()

bool DecodeBase64PSBT ( PartiallySignedTransaction psbt,
const std::string &  base64_tx,
std::string &  error 
)

Decode a base64ed PSBT into a PartiallySignedTransaction.

◆ DecodeRawPSBT()

bool DecodeRawPSBT ( PartiallySignedTransaction psbt,
const std::string &  tx_data,
std::string &  error 
)

Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.

◆ FinalizeAndExtractPSBT()

bool FinalizeAndExtractPSBT ( PartiallySignedTransaction psbtx,
CMutableTransaction result 
)

Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.

Parameters
[in]&psbtxreference to PartiallySignedTransaction
[out]resultCMutableTransaction representing the complete transaction, if successful
Returns
True if we successfully extracted the transaction, false otherwise

◆ FinalizePSBT()

bool FinalizePSBT ( PartiallySignedTransaction psbtx)

Finalizes a PSBT if possible, combining partial signatures.

Parameters
[in,out]&psbtxreference to PartiallySignedTransaction to finalize return True if the PSBT is now complete, false otherwise

◆ PSBTInputSigned()

bool PSBTInputSigned ( const PSBTInput input)

Checks whether a PSBTInput is already signed.

◆ PSBTRoleName()

std::string PSBTRoleName ( PSBTRole  role)

◆ SignPSBTInput()

bool SignPSBTInput ( const SigningProvider provider,
PartiallySignedTransaction psbt,
int  index,
int  sighash = SIGHASH_ALL,
SignatureData out_sigdata = nullptr,
bool  use_dummy = false 
)

Signs a PSBTInput, verifying that all provided data matches what is being signed.

◆ UpdatePSBTOutput()

void UpdatePSBTOutput ( const SigningProvider provider,
PartiallySignedTransaction psbt,
int  index 
)

Updates a PSBTOutput with information from provider.

This fills in the redeem_script, witness_script, and hd_keypaths where possible.