-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Remove hard-coded fee rules #3024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d8315d1
Remove include of windows.h from allocators.h
gavinandresen 862399b
Send multiple inv messages if mempool.size > MAX_INV_SZ
gavinandresen 0a13d82
Refactor: CTxMempool class to its own txmempool.{cpp,h}
gavinandresen 6c41293
Mempool refactors/cleanups
gavinandresen ba52fb9
Refactor: move GetValueIn(tx) to tx.GetValueIn()
gavinandresen 2f7b121
Add verbose flag to getrawmempool
gavinandresen e1bcce5
estimatefees JSON-RPC method
gavinandresen 7447138
Save/restore mempool
gavinandresen c26fd4a
New relay policy
gavinandresen 4ad2698
Refactor AllowFree(dPriority) --> CTransaction::dMinFreePriority
gavinandresen b6c79c3
remove GetMinFee, replace with mempool.estimate
gavinandresen cd89e8d
Un-harcode the "is dust" test, use mempool estimate of min fee
gavinandresen a5dc724
Remove CTransaction::nMinRelayTxFee
gavinandresen d3f8fef
Update release notes with fee changes
gavinandresen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,25 @@ | ||
| (note: this is a temporary file, to be added-to by anybody, and deleted at | ||
| release time) | ||
|
|
||
| Fee changes | ||
|
|
||
| Fee-handling code has been rewritten, so that transaction fees paid are adjusted | ||
| based on the transactions that miners are including in blocks instead of | ||
| being arbitrarily hard-coded. | ||
|
|
||
| RPC changes | ||
|
|
||
| getrawmempool : now has an optional 'verbose' boolean flag, if true | ||
| reports information on each memory pool transaction. | ||
|
|
||
| New RPC methods | ||
|
|
||
| estimatefees : Returns estimate of priority or fee needed to get | ||
| transactions accepted into blocks. | ||
|
|
||
| Command-line changes | ||
|
|
||
| -limitfreerelay and -minrelaytxfee options are obsolete. | ||
| They are replaced with dropping transactions that are unlikely | ||
| to be included in the next several blocks. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Copyright (c) 2009-2013 The Bitcoin developers | ||
| // Distributed under the MIT/X11 software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| #include "allocators.h" | ||
|
|
||
| #ifdef WIN32 | ||
| #ifdef _WIN32_WINNT | ||
| #undef _WIN32_WINNT | ||
| #endif | ||
| #define _WIN32_WINNT 0x0501 | ||
| #define WIN32_LEAN_AND_MEAN 1 | ||
| #ifndef NOMINMAX | ||
| #define NOMINMAX | ||
| #endif | ||
| #include <windows.h> | ||
| // This is used to attempt to keep keying material out of swap | ||
| // Note that VirtualLock does not provide this as a guarantee on Windows, | ||
| // but, in practice, memory that has been VirtualLock'd almost never gets written to | ||
| // the pagefile except in rare circumstances where memory is extremely low. | ||
| #else | ||
| #include <sys/mman.h> | ||
| #include <limits.h> // for PAGESIZE | ||
| #include <unistd.h> // for sysconf | ||
| #endif | ||
|
|
||
| /** Determine system page size in bytes */ | ||
| static inline size_t GetSystemPageSize() | ||
| { | ||
| size_t page_size; | ||
| #if defined(WIN32) | ||
| SYSTEM_INFO sSysInfo; | ||
| GetSystemInfo(&sSysInfo); | ||
| page_size = sSysInfo.dwPageSize; | ||
| #elif defined(PAGESIZE) // defined in limits.h | ||
| page_size = PAGESIZE; | ||
| #else // assume some POSIX OS | ||
| page_size = sysconf(_SC_PAGESIZE); | ||
| #endif | ||
| return page_size; | ||
| } | ||
|
|
||
| bool MemoryPageLocker::Lock(const void *addr, size_t len) | ||
| { | ||
| #ifdef WIN32 | ||
| return VirtualLock(const_cast<void*>(addr), len); | ||
| #else | ||
| return mlock(addr, len) == 0; | ||
| #endif | ||
| } | ||
|
|
||
| bool MemoryPageLocker::Unlock(const void *addr, size_t len) | ||
| { | ||
| #ifdef WIN32 | ||
| return VirtualUnlock(const_cast<void*>(addr), len); | ||
| #else | ||
| return munlock(addr, len) == 0; | ||
| #endif | ||
| } | ||
|
|
||
| LockedPageManager::LockedPageManager() : LockedPageManagerBase<MemoryPageLocker>(GetSystemPageSize()) | ||
| { | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,10 @@ | |
|
|
||
| #include <stdio.h> | ||
|
|
||
| /** No amount larger than this (in satoshi) is valid */ | ||
| static const int64 MAX_MONEY = 21000000 * COIN; | ||
| inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't similar functions in util.h or at least used there by our helper functions? |
||
|
|
||
| class CTransaction; | ||
|
|
||
| /** An outpoint - a combination of a transaction hash and an index n into its vout */ | ||
|
|
@@ -49,11 +53,11 @@ class COutPoint | |
| class CInPoint | ||
| { | ||
| public: | ||
| CTransaction* ptx; | ||
| const CTransaction* ptx; | ||
| unsigned int n; | ||
|
|
||
| CInPoint() { SetNull(); } | ||
| CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } | ||
| CInPoint(const CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } | ||
| void SetNull() { ptx = NULL; n = (unsigned int) -1; } | ||
| bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); } | ||
| }; | ||
|
|
@@ -143,19 +147,6 @@ class CTxOut | |
|
|
||
| uint256 GetHash() const; | ||
|
|
||
| bool IsDust(int64 nMinRelayTxFee) const | ||
| { | ||
| // "Dust" is defined in terms of CTransaction::nMinRelayTxFee, | ||
| // which has units satoshis-per-kilobyte. | ||
| // If you'd pay more than 1/3 in fees | ||
| // to spend something, then we consider it dust. | ||
| // A typical txout is 34 bytes big, and will | ||
| // need a CTxIn of at least 148 bytes to spend, | ||
| // so dust is a txout less than 54 uBTC | ||
| // (5460 satoshis) with default nMinRelayTxFee | ||
| return ((nValue*1000)/(3*((int)GetSerializeSize(SER_DISK,0)+148)) < nMinRelayTxFee); | ||
| } | ||
|
|
||
| friend bool operator==(const CTxOut& a, const CTxOut& b) | ||
| { | ||
| return (a.nValue == b.nValue && | ||
|
|
@@ -179,7 +170,7 @@ class CTransaction | |
| { | ||
| public: | ||
| static int64 nMinTxFee; | ||
| static int64 nMinRelayTxFee; | ||
| static double dMinFreePriority; | ||
| static const int CURRENT_VERSION=1; | ||
| int nVersion; | ||
| std::vector<CTxIn> vin; | ||
|
|
@@ -221,6 +212,11 @@ class CTransaction | |
| return (vin.size() == 1 && vin[0].prevout.IsNull()); | ||
| } | ||
|
|
||
| /** Returns sum of all outputs (note: does not include fees) */ | ||
| int64 GetValueOut() const; | ||
| // Note: GetValueIn is a method on CCoinsViewCache, because | ||
| // it requires looking up the values of previous inputs | ||
|
|
||
| friend bool operator==(const CTransaction& a, const CTransaction& b) | ||
| { | ||
| return (a.nVersion == b.nVersion && | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: call this GetSumValueOut()