From 56113daef4830cad1af3c00f6b3c447c9e2a8e05 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Fri, 29 Oct 2021 14:06:21 +0200 Subject: wallet: add taprootEnabled() to interface --- src/interfaces/wallet.h | 3 +++ src/wallet/interfaces.cpp | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 4213a22749..77e15fc097 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -256,6 +256,9 @@ public: // Return whether private keys enabled. virtual bool privateKeysDisabled() = 0; + // Return whether the wallet contains a Taproot scriptPubKeyMan + virtual bool taprootEnabled() = 0; + // Return whether wallet uses an external signer. virtual bool hasExternalSigner() = 0; diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index bba909b807..04501ea5a2 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -461,6 +461,11 @@ public: bool canGetAddresses() override { return m_wallet->CanGetAddresses(); } bool hasExternalSigner() override { return m_wallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER); } bool privateKeysDisabled() override { return m_wallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS); } + bool taprootEnabled() override { + if (m_wallet->IsLegacy()) return false; + auto spk_man = m_wallet->GetScriptPubKeyMan(OutputType::BECH32M, /*internal=*/false); + return spk_man != nullptr; + } OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; } CAmount getDefaultMaxTxFee() override { return m_wallet->m_default_max_tx_fee; } void remove() override -- cgit v1.2.3