mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 15:27:57 +00:00
replace HaveTxIndex for GetTransaction. this is a more secure check since it also
verifies if tx is part of current main chain. old test may cause problems for people trying to reregister their usernames in case of reversal attack since nodes might incorrectly refuse to accept/retransmit the new transaction.
This commit is contained in:
parent
bfbe583ff4
commit
19ff320d24
@ -8,7 +8,7 @@
|
|||||||
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 05
|
#define CLIENT_VERSION_REVISION 06
|
||||||
#define CLIENT_VERSION_BUILD 0
|
#define CLIENT_VERSION_BUILD 0
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -493,8 +493,9 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFr
|
|||||||
|
|
||||||
{
|
{
|
||||||
// do we already have it?
|
// do we already have it?
|
||||||
uint256 txid = SerializeHash(make_pair(tx.GetUsername(),-1));
|
CTransaction txOld;
|
||||||
if( pblocktree->HaveTxIndex(txid) &&
|
uint256 hashBlock = 0;
|
||||||
|
if( GetTransaction(tx.GetUsername(), txOld, hashBlock) &&
|
||||||
// duplicate should be discarded but replacement is allowed.
|
// duplicate should be discarded but replacement is allowed.
|
||||||
!verifyDuplicateOrReplacementTx(tx, false, true) ) {
|
!verifyDuplicateOrReplacementTx(tx, false, true) ) {
|
||||||
return false;
|
return false;
|
||||||
@ -3608,8 +3609,9 @@ static bool CreateSpamMsgTx(CTransaction &txNew, std::vector<unsigned char> &sal
|
|||||||
CKeyID keyID;
|
CKeyID keyID;
|
||||||
if( strSpamUser != "nobody" ) {
|
if( strSpamUser != "nobody" ) {
|
||||||
// check both wallet and block chain if they know about this user
|
// check both wallet and block chain if they know about this user
|
||||||
uint256 txid = SerializeHash(make_pair(strSpamUser,-1));
|
CTransaction txOld;
|
||||||
if( !pblocktree->HaveTxIndex(txid) ||
|
uint256 hashBlock = 0;
|
||||||
|
if( !GetTransaction(strSpamUser, txOld, hashBlock) ||
|
||||||
!pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
!pwalletMain->GetKeyIdFromUsername(strSpamUser, keyID) ) {
|
||||||
strUsername = "nobody";
|
strUsername = "nobody";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user