Skip to content

Commit

Permalink
restore p2pk address displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
alexqrid committed Dec 20, 2023
1 parent 90361c5 commit d476f0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/addresstype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <script/solver.h>
#include <uint256.h>
#include <util/hash_type.h>

#include <src/groestlcoin.cpp>
#include <cassert>
#include <vector>

Expand Down Expand Up @@ -54,12 +54,11 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
switch (whichType) {
case TxoutType::PUBKEY: {
CPubKey pubKey(vSolutions[0]);
if (!pubKey.IsValid()) {
addressRet = CNoDestination(scriptPubKey);
} else {
addressRet = PubKeyDestination(pubKey);
}
return false;
if (!pubKey.IsValid())
return false;

addressRet = PKHash(pubKey);
return true;
}
case TxoutType::PUBKEYHASH: {
addressRet = PKHash(uint160(vSolutions[0]));
Expand Down
2 changes: 1 addition & 1 deletion src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool i
std::vector<std::vector<unsigned char>> solns;
const TxoutType type{Solver(script, solns)};

if (include_address && ExtractDestination(script, address) && type != TxoutType::PUBKEY) {
if (include_address && ExtractDestination(script, address)) {
out.pushKV("address", EncodeDestination(address));
}
out.pushKV("type", GetTxnOutputType(type));
Expand Down

0 comments on commit d476f0c

Please # to comment.