mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Introduce user getter to avoid null pointers
This commit is contained in:
parent
2f5d051394
commit
2a34dbdaa5
3 changed files with 7 additions and 1 deletions
|
|
@ -30,6 +30,10 @@
|
|||
//Thread local rpc user name for logging purposes
|
||||
boost::thread_specific_ptr<std::string> userInstance;
|
||||
|
||||
std::string getUser() {
|
||||
return (userInstance.get() ? *userInstance.get() : "UNDEFINED_USER");
|
||||
}
|
||||
|
||||
using namespace RPCServer;
|
||||
using namespace std;
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ extern std::string HelpRequiringPassphrase();
|
|||
extern std::string HelpExampleCli(const std::string& methodname, const std::string& args);
|
||||
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
|
||||
|
||||
extern std::string getUser();
|
||||
|
||||
extern void EnsureWalletIsUnlocked();
|
||||
|
||||
bool StartRPC();
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp)
|
|||
|
||||
SendMoney(address.Get(), nAmount, fSubtractFeeFromAmount, confidentiality_pubkey, wtx);
|
||||
|
||||
AuditLogPrintf("%s : sendtoaddress %s %d", *userInstance.get(), wtx.GetHash().GetHex(), nAmount);
|
||||
AuditLogPrintf("%s : sendtoaddress %s %d", getUser(), wtx.GetHash().GetHex(), nAmount);
|
||||
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue