Changeset View
Changeset View
Standalone View
Standalone View
src/node/psbt.h
Show All 25 Lines | struct PSBTInputAnalysis { | ||||
uint160 missing_redeem_script; | uint160 missing_redeem_script; | ||||
}; | }; | ||||
/** | /** | ||||
* Holds the results of AnalyzePSBT (miscellaneous information about a PSBT) | * Holds the results of AnalyzePSBT (miscellaneous information about a PSBT) | ||||
*/ | */ | ||||
struct PSBTAnalysis { | struct PSBTAnalysis { | ||||
//! Estimated weight of the transaction | //! Estimated weight of the transaction | ||||
Optional<size_t> estimated_vsize; | std::optional<size_t> estimated_vsize; | ||||
//! Estimated feerate (fee / weight) of the transaction | //! Estimated feerate (fee / weight) of the transaction | ||||
Optional<CFeeRate> estimated_feerate; | std::optional<CFeeRate> estimated_feerate; | ||||
//! Amount of fee being paid by the transaction | //! Amount of fee being paid by the transaction | ||||
Optional<Amount> fee; | std::optional<Amount> fee; | ||||
//! More information about the individual inputs of the transaction | //! More information about the individual inputs of the transaction | ||||
std::vector<PSBTInputAnalysis> inputs; | std::vector<PSBTInputAnalysis> inputs; | ||||
//! Which of the BIP 174 roles needs to handle the transaction next | //! Which of the BIP 174 roles needs to handle the transaction next | ||||
PSBTRole next; | PSBTRole next; | ||||
//! Error message | //! Error message | ||||
std::string error; | std::string error; | ||||
void SetInvalid(std::string err_msg) { | void SetInvalid(std::string err_msg) { | ||||
estimated_vsize = nullopt; | estimated_vsize = std::nullopt; | ||||
estimated_feerate = nullopt; | estimated_feerate = std::nullopt; | ||||
fee = nullopt; | fee = std::nullopt; | ||||
inputs.clear(); | inputs.clear(); | ||||
next = PSBTRole::CREATOR; | next = PSBTRole::CREATOR; | ||||
error = err_msg; | error = err_msg; | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* Provides helpful miscellaneous information about where a PSBT is in the | * Provides helpful miscellaneous information about where a PSBT is in the | ||||
* signing workflow. | * signing workflow. | ||||
* | * | ||||
* @param[in] psbtx the PSBT to analyze | * @param[in] psbtx the PSBT to analyze | ||||
* @return A PSBTAnalysis with information about the provided PSBT. | * @return A PSBTAnalysis with information about the provided PSBT. | ||||
*/ | */ | ||||
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx); | PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx); | ||||
#endif // BITCOIN_NODE_PSBT_H | #endif // BITCOIN_NODE_PSBT_H |