Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2018-2020 The Bitcoin developers | // Copyright (c) 2018-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_WALLET_WALLET_H | #ifndef BITCOIN_WALLET_WALLET_H | ||||
#define BITCOIN_WALLET_WALLET_H | #define BITCOIN_WALLET_WALLET_H | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <interfaces/chain.h> | #include <interfaces/chain.h> | ||||
#include <interfaces/handler.h> | #include <interfaces/handler.h> | ||||
#include <outputtype.h> | #include <outputtype.h> | ||||
#include <primitives/blockhash.h> | #include <primitives/blockhash.h> | ||||
#include <psbt.h> | |||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <wallet/coinselection.h> | #include <wallet/coinselection.h> | ||||
#include <wallet/crypter.h> | #include <wallet/crypter.h> | ||||
▲ Show 20 Lines • Show All 1,079 Lines • ▼ Show 20 Lines | bool SignTransaction(CMutableTransaction &tx) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
// Sign the tx given the input coins and sighash. | // Sign the tx given the input coins and sighash. | ||||
bool SignTransaction(CMutableTransaction &tx, | bool SignTransaction(CMutableTransaction &tx, | ||||
const std::map<COutPoint, Coin> &coins, | const std::map<COutPoint, Coin> &coins, | ||||
SigHashType sighash, | SigHashType sighash, | ||||
std::map<int, std::string> &input_errors) const; | std::map<int, std::string> &input_errors) const; | ||||
/** | /** | ||||
* Fills out a PSBT with information from the wallet. Fills in UTXOs if we | |||||
* have them. Tries to sign if sign=true. Sets `complete` if the PSBT is now | |||||
* complete (i.e. has all required signatures or signature-parts, and is | |||||
* ready to finalize.) Sets `error` and returns false if something goes | |||||
* wrong. | |||||
* | |||||
* @param[in] psbtx PartiallySignedTransaction to fill in | |||||
* @param[out] complete indicates whether the PSBT is now complete | |||||
* @param[in] sighash_type the sighash type to use when signing (if PSBT | |||||
* does not specify) | |||||
* @param[in] sign whether to sign or not | |||||
* @param[in] bip32derivs whether to fill in bip32 derivation information | |||||
* if available return error | |||||
*/ | |||||
TransactionError | |||||
FillPSBT(PartiallySignedTransaction &psbtx, bool &complete, | |||||
SigHashType sighash_type = SigHashType().withForkId(), | |||||
bool sign = true, bool bip32derivs = true) const; | |||||
/** | |||||
* Create a new transaction paying the recipients with a set of coins | * Create a new transaction paying the recipients with a set of coins | ||||
* selected by SelectCoins(); Also create the change output, when needed | * selected by SelectCoins(); Also create the change output, when needed | ||||
* @note passing nChangePosInOut as -1 will result in setting a random | * @note passing nChangePosInOut as -1 will result in setting a random | ||||
* position | * position | ||||
*/ | */ | ||||
bool CreateTransaction(const std::vector<CRecipient> &vecSend, | bool CreateTransaction(const std::vector<CRecipient> &vecSend, | ||||
CTransactionRef &tx, Amount &nFeeRet, | CTransactionRef &tx, Amount &nFeeRet, | ||||
int &nChangePosInOut, bilingual_str &error, | int &nChangePosInOut, bilingual_str &error, | ||||
▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines |