From aa584522daabc08d97b2d4c85821a5875d2630e1 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 15 Sep 2017 11:39:07 +0200 Subject: [PATCH] Dash related changes for feefilter --- src/instantx.cpp | 4 +++- src/privatesend-client.cpp | 2 +- src/privatesend-server.cpp | 14 ++++++++------ src/privatesend.cpp | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index 7cd95298da..65249f383f 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -1205,7 +1205,9 @@ bool CTxLockCandidate::IsTimedOut() const void CTxLockCandidate::Relay(CConnman& connman) const { - connman.RelayTransaction(txLockRequest); + CFeeRate txFeeRate; + mempool.lookupFeeRate(txLockRequest.GetHash(), txFeeRate); + connman.RelayTransaction(txLockRequest, txFeeRate); std::map::const_iterator itOutpointLock = mapOutPointLocks.begin(); while(itOutpointLock != mapOutPointLocks.end()) { itOutpointLock->second.Relay(connman); diff --git a/src/privatesend-client.cpp b/src/privatesend-client.cpp index 58f1534d01..41c141ac35 100644 --- a/src/privatesend-client.cpp +++ b/src/privatesend-client.cpp @@ -419,7 +419,7 @@ bool CPrivateSendClient::SendDenominate(const std::vector& vecTxDSIn, c mempool.PrioritiseTransaction(tx.GetHash(), tx.GetHash().ToString(), 1000, 0.1*COIN); TRY_LOCK(cs_main, lockMain); - if(!lockMain || !AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, false, true, true)) { + if(!lockMain || !AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, NULL, false, true, true)) { LogPrintf("CPrivateSendClient::SendDenominate -- AcceptToMemoryPool() failed! tx=%s", tx.ToString()); UnlockCoins(); keyHolderStorage.ReturnAll(); diff --git a/src/privatesend-server.cpp b/src/privatesend-server.cpp index ebfa9faae8..e9a34d63f5 100644 --- a/src/privatesend-server.cpp +++ b/src/privatesend-server.cpp @@ -216,7 +216,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, std::string& strCommand, C LOCK(cs_main); CValidationState validationState; mempool.PrioritiseTransaction(tx.GetHash(), tx.GetHash().ToString(), 1000, 0.1*COIN); - if(!AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, false, true, true)) { + if(!AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, NULL, false, true, true)) { LogPrintf("DSVIN -- transaction not valid! tx=%s", tx.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_INVALID_TX, connman); return; @@ -343,7 +343,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman) TRY_LOCK(cs_main, lockMain); CValidationState validationState; mempool.PrioritiseTransaction(hashTx, hashTx.ToString(), 1000, 0.1*COIN); - if(!lockMain || !AcceptToMemoryPool(mempool, validationState, finalTransaction, false, NULL, false, true, true)) + if(!lockMain || !AcceptToMemoryPool(mempool, validationState, finalTransaction, false, NULL, NULL, false, true, true)) { LogPrintf("CPrivateSendServer::CommitFinalTransaction -- AcceptToMemoryPool() error: Transaction not valid\n"); SetNull(); @@ -446,11 +446,12 @@ void CPrivateSendServer::ChargeFees(CConnman& connman) CValidationState state; bool fMissingInputs; - if(!AcceptToMemoryPool(mempool, state, vecOffendersCollaterals[0], false, &fMissingInputs, false, true)) { + CFeeRate txFeeRate; + if(!AcceptToMemoryPool(mempool, state, vecOffendersCollaterals[0], false, &fMissingInputs, &txFeeRate, false, true)) { // should never really happen LogPrintf("CPrivateSendServer::ChargeFees -- ERROR: AcceptToMemoryPool failed!\n"); } else { - connman.RelayTransaction(vecOffendersCollaterals[0]); + connman.RelayTransaction(vecOffendersCollaterals[0], txFeeRate); } } } @@ -481,11 +482,12 @@ void CPrivateSendServer::ChargeRandomFees(CConnman& connman) CValidationState state; bool fMissingInputs; - if(!AcceptToMemoryPool(mempool, state, txCollateral, false, &fMissingInputs, false, true)) { + CFeeRate txFeeRate; + if(!AcceptToMemoryPool(mempool, state, txCollateral, false, &fMissingInputs, &txFeeRate, false, true)) { // should never really happen LogPrintf("CPrivateSendServer::ChargeRandomFees -- ERROR: AcceptToMemoryPool failed!\n"); } else { - connman.RelayTransaction(txCollateral); + connman.RelayTransaction(txCollateral, txFeeRate); } } } diff --git a/src/privatesend.cpp b/src/privatesend.cpp index a0129ae6d4..bd04e21da7 100644 --- a/src/privatesend.cpp +++ b/src/privatesend.cpp @@ -213,7 +213,7 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral) { LOCK(cs_main); CValidationState validationState; - if(!AcceptToMemoryPool(mempool, validationState, txCollateral, false, NULL, false, true, true)) { + if(!AcceptToMemoryPool(mempool, validationState, txCollateral, false, NULL, NULL, false, true, true)) { LogPrint("privatesend", "CPrivateSend::IsCollateralValid -- didn't pass AcceptToMemoryPool()\n"); return false; }