Browse Source

Merge #8287: [wallet] Set fLimitFree = true

fa8b02d [rpc] rawtx: Prepare fLimitFree to make it an option (MarcoFalke)
fa28bfa [wallet] Set fLimitFree = true (MarcoFalke)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
e10af96cf4
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 3
      src/rpc/rawtransaction.cpp
  2. 9
      src/wallet/wallet.cpp
  3. 2
      src/wallet/wallet.h

3
src/rpc/rawtransaction.cpp

@ -874,6 +874,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
uint256 hashTx = tx.GetHash(); uint256 hashTx = tx.GetHash();
bool fLimitFree = false;
CAmount nMaxRawTxFee = maxTxFee; CAmount nMaxRawTxFee = maxTxFee;
if (params.size() > 1 && params[1].get_bool()) if (params.size() > 1 && params[1].get_bool())
nMaxRawTxFee = 0; nMaxRawTxFee = 0;
@ -886,7 +887,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
// push to local node and sync with wallets // push to local node and sync with wallets
CValidationState state; CValidationState state;
bool fMissingInputs; bool fMissingInputs;
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, false, nMaxRawTxFee)) { if (!AcceptToMemoryPool(mempool, state, tx, fLimitFree, &fMissingInputs, false, nMaxRawTxFee)) {
if (state.IsInvalid()) { if (state.IsInvalid()) {
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason())); throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
} else { } else {

9
src/wallet/wallet.cpp

@ -1463,7 +1463,7 @@ void CWallet::ReacceptWalletTransactions()
CWalletTx& wtx = *(item.second); CWalletTx& wtx = *(item.second);
LOCK(mempool.cs); LOCK(mempool.cs);
wtx.AcceptToMemoryPool(false, maxTxFee); wtx.AcceptToMemoryPool(maxTxFee);
} }
} }
@ -2502,8 +2502,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CCon
if (fBroadcastTransactions) if (fBroadcastTransactions)
{ {
// Broadcast // Broadcast
if (!wtxNew.AcceptToMemoryPool(false, maxTxFee)) if (!wtxNew.AcceptToMemoryPool(maxTxFee)) {
{
// This must not fail. The transaction has already been signed and recorded. // This must not fail. The transaction has already been signed and recorded.
LogPrintf("CommitTransaction(): Error: Transaction not valid\n"); LogPrintf("CommitTransaction(): Error: Transaction not valid\n");
return false; return false;
@ -3652,8 +3651,8 @@ int CMerkleTx::GetBlocksToMaturity() const
} }
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, CAmount nAbsurdFee) bool CMerkleTx::AcceptToMemoryPool(const CAmount& nAbsurdFee)
{ {
CValidationState state; CValidationState state;
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, false, nAbsurdFee); return ::AcceptToMemoryPool(mempool, state, *this, true, NULL, false, nAbsurdFee);
} }

2
src/wallet/wallet.h

@ -215,7 +215,7 @@ public:
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; } bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; }
int GetBlocksToMaturity() const; int GetBlocksToMaturity() const;
/** Pass this transaction to the mempool. Fails if absolute fee exceeds absurd fee. */ /** Pass this transaction to the mempool. Fails if absolute fee exceeds absurd fee. */
bool AcceptToMemoryPool(bool fLimitFree, const CAmount nAbsurdFee); bool AcceptToMemoryPool(const CAmount& nAbsurdFee);
bool hashUnset() const { return (hashBlock.IsNull() || hashBlock == ABANDON_HASH); } bool hashUnset() const { return (hashBlock.IsNull() || hashBlock == ABANDON_HASH); }
bool isAbandoned() const { return (hashBlock == ABANDON_HASH); } bool isAbandoned() const { return (hashBlock == ABANDON_HASH); }
void setAbandoned() { hashBlock = ABANDON_HASH; } void setAbandoned() { hashBlock = ABANDON_HASH; }

Loading…
Cancel
Save