Skip to content

Commit

Permalink
Merge pull request #594 from UdjinM6/fix_conflicted_dstx
Browse files Browse the repository at this point in the history
Fix: dstx stuck sometimes
  • Loading branch information
evan82 committed Sep 2, 2015
2 parents 33f1d03 + be14946 commit b3d0f80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
unsigned int nSize = entry.GetTxSize();

// Don't accept it if it can't get into a block
if(!ignoreFees){
// but prioritise dstx and don't check fees for it
if(mapDarksendBroadcastTxes.count(hash)) {
mempool.PrioritiseTransaction(hash, hash.ToString(), 1000, 0.1*COIN);
} else if(!ignoreFees){
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
if (fLimitFree && nFees < txMinFee)
return state.DoS(0, error("AcceptToMemoryPool : not enough fees %s, %d < %d",
Expand Down Expand Up @@ -1187,7 +1190,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}

bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs, bool fRejectInsaneFee, bool ignoreFees)
bool* pfMissingInputs, bool fRejectInsaneFee, bool isDSTX)
{
AssertLockHeld(cs_main);
if (pfMissingInputs)
Expand Down Expand Up @@ -1306,7 +1309,10 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransact
unsigned int nSize = entry.GetTxSize();

// Don't accept it if it can't get into a block
if(!ignoreFees){
// but prioritise dstx and don't check fees for it
if(isDSTX) {
mempool.PrioritiseTransaction(hash, hash.ToString(), 1000, 0.1*COIN);
} else { // same as !ignoreFees for AcceptToMemoryPool
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
if (fLimitFree && nFees < txMinFee)
return state.DoS(0, error("AcceptableInputs : not enough fees %s, %d < %d",
Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
bool* pfMissingInputs, bool fRejectInsaneFee=false, bool ignoreFees=false);

bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs, bool fRejectInsaneFee=false, bool ignoreFees=false);
bool* pfMissingInputs, bool fRejectInsaneFee=false, bool isDSTX=false);

int GetInputAge(CTxIn& vin);
int GetInputAgeIX(uint256 nTXHash, CTxIn& vin);
Expand Down

0 comments on commit b3d0f80

Please sign in to comment.