5 #include <chainparams.h> 25 int64_t creation_time =
GetTime();
29 m_wallet_descriptor = w_desc;
33 if (!batch.WriteDescriptor(
GetID(), m_wallet_descriptor)) {
34 throw std::runtime_error(std::string(__func__) +
": writing descriptor failed");
46 if (
command ==
"")
throw std::runtime_error(std::string(__func__) +
": restart bitcoind with -signer=<cmd>");
47 std::vector<ExternalSigner> signers;
49 if (signers.empty())
throw std::runtime_error(std::string(__func__) +
": No external signers found");
51 if (signers.size() > 1)
throw std::runtime_error(std::string(__func__) +
": More than one external signer found. Please connect only one at a time.");
75 for (
const auto& input : psbt.
inputs) {
81 std::string strFailReason;
83 tfm::format(std::cerr,
"Failed to sign: %s\n", strFailReason);
Enables interaction with an external signing device or service, such as a hardware wallet...
virtual bool IsWalletFlagSet(uint64_t) const =0
virtual WalletDatabase & GetDatabase() const =0
bool SetupDescriptor(std::unique_ptr< Descriptor >desc)
Provide a descriptor at setup time Returns false if already setup or setup fails, true if setup is su...
bool FinalizePSBT(PartiallySignedTransaction &psbtx)
Finalizes a PSBT if possible, combining partial signatures.
A version of CTransaction with the PSBT format.
virtual void UnsetBlankWalletFlag(WalletBatch &)=0
Access to the wallet database.
Indicates that the wallet needs an external signer.
UniValue DisplayAddress(const std::string &descriptor) const
Display address on the device.
bool DisplayAddress(const CScript scriptPubKey, const ExternalSigner &signer) const
uint256 GetID() const override
std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const override
Indicate that this wallet supports DescriptorScriptPubKeyMan.
static bool Enumerate(const std::string &command, std::vector< ExternalSigner > &signers, const std::string chain)
Obtain a list of signers.
std::vector< PSBTInput > inputs
Descriptor with some wallet metadata.
static ExternalSigner GetExternalSigner()
std::unique_ptr< Descriptor > InferDescriptor(const CScript &script, const SigningProvider &provider)
Find a descriptor for the specified script, using information from provider where possible...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
RecursiveMutex cs_desc_man
TransactionError FillPSBT(PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=1, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const override
Adds script and derivation path information to a PSBT, and optionally signs it.
bool PSBTInputSigned(const PSBTInput &input)
Checks whether a PSBTInput is already signed by checking for non-null finalized fields.
TransactionError FillPSBT(PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const override
Adds script and derivation path information to a PSBT, and optionally signs it.
int64_t GetTime()
DEPRECATED, see GetTime.
bool TopUp(unsigned int size=0) override
Fills internal address pool.
bool SignTransaction(CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const override
Creates new signatures and adds them to the transaction.
WalletStorage & m_storage