Skip to content

Commit

Permalink
Remove commented out code
Browse files Browse the repository at this point in the history
Github-Pull: #2780
Rebased-From: 4452207
  • Loading branch information
PeterL73 authored and Fuzzbawls committed Nov 22, 2022
1 parent 3fc2e6b commit b452fb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
3 changes: 0 additions & 3 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1529,11 +1529,9 @@ UniValue scantxoutset(const JSONRPCRequest& request)
"Examples of output descriptors are:\n"
" addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n"
" raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n"
//original BitCoin " combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n"
" combo(<pubkey>) P2PK and P2PKH outputs for the given pubkey\n"
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
" sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n"
//original BitCoin "\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
"\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an DRKV/DRKP optionally followed by one\n"
"or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n"
"unhardened or hardened child keys.\n"
Expand Down Expand Up @@ -1658,7 +1656,6 @@ UniValue scantxoutset(const JSONRPCRequest& request)
UniValue unspent(UniValue::VOBJ);
unspent.pushKV("txid", outpoint.hash.GetHex());
unspent.pushKV("vout", (int32_t)outpoint.n);
//original BitCoin unspent.pushKV("scriptPubKey", HexStr(txo.scriptPubKey.begin(), txo.scriptPubKey.end()));
unspent.pushKV("scriptPubKey", HexStr(txo.scriptPubKey));
unspent.pushKV("amount", ValueFromAmount(txo.nValue));
unspent.pushKV("height", (int32_t)coin.nHeight);
Expand Down
28 changes: 3 additions & 25 deletions src/script/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <span.h>
#include <util/system.h>
//#include <util.h> //not PIVX
#include <utilstrencodings.h>

#include <memory>
Expand Down Expand Up @@ -232,7 +231,6 @@ class SingleKeyDescriptor final : public Descriptor

CScript P2PKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(pubkey.GetID()); }
CScript P2PKGetScript(const CPubKey& pubkey) { return GetScriptForRawPubKey(pubkey); }
//CScript P2WPKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(WitnessV0KeyHash(pubkey.GetID())); } //not PIVX

/** A parsed multi(...) descriptor. */
class MultisigDescriptor : public Descriptor
Expand Down Expand Up @@ -323,7 +321,6 @@ class ConvertorDescriptor : public Descriptor
};

CScript ConvertP2SH(const CScript& script) { return GetScriptForDestination(CScriptID(script)); }
//CScript ConvertP2WSH(const CScript& script) { return GetScriptForDestination(WitnessV0ScriptHash(script)); } //not PIVX

/** A parsed combo(P) descriptor. */
class ComboDescriptor final : public Descriptor
Expand Down Expand Up @@ -353,14 +350,6 @@ class ComboDescriptor final : public Descriptor
output_scripts = std::vector<CScript>{std::move(p2pk), std::move(p2pkh)};
out.pubkeys.emplace(keyid, key);
}
if (key.IsCompressed()) {
/* CScript p2wpkh = GetScriptForDestination(WitnessV0KeyHash(keyid)); //not PIVX
CScriptID p2wpkh_id(p2wpkh);
CScript p2sh_p2wpkh = GetScriptForDestination(p2wpkh_id);
out.scripts.emplace(p2wpkh_id, p2wpkh);
output_scripts.push_back(std::move(p2wpkh));
output_scripts.push_back(std::move(p2sh_p2wpkh));*/
}
return true;
}
};
Expand All @@ -372,7 +361,6 @@ class ComboDescriptor final : public Descriptor
enum class ParseScriptContext {
TOP,
P2SH,
// P2WSH, //not PIVX
};

/** Parse a constant. If succesful, sp is updated to skip the constant and return true. */
Expand Down Expand Up @@ -491,12 +479,12 @@ std::unique_ptr<Descriptor> ParseScript(Span<const char>& sp, ParseScriptContext
{
auto expr = Expr(sp);
if (Func("pk", expr)) {
auto pubkey = ParsePubkey(expr, true/*ctx != ParseScriptContext::P2WSH//not PIVX*/, out);
auto pubkey = ParsePubkey(expr, true, out);
if (!pubkey) return nullptr;
return std::make_unique<SingleKeyDescriptor>(std::move(pubkey), P2PKGetScript, "pk");
}
if (Func("pkh", expr)) {
auto pubkey = ParsePubkey(expr, true/*ctx != ParseScriptContext::P2WSH//not PIVX*/, out);
auto pubkey = ParsePubkey(expr, true, out);
if (!pubkey) return nullptr;
return std::make_unique<SingleKeyDescriptor>(std::move(pubkey), P2PKHGetScript, "pkh");
}
Expand All @@ -514,7 +502,7 @@ std::unique_ptr<Descriptor> ParseScript(Span<const char>& sp, ParseScriptContext
while (expr.size()) {
if (!Const(",", expr)) return nullptr;
auto arg = Expr(expr);
auto pk = ParsePubkey(arg, true/*ctx != ParseScriptContext::P2WSH//not PIVX*/, out);
auto pk = ParsePubkey(arg, true, out);
if (!pk) return nullptr;
script_size += pk->GetSize() + 1;
providers.emplace_back(std::move(pk));
Expand All @@ -528,21 +516,11 @@ std::unique_ptr<Descriptor> ParseScript(Span<const char>& sp, ParseScriptContext
}
return std::make_unique<MultisigDescriptor>(thres, std::move(providers));
}
/* if (ctx != ParseScriptContext::P2WSH && Func("wpkh", expr)) { //not PIVX
auto pubkey = ParsePubkey(expr, false, out);
if (!pubkey) return nullptr;
return std::make_unique<SingleKeyDescriptor>(std::move(pubkey), P2WPKHGetScript, "wpkh");
}*/
if (ctx == ParseScriptContext::TOP && Func("sh", expr)) {
auto desc = ParseScript(expr, ParseScriptContext::P2SH, out);
if (!desc || expr.size()) return nullptr;
return std::make_unique<ConvertorDescriptor>(std::move(desc), ConvertP2SH, "sh");
}
/* if (ctx != ParseScriptContext::P2WSH && Func("wsh", expr)) { //not PIVX
auto desc = ParseScript(expr, ParseScriptContext::P2WSH, out);
if (!desc || expr.size()) return nullptr;
return std::make_unique<ConvertorDescriptor>(std::move(desc), ConvertP2WSH, "wsh");
}*/
if (ctx == ParseScriptContext::TOP && Func("addr", expr)) {
CTxDestination dest = DecodeDestination(std::string(expr.begin(), expr.end()));
if (!IsValidDestination(dest)) return nullptr;
Expand Down

0 comments on commit b452fb6

Please sign in to comment.