mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
make sure strSpamUser is valid before using it to sign message
This commit is contained in:
parent
74470ebddb
commit
d2d64bfed2
13
src/main.cpp
13
src/main.cpp
@ -70,7 +70,7 @@ int64 nHPSTimerStart = 0;
|
||||
int64 nTransactionFee = 0;
|
||||
|
||||
string strSpamMessage = "Promoted posts are needed to run the network infrastructure. If you want to help, start generating blocks and advertise. [en]";
|
||||
string strSpamUser = "nobody"; // [MF] FIXME: authenticy check needed
|
||||
string strSpamUser = "nobody";
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -3581,14 +3581,15 @@ static bool CreateSpamMsgTx(CTransaction &txNew, std::vector<unsigned char> &sal
|
||||
std::string strUsername = strSpamUser;
|
||||
|
||||
CKeyID keyID;
|
||||
if( strSpamUser != "nobody" && !pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
||||
if( pwalletMain->vchDefaultKey.IsValid() ) {
|
||||
keyID = pwalletMain->vchDefaultKey.GetID();
|
||||
strUsername = pwalletMain->mapKeyMetadata[keyID].username;
|
||||
} else {
|
||||
if( strSpamUser != "nobody" ) {
|
||||
// check both wallet and block chain if they know about this user
|
||||
uint256 txid = SerializeHash(make_pair(strSpamUser,-1));
|
||||
if( !pblocktree->HaveTxIndex(txid) ||
|
||||
!pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
||||
strUsername = "nobody";
|
||||
}
|
||||
}
|
||||
|
||||
printf("CreateSpamMsgTx: keyId = %s\n", keyID.ToString().c_str() );
|
||||
|
||||
// compute message hash and sign it
|
||||
|
Loading…
x
Reference in New Issue
Block a user