aboutsummaryrefslogtreecommitdiff
path: root/src/core.h
AgeCommit message (Collapse)Author
2014-09-01Merge pull request #4737Pieter Wuille
31e9a83 Use CSizeComputer to avoid counting sizes in SerializationOp (Pieter Wuille) 84881f8 rework overhauled serialization methods to non-static (Kamil Domanski) 5d96b4a remove fields of ser_streamplaceholder (Kamil Domanski) 3d796f8 overhaul serialization code (Kamil Domanski)
2014-09-01Merge pull request #4779Wladimir J. van der Laan
093303a add missing header end comments (Philip Kaufmann)
2014-08-31Use CSizeComputer to avoid counting sizes in SerializationOpPieter Wuille
2014-08-31rework overhauled serialization methods to non-staticKamil Domanski
Thanks to Pieter Wuille for most of the work on this commit. I did not fixup the overhaul commit, because a rebase conflicted with "remove fields of ser_streamplaceholder". I prefer not to risk making a mistake while resolving it.
2014-08-31overhaul serialization codeKamil Domanski
The implementation of each class' serialization/deserialization is no longer passed within a macro. The implementation now lies within a template of form: template <typename T, typename Stream, typename Operation> inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) { size_t nSerSize = 0; /* CODE */ return nSerSize; } In cases when codepath should depend on whether or not we are just deserializing (old fGetSize, fWrite, fRead flags) an additional clause can be used: bool fRead = boost::is_same<Operation, CSerActionUnserialize>(); The IMPLEMENT_SERIALIZE macro will now be a freestanding clause added within class' body (similiar to Qt's Q_OBJECT) to implement GetSerializeSize, Serialize and Unserialize. These are now wrappers around the "SerializationOp" template.
2014-08-30changed field types in some structures to equivalent unambiguous typesKamil Domanski
Conflicts: src/core.cpp Rebased-By: Wladimir J. van der Laan Github-Pull: #4180
2014-08-28add missing header end commentsPhilip Kaufmann
- ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
2014-08-26Move `COIN` and `CENT` to core.hWladimir J. van der Laan
Eventually these should end up in `money.h` after monetary amounts are typedef'ed, but at least they don't belong in `util.h`.
2014-08-20Remove print() from core functionsWladimir J. van der Laan
Break dependency on util.
2014-07-21Revert "Relay double-spends, subject to anti-DOS"Wladimir J. van der Laan
This reverts commit d640a3ceab4f4372c2a0f738c1286cfde4b41b50.
2014-07-03Move fee policy out of coreGavin Andresen
2014-07-03Use fee/priority estimates in wallet CreateTransactionGavin Andresen
The wallet now uses the mempool fee estimator with a new command-line option: -txconfirmtarget (default: 1) instead of using hard-coded fees or priorities. A new bitcoind that hasn't seen enough transactions to estimate will fall back to the old hard-coded minimum priority or transaction fee. -paytxfee option overrides -txconfirmtarget. Relaying and mining code isn't changed. For Qt, the coin control dialog now uses priority estimates to label transaction priority (instead of hard-coded constants); unspent outputs were consistently labeled with a much higher priority than is justified by the free transactions actually being accepted into blocks. I did not implement any GUI for setting -txconfirmtarget; I would suggest getting rid of the "Pay transaction fee" GUI and replace it with either "target number of confirmations" or maybe a "faster confirmation <--> lower fee" slider or select box.
2014-06-27Relay double-spends, subject to anti-DOSTom Harding
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-22Code simplifications after CTransaction::GetHash() cachingPieter Wuille
2014-06-21Add CMutableTransaction and make CTransaction immutable.Pieter Wuille
In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
2014-06-06estimatefee / estimatepriority RPC methodsGavin Andresen
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-06Type-safe CFeeRate classGavin Andresen
Use CFeeRate instead of an int64_t for quantities that are fee-per-size. Helps prevent unit-conversion mismatches between the wallet, relaying, and mining code.
2014-05-20remove CTransaction::IsNewerThan which is never usedKamil Domanski
2014-02-24Merge pull request #3305 from mikehearn/fee_dropJeff Garzik
Drop fees by 10x due to the persistently higher exchange rate.
2013-11-30Add verbose boolean to getrawmempoolGavin Andresen
Also changes mempool to store CTxMemPoolEntries to keep track of when they enter/exit the pool.
2013-11-30Refactor: move GetValueIn(tx) to tx.GetValueIn()Gavin Andresen
GetValueIn makes more sense as a CTransaction member.
2013-11-26Drop fees by 10x due to the persistently higher exchange rate.Mike Hearn
The last fee drop was by 5x (from 50k satoshis to 10k satoshis) in the 0.8.2 release which was about 6 months ago. The current fee is (assuming a $500 exchange rate) about 5 dollar cents. The new fee after this patch is 0.5 cents. Miners who prefer the higher fees are obviously still able to use the command line flags to override this setting. Miners who choose to create smaller blocks will select the highest-fee paying transactions anyway. This would hopefully be the last manual adjustment ever required before floating fees become normal.
2013-11-10Move CCoins-related logic to coins.{cpp.h}Pieter Wuille
2013-11-10Cleanup code using forward declarations.Brandon Dahler
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
2013-10-28Generalize the remove-outputs check for fully-prunable transactions.Pieter Wuille
Instead of explicitly testing for the presence of any output, and dealing with this case specially, just interpret it as an empty CCoins. The case previously caught using the HaveCoins check, is now handled by the generic outs != outsBlock test.
2013-10-15Move CBlockLocator to core.hPieter Wuille
As CBlockLocator is a P2P data structure, and independent from the validation logic, it can be moved to core.
2013-09-24Skip unspendable outputs in consistency checkPieter Wuille
2013-07-10Prune provably-unspendable outputsPieter Wuille
2013-06-25Move core implementations to core.cppPieter Wuille
2013-06-23Moved CBlock from main.h to core.hEric Lombrozo
2013-06-11fix comment about dust logicCozz Lovan
2013-06-05Moved UpdateTime out of CBlockHeader and moved CBlockHeader into core.Eric Lombrozo
2013-06-05Moved CCoins, CTxOutCompressor, CTxInUndo, and CTxUndo to core.Eric Lombrozo
2013-06-05Removed AcceptToMemoryPool method from CTransaction. This method belongs to ↵Eric Lombrozo
the mempool instance. Removed AreInputsStandard from CTransaction, made it a regular function in main. Moved CTransaction::GetOutputFor to CCoinsViewCache. Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main. Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache. Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main. Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core. Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
2013-06-05Moved CInPoint to core. Removed GetMinFee from CTransaction and made it a ↵Eric Lombrozo
regular function in main.
2013-06-05Created core.h/core.cpp, added to makefiles. Started moving core structures ↵Eric Lombrozo
from main to core beginning with COutPoint.