types.h
1 // Copyright (c) 2010-present The Bitcoin Core developers 2 // Distributed under the MIT software license, see the accompanying 3 // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 5 //! @file common/types.h is a home for simple enum and struct type definitions 6 //! that can be used internally by functions in the libbitcoin_common library, 7 //! but also used externally by node, wallet, and GUI code. 8 //! 9 //! This file is intended to define only simple types that do not have external 10 //! dependencies. More complicated types should be defined in dedicated header 11 //! files. 12 13 #ifndef BITCOIN_COMMON_TYPES_H 14 #define BITCOIN_COMMON_TYPES_H 15 16 #include <optional> 17 18 namespace common { 19 enum class PSBTError { 20 MISSING_INPUTS, 21 SIGHASH_MISMATCH, 22 EXTERNAL_SIGNER_NOT_FOUND, 23 EXTERNAL_SIGNER_FAILED, 24 UNSUPPORTED, 25 INCOMPLETE, 26 OK, 27 }; 28 /** 29 * Instructions for how a PSBT should be signed or filled with information. 30 */ 31 struct PSBTFillOptions { 32 /** 33 * Whether to sign or not. 34 */ 35 bool sign{true}; 36 37 /** 38 * The sighash type to use when signing (if PSBT does not specify). 39 */ 40 std::optional<int> sighash_type{std::nullopt}; 41 42 /** 43 * Whether to create the final scriptSig or scriptWitness if possible. 44 */ 45 bool finalize{true}; 46 47 /** 48 * Whether to fill in bip32 derivation information if available. 49 */ 50 bool bip32_derivs{true}; 51 }; 52 53 } // namespace common 54 55 #endif // BITCOIN_COMMON_TYPES_H