Commit graph

20 commits

Author SHA1 Message Date
Wladimir J. van der Laan 8bdd2877c4
Fix a few "Uninitialized scalar field" warnings
Fix a few warnings reported by Coverity.
None of these is critical, but making sure that class fields are
initialized can avoid heisenbugs.
2014-08-28 15:30:50 +02:00
Pieter Wuille 3da58b216b
Merge pull request #4748
ad49c25 Split up util.cpp/h (Wladimir J. van der Laan)
f841aa2 Move `COIN` and `CENT` to core.h (Wladimir J. van der Laan)
6e5fd00 Move `*Version()` functions to version.h/cpp (Wladimir J. van der Laan)
b4aa769 Move `S_I*` constants and `MSG_NOSIGNAL` to compat.h (Wladimir J. van der Laan)
af8297c Move functions in wallet.h to implementation file (Wladimir J. van der Laan)
651480c move functions in main and net to implementation files (Wladimir J. van der Laan)
610a8c0 Move SetThreadPriority implementation to util.cpp instead of the header (Wladimir J. van der Laan)
f780e65 Remove unused function `ByteReverse` from util.h (Wladimir J. van der Laan)
121d6ad Remove unused `alignup` function from util.h (Wladimir J. van der Laan)
d1e26d4 Move CMedianFilter to timedata.cpp (Wladimir J. van der Laan)
2014-08-26 16:57:05 +02:00
Wladimir J. van der Laan ad49c256c3 Split up util.cpp/h
Split up util.cpp/h into:

- string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach)
- money utilities (parsesmoney, formatmoney)
- time utilities (gettime*, sleep, format date):
- and the rest (logging, argument parsing, config file parsing)

The latter is basically the environment and OS handling,
and is stripped of all utility functions, so we may want to
rename it to something else than util.cpp/h for clarity (Matt suggested
osinterface).

Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26 13:25:22 +02:00
Daniel Kraft d0867acb0e Use const CCoinsView's at some places.
At some places where it is possible (e. g., CheckInputs), use a const
version of CCoinsView instead of a non-const one.
2014-08-26 11:29:18 +02:00
Daniel Kraft a3dc587a62 Make appropriate getter-routines "const" in CCoinsView.
Mark the "Get"/"Have" routines in CCoinsView and subclasses as "const".
2014-08-26 11:29:18 +02:00
Jeff Garzik 6f2c26a457 Closely track mempool byte total. Add "getmempoolinfo" RPC.
Goal:  Gain live insight into the mempool.  Groundwork for future work
that caps mempool size.
2014-08-14 12:34:38 -04:00
Alex Morcos e59441f086 Process fee estimate file into temporary vector first to let sanity checking complete. 2014-07-29 13:58:08 -04:00
Alex Morcos 961ae93c85 Fix minor bug which only affected log messages. 2014-07-28 10:52:54 -04:00
Alex Morcos 17f15678d3 Fixed a bug with index bounds checking 2014-07-27 21:41:13 -04:00
Pieter Wuille ad08d0b95b Bugfix: make CCoinsViewMemPool support pruned entries in underlying cache 2014-07-23 15:40:52 +02:00
Wladimir J. van der Laan 98e84aae7a Revert "Relay double-spends, subject to anti-DOS"
This reverts commit d640a3ceab.
2014-07-21 07:46:34 +02:00
Gavin Andresen 13fc83c77b
Move fee policy out of core 2014-07-03 14:42:16 -04:00
Gavin Andresen 4b7b1bb1ac
Sanity checks for estimates
Require at least 11 samples before giving fee/priority estimates.

And have wallet-created transactions go throught the fee-sanity-check
code path.
2014-07-03 13:44:56 -04:00
Tom Harding d640a3ceab Relay double-spends, subject to anti-DOS
Allows network wallets and other clients to see transactions that respend
a prevout already spent in an unconfirmed transaction in this node's mempool.

Knowledge of an attempted double-spend is of interest to recipients of the
first spend.  In some cases, it will allow these recipients to withhold
goods or services upon being alerted of a double-spend that deprives them
of payment.

As before, respends are not added to the mempool.

Anti-Denial-of-Service-Attack provisions:
 - Use a bloom filter to relay only one respend per mempool prevout
 - Rate-limit respend relays to a default of 100 thousand bytes/minute
 - Define tx2.IsEquivalentTo(tx1): equality when scriptSigs are not considered
 - Do not relay these equivalent transactions

Remove an unused variable declaration in txmempool.cpp.
2014-06-27 07:54:21 -07:00
Luke Dashjr 2a72d4591f JSON-RPC method: prioritisetransaction <txid> <priority delta> <priority tx fee>
Accepts the transaction into mined blocks at a higher (or lower) priority
2014-06-26 11:49:46 +00:00
Gavin Andresen 171ca7745e estimatefee / estimatepriority RPC methods
New RPC methods: return an estimate of the fee (or priority) a
transaction needs to be likely to confirm in a given number of
blocks.

Mike Hearn created the first version of this method for estimating fees.
It works as follows:

For transactions that took 1 to N (I picked N=25) blocks to confirm,
keep N buckets with at most 100 entries in each recording the
fees-per-kilobyte paid by those transactions.

(separate buckets are kept for transactions that confirmed because
they are high-priority)

The buckets are filled as blocks are found, and are saved/restored
in a new fee_estiamtes.dat file in the data directory.

A few variations on Mike's initial scheme:

To estimate the fee needed for a transaction to confirm in X buckets,
all of the samples in all of the buckets are used and a median of
all of the data is used to make the estimate. For example, imagine
25 buckets each containing the full 100 entries. Those 2,500 samples
are sorted, and the estimate of the fee needed to confirm in the very
next block is the 50'th-highest-fee-entry in that sorted list; the
estimate of the fee needed to confirm in the next two blocks is the
150'th-highest-fee-entry, etc.

That algorithm has the nice property that estimates of how much fee
you need to pay to get confirmed in block N will always be greater
than or equal to the estimate for block N+1. It would clearly be wrong
to say "pay 11 uBTC and you'll get confirmed in 3 blocks, but pay
12 uBTC and it will take LONGER".

A single block will not contribute more than 10 entries to any one
bucket, so a single miner and a large block cannot overwhelm
the estimates.
2014-06-06 10:44:57 -04:00
Gavin Andresen 93a18a3650 Remove CWalletTx::vfSpent
Use the spent outpoint multimap to figure out which wallet transaction
outputs are unspent, instead of a vfSpent array that is saved
to disk.
2014-02-26 11:53:51 -05:00
Gavin Andresen 4d707d5120 Add verbose boolean to getrawmempool
Also changes mempool to store CTxMemPoolEntries
to keep track of when they enter/exit the pool.
2013-11-30 15:42:10 +10:00
Pieter Wuille a0fa20a12b Move CCoins-related logic to coins.{cpp.h} 2013-11-10 19:37:56 +01:00
Gavin Andresen 319b11607f Refactor: CTxMempool class to its own txmempool.{cpp,h} 2013-11-04 11:27:02 +10:00