wallet: Replace %w by wallet name in -walletnotify script

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
João Barbosa
2018-05-29 14:37:53 +01:00
parent 6196e93001
commit 9a5b5ee81f
4 changed files with 22 additions and 1 deletions

View File

@@ -835,6 +835,14 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
if (!strCmd.empty())
{
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
#ifndef WIN32
// Substituting the wallet name isn't currently supported on windows
// because windows shell escaping has not been implemented yet:
// https://github.com/bitcoin/bitcoin/pull/13339#issuecomment-537384875
// A few ways it could be implemented in the future are described in:
// https://github.com/bitcoin/bitcoin/pull/13339#issuecomment-461288094
boost::replace_all(strCmd, "%w", ShellEscape(GetName()));
#endif
std::thread t(runCommand, strCmd);
t.detach(); // thread runs free
}