mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
chore: drop debug printing of private keys to console stdout
Debug logs should not be printed to stdout, stderr exists for it. Private keys should not be printed to console by activation very general macros name "ENABLE_DASH_DEBUG". This macros is used only for hdchain private keys, the location util/system.h is too general for it. Functional test "tool_wallet.py" is failed due to unexpected output for tsan. It seems as easier to remove this logs due to too many issues with it rather than address all of them.
This commit is contained in:
parent
3f4b42caa4
commit
456e34c991
@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
|
|||||||
export CONTAINER_NAME=ci_native_cxx20
|
export CONTAINER_NAME=ci_native_cxx20
|
||||||
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
|
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
|
||||||
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
|
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
|
||||||
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
|
export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG"
|
||||||
export PYZMQ=true
|
export PYZMQ=true
|
||||||
export RUN_FUNCTIONAL_TESTS=false
|
export RUN_FUNCTIONAL_TESTS=false
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
|
@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
|
|||||||
export CONTAINER_NAME=ci_native_fuzz
|
export CONTAINER_NAME=ci_native_fuzz
|
||||||
export PACKAGES="clang llvm python3 libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev"
|
export PACKAGES="clang llvm python3 libevent-dev bsdmainutils libboost-filesystem-dev libboost-test-dev"
|
||||||
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
|
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
|
||||||
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
|
export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG"
|
||||||
export CXXFLAGS="-Werror -Wno-unused-command-line-argument -Wno-unused-value -Wno-deprecated-builtins"
|
export CXXFLAGS="-Werror -Wno-unused-command-line-argument -Wno-unused-value -Wno-deprecated-builtins"
|
||||||
export PYZMQ=true
|
export PYZMQ=true
|
||||||
export RUN_UNIT_TESTS=false
|
export RUN_UNIT_TESTS=false
|
||||||
|
@ -13,5 +13,5 @@ export TEST_RUNNER_EXTRA="--extended --exclude feature_pruning,feature_dbcrash,w
|
|||||||
export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down
|
export TEST_RUNNER_EXTRA="${TEST_RUNNER_EXTRA} --timeout-factor=4" # Increase timeout because sanitizers slow down
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-zmq --with-gui=no --with-sanitizers=thread CC=clang-16 CXX=clang++-16 CXXFLAGS='-g' --with-boost-process"
|
export BITCOIN_CONFIG="--enable-zmq --with-gui=no --with-sanitizers=thread CC=clang-16 CXX=clang++-16 CXXFLAGS='-g' --with-boost-process"
|
||||||
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
|
export CPPFLAGS="-DDEBUG_LOCKORDER -DARENA_DEBUG"
|
||||||
export PYZMQ=true
|
export PYZMQ=true
|
||||||
|
@ -34,17 +34,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// Debugging macros
|
|
||||||
|
|
||||||
// Uncomment the following line to enable debugging messages
|
|
||||||
// or enable on a per file basis prior to inclusion of util.h
|
|
||||||
//#define ENABLE_DASH_DEBUG
|
|
||||||
#ifdef ENABLE_DASH_DEBUG
|
|
||||||
#define DBG( x ) x
|
|
||||||
#else
|
|
||||||
#define DBG( x )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Dash only features
|
//Dash only features
|
||||||
|
|
||||||
extern bool fMasternodeMode;
|
extern bool fMasternodeMode;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/strencodings.h>
|
|
||||||
|
|
||||||
bool CHDChain::SetNull()
|
bool CHDChain::SetNull()
|
||||||
{
|
{
|
||||||
@ -41,33 +40,6 @@ bool CHDChain::IsCrypted() const
|
|||||||
return fCrypted;
|
return fCrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHDChain::Debug(const std::string& strName) const
|
|
||||||
{
|
|
||||||
DBG(
|
|
||||||
LOCK(cs);
|
|
||||||
std::cout << __func__ << ": ---" << strName << "---" << std::endl;
|
|
||||||
if (fCrypted) {
|
|
||||||
std::cout << "mnemonic: ***CRYPTED***" << std::endl;
|
|
||||||
std::cout << "mnemonicpassphrase: ***CRYPTED***" << std::endl;
|
|
||||||
std::cout << "seed: ***CRYPTED***" << std::endl;
|
|
||||||
} else {
|
|
||||||
std::cout << "mnemonic: " << std::string(vchMnemonic.begin(), vchMnemonic.end()).c_str() << std::endl;
|
|
||||||
std::cout << "mnemonicpassphrase: " << std::string(vchMnemonicPassphrase.begin(), vchMnemonicPassphrase.end()).c_str() << std::endl;
|
|
||||||
std::cout << "seed: " << HexStr(vchSeed).c_str() << std::endl;
|
|
||||||
|
|
||||||
CExtKey extkey;
|
|
||||||
extkey.SetSeed(vchSeed);
|
|
||||||
|
|
||||||
std::cout << "extended private masterkey: " << EncodeExtKey(extkey).c_str() << std::endl;
|
|
||||||
|
|
||||||
CExtPubKey extpubkey;
|
|
||||||
extpubkey = extkey.Neuter();
|
|
||||||
|
|
||||||
std::cout << "extended public masterkey: " << EncodeExtPubKey(extpubkey).c_str() << std::endl;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CHDChain::SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID)
|
bool CHDChain::SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID)
|
||||||
{
|
{
|
||||||
return SetMnemonic(SecureString(vchMnemonic.begin(), vchMnemonic.end()), SecureString(vchMnemonicPassphrase.begin(), vchMnemonicPassphrase.end()), fUpdateID);
|
return SetMnemonic(SecureString(vchMnemonic.begin(), vchMnemonic.end()), SecureString(vchMnemonicPassphrase.begin(), vchMnemonicPassphrase.end()), fUpdateID);
|
||||||
|
@ -98,8 +98,6 @@ public:
|
|||||||
void SetCrypted(bool fCryptedIn);
|
void SetCrypted(bool fCryptedIn);
|
||||||
bool IsCrypted() const;
|
bool IsCrypted() const;
|
||||||
|
|
||||||
void Debug(const std::string& strName) const;
|
|
||||||
|
|
||||||
bool SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID);
|
bool SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID);
|
||||||
bool SetMnemonic(const SecureString& ssMnemonic, const SecureString& ssMnemonicPassphrase, bool fUpdateID);
|
bool SetMnemonic(const SecureString& ssMnemonic, const SecureString& ssMnemonicPassphrase, bool fUpdateID);
|
||||||
bool GetMnemonic(SecureVector& vchMnemonicRet, SecureVector& vchMnemonicPassphraseRet) const;
|
bool GetMnemonic(SecureVector& vchMnemonicRet, SecureVector& vchMnemonicPassphraseRet) const;
|
||||||
|
@ -273,11 +273,6 @@ bool LegacyScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBat
|
|||||||
CHDChain hdChainCrypted;
|
CHDChain hdChainCrypted;
|
||||||
assert(GetHDChain(hdChainCrypted));
|
assert(GetHDChain(hdChainCrypted));
|
||||||
|
|
||||||
DBG(
|
|
||||||
tfm::format(std::cout, "EncryptWallet -- current seed: '%s'\n", HexStr(hdChainCurrent.GetSeed()));
|
|
||||||
tfm::format(std::cout, "EncryptWallet -- crypted seed: '%s'\n", HexStr(hdChainCrypted.GetSeed()));
|
|
||||||
);
|
|
||||||
|
|
||||||
// ids should match, seed hashes should not
|
// ids should match, seed hashes should not
|
||||||
assert(hdChainCurrent.GetID() == hdChainCrypted.GetID());
|
assert(hdChainCurrent.GetID() == hdChainCrypted.GetID());
|
||||||
assert(hdChainCurrent.GetSeedHash() != hdChainCrypted.GetSeedHash());
|
assert(hdChainCurrent.GetSeedHash() != hdChainCrypted.GetSeedHash());
|
||||||
@ -396,7 +391,6 @@ void LegacyScriptPubKeyMan::GenerateNewCryptedHDChain(const SecureString& secure
|
|||||||
|
|
||||||
// add default account
|
// add default account
|
||||||
hdChainTmp.AddAccount();
|
hdChainTmp.AddAccount();
|
||||||
hdChainTmp.Debug(__func__);
|
|
||||||
|
|
||||||
// We need to safe chain for validation further
|
// We need to safe chain for validation further
|
||||||
CHDChain hdChainPrev = hdChainTmp;
|
CHDChain hdChainPrev = hdChainTmp;
|
||||||
@ -409,17 +403,10 @@ void LegacyScriptPubKeyMan::GenerateNewCryptedHDChain(const SecureString& secure
|
|||||||
res = GetHDChain(hdChainCrypted);
|
res = GetHDChain(hdChainCrypted);
|
||||||
assert(res);
|
assert(res);
|
||||||
|
|
||||||
DBG(
|
|
||||||
tfm::format(std::cout, "GenerateNewCryptedHDChain -- current seed: '%s'\n", HexStr(hdChainTmp.GetSeed()));
|
|
||||||
tfm::format(std::cout, "GenerateNewCryptedHDChain -- crypted seed: '%s'\n", HexStr(hdChainCrypted.GetSeed()));
|
|
||||||
);
|
|
||||||
|
|
||||||
// ids should match, seed hashes should not
|
// ids should match, seed hashes should not
|
||||||
assert(hdChainPrev.GetID() == hdChainCrypted.GetID());
|
assert(hdChainPrev.GetID() == hdChainCrypted.GetID());
|
||||||
assert(hdChainPrev.GetSeedHash() != hdChainCrypted.GetSeedHash());
|
assert(hdChainPrev.GetSeedHash() != hdChainCrypted.GetSeedHash());
|
||||||
|
|
||||||
hdChainCrypted.Debug(__func__);
|
|
||||||
|
|
||||||
if (!SetHDChainSingle(hdChainCrypted, false)) {
|
if (!SetHDChainSingle(hdChainCrypted, false)) {
|
||||||
throw std::runtime_error(std::string(__func__) + ": SetHDChainSingle failed");
|
throw std::runtime_error(std::string(__func__) + ": SetHDChainSingle failed");
|
||||||
}
|
}
|
||||||
@ -438,7 +425,6 @@ void LegacyScriptPubKeyMan::GenerateNewHDChain(const SecureString& secureMnemoni
|
|||||||
|
|
||||||
// add default account
|
// add default account
|
||||||
newHdChain.AddAccount();
|
newHdChain.AddAccount();
|
||||||
newHdChain.Debug(__func__);
|
|
||||||
|
|
||||||
if (!SetHDChainSingle(newHdChain, false)) {
|
if (!SetHDChainSingle(newHdChain, false)) {
|
||||||
throw std::runtime_error(std::string(__func__) + ": SetHDChainSingle failed");
|
throw std::runtime_error(std::string(__func__) + ": SetHDChainSingle failed");
|
||||||
@ -518,7 +504,6 @@ bool LegacyScriptPubKeyMan::EncryptHDChain(const CKeyingMaterial& vMasterKeyIn,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
CHDChain cryptedChain = chain;
|
CHDChain cryptedChain = chain;
|
||||||
cryptedChain.Debug(__func__);
|
|
||||||
cryptedChain.SetCrypted(true);
|
cryptedChain.SetCrypted(true);
|
||||||
|
|
||||||
SecureVector vchSecureCryptedSeed(vchCryptedSeed.begin(), vchCryptedSeed.end());
|
SecureVector vchSecureCryptedSeed(vchCryptedSeed.begin(), vchCryptedSeed.end());
|
||||||
@ -595,7 +580,6 @@ bool LegacyScriptPubKeyMan::DecryptHDChain(const CKeyingMaterial& vMasterKeyIn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
hdChainRet.SetCrypted(false);
|
hdChainRet.SetCrypted(false);
|
||||||
hdChainRet.Debug(__func__);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4607,7 +4607,6 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, interfaces::C
|
|||||||
}
|
}
|
||||||
// add default account
|
// add default account
|
||||||
newHdChain.AddAccount();
|
newHdChain.AddAccount();
|
||||||
newHdChain.Debug(__func__);
|
|
||||||
} else {
|
} else {
|
||||||
if (gArgs.IsArgSet("-hdseed") && !IsHex(strSeed)) {
|
if (gArgs.IsArgSet("-hdseed") && !IsHex(strSeed)) {
|
||||||
walletInstance->WalletLogPrintf("%s -- Incorrect seed, generating a random mnemonic instead\n", __func__);
|
walletInstance->WalletLogPrintf("%s -- Incorrect seed, generating a random mnemonic instead\n", __func__);
|
||||||
|
Loading…
Reference in New Issue
Block a user