Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new "address type" column to the "receiving tab" address book page #753

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wallet: Correct output type for Segwit address
Current OutputTypeFromDestination at outputtype, returns OUTPUT_TYPE_STRING_LEGACY
for Segwit addresses, as p2sh-segwit requires extra info from the wallet to figure
that out, this change adds a correct way to obtain the desired result from the
wallet interface. So far this will be needed from the UI to identify such type,
as currently a user could select this output type to create an address (receivecoinsdialog)
but no display of it exists.
  • Loading branch information
pablomartin4btc committed Jan 16, 2025
commit c65eb2383eb716d679e8a8ddba088027b52e01c6
3 changes: 3 additions & 0 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class Wallet
//! Get public key.
virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;

//! Get Output type from a Destination.
virtual OutputType getOutputType(const CTxDestination& dest) = 0;

//! Sign message
virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;

Expand Down
7 changes: 7 additions & 0 deletions src/wallet/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ class WalletImpl : public Wallet
}
return false;
}
OutputType getOutputType(const CTxDestination& dest) override
{
CScript script = GetScriptForDestination(dest);
std::unique_ptr<SigningProvider> provider = m_wallet->GetSolvingProvider(script);
std::unique_ptr<Descriptor> desc = provider ? InferDescriptor(script, *provider) : InferDescriptor(script, FlatSigningProvider());
return desc->GetOutputType().value_or(OutputType::UNKNOWN);
}
SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) override
{
return m_wallet->SignMessage(message, pkhash, str_sig);
Expand Down