Commit graph

620 commits

Author SHA1 Message Date
Gavin Andresen f60e49d49c Merge pull request #3694 from gavinandresen/vfspent
Remove CWalletTx::vfSpent
2014-02-28 15:16:25 -05:00
Gavin Andresen e3e65d29b7 Merge pull request #3735 from laanwj/2014_02_remove_PRIx64_completely
Remove PRIx64 usage completely
2014-02-26 12:16:03 -05: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
Jeff Garzik beabca2be0 Merge pull request #3305 from mikehearn/fee_drop
Drop fees by 10x due to the persistently higher exchange rate.
2014-02-24 14:05:54 -05:00
Wladimir J. van der Laan f48742c2bf Get rid of C99 PRI?64 usage in source files
Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h
indirectly, so we cannot fix this with just macros.

Trivial commit: apply the following script to all .cpp and .h files:

    # Middle
    sed -i 's/"PRIx64"/x/g' "$1"
    sed -i 's/"PRIu64"/u/g' "$1"
    sed -i 's/"PRId64"/d/g' "$1"
    # Initial
    sed -i 's/PRIx64"/"x/g' "$1"
    sed -i 's/PRIu64"/"u/g' "$1"
    sed -i 's/PRId64"/"d/g' "$1"
    # Trailing
    sed -i 's/"PRIx64/x"/g' "$1"
    sed -i 's/"PRIu64/u"/g' "$1"
    sed -i 's/"PRId64/d"/g' "$1"

After this commit, `git grep` for PRI.64 should turn up nothing except
the defines in util.h.
2014-02-24 09:08:56 +01:00
Wladimir J. van der Laan d5f1e727a8 Don't use PRIx64 formatting derives from inttypes.h
As the tinyformat-based formatting system (introduced in b77dfdc) is
type-safe, no special format characters are needed to specify sizes.

Tinyformat can support (ignore) the C99 prefixes such as "ll" but
chokes on MSVC's inttypes.h defines prefixes such as "I64X". So don't
include inttypes.h and define our own for compatibility.

(an alternative would be to sweep the entire codebase using sed -i to
get rid of the size specifiers but this has less diff impact)
2014-02-22 11:36:37 +01:00
Wladimir J. van der Laan 76a77059f3
Merge pull request #2910
d8b4b49 Don't store or send side-chain blocks lower than last checkpoint. (Ashley Holman)
2014-02-20 12:32:32 +01:00
Wladimir J. van der Laan 047ee427e7
Merge pull request #3666
bbfce8a fix non-standard reason string in main.cpp (Philip Kaufmann)
2014-02-17 13:59:50 +01:00
Wladimir J. van der Laan b8d9058a4d
Merge pull request #3646
5770254 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does. (gubatron)
2014-02-16 11:44:48 +01:00
Gavin Andresen 2b72d46f42 Handle "conflicted" transactions properly
Extend CMerkleTx::GetDepthInMainChain with the concept of
a "conflicted" transaction-- a transaction generated by the wallet
that is not in the main chain or in the mempool, and, therefore,
will likely never be confirmed.

GetDepthInMainChain() now returns -1 for conflicted transactions
(0 for unconfirmed-but-in-the-mempool, and >1 for confirmed).

This makes getbalance, getbalance '*', and listunspent all agree when there are
mutated transactions in the wallet.

Before:
 listunspent: one 49BTC output
 getbalance: 96 BTC (change counted twice)
 getbalance '*': 46 BTC (spends counted twice)

After: all agree, 49 BTC available to spend.
2014-02-14 11:08:40 -05:00
Philip Kaufmann bbfce8a4c9 fix non-standard reason string in main.cpp 2014-02-13 15:12:18 +01:00
Pieter Wuille 87fe71e1fc Add HasCanonicalPushes(), and use it in IsStandardTx 2014-02-11 21:11:59 +01:00
gubatron 57702541a2 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014.
contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
2014-02-09 21:06:06 -05:00
Pieter Wuille bbde1e99c8 Limit the number of orphan blocks
In case the total number of orphan blocks in memory exceeds a limit
(currently set to 750), a random orphan block (which is not
depended on by another orphan block) is dropped. This means it will
need to be downloaded again, but it won't consume memory until then.
2014-01-31 14:16:06 +01:00
Wladimir J. van der Laan 19007cf552
Merge pull request #3592
c117d9e Support for error messages and a few more rejection reasons (Luke Dashjr)
14e7ffc Use standard BIP 22 rejection reasons where applicable (Luke Dashjr)
2014-01-30 16:45:26 +01:00
Gavin Andresen 3581abdd46 Merge pull request #3370 from sipa/headersfirst3
Prepare block connection logic for headers-first
2014-01-29 13:49:15 -08:00
Luke Dashjr c117d9e93a Support for error messages and a few more rejection reasons 2014-01-29 17:39:24 +00:00
Luke Dashjr 14e7ffcc64 Use standard BIP 22 rejection reasons where applicable 2014-01-29 17:39:18 +00:00
Philip Kaufmann b34e88a88f use english for all reason strings in IsStandardTx() 2014-01-28 07:45:42 +01:00
Pieter Wuille 75f51f2a63 Prepare block connection logic for headers-first.
This changes the block processing logic from "try to atomically switch
to a new block" to a continuous "(dis)connect a block, aiming for the
assumed best chain".

This means the smallest atomic operations on the chainstate become
individual block connections or disconnections, instead of entire
reorganizations. It may mean that we try to reorganize to one block,
fail, and rereorganize again to the old block. This is slower, but
doesn't require unbounded RAM.

It also means that a ConnectBlock which fails may be no longer called
from the ProcessBlock which knows which node sent it. To deal with that,
a mapBlockSource is kept, and invalid blocks cause asynchronous "reject"
messages and banning (if necessary).
2014-01-27 21:20:41 +01:00
Pieter Wuille 0ec16f35d6 Move only: extract WriteChainState and UpdatedTip from SetBestChain. 2014-01-27 21:13:48 +01:00
Peter Todd 665bdd3bc9
Fix off-by-one errors in use of IsFinalTx()
Previously CreateNewBlock() didn't take into account the fact that
IsFinalTx() without any arguments tests if the transaction is considered
final in the *current* block, when both those functions really needed to
know if the transaction would be final in the *next* block.

Additionally the UI had a similar misunderstanding.

Also adds some basic tests to check that CreateNewBlock() is in fact
mining nLockTime-using transactions correctly.

Thanks to Wladimir J. van der Laan for rebase.
2014-01-26 21:50:15 -05:00
Wladimir J. van der Laan 7d9d134bf9 Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing
actual std::string objects.

Remove unnecessary c_str calls (236 of them) in logging and formatting.
2014-01-23 16:05:01 +01:00
Wladimir J. van der Laan b77dfdc9e3 Typesafe strprintf/error/LogPrint functions
Switch to tinyformat-based formatting.

Tinyformat is a typesafe drop-in replacement for C99 printf functions:
https://github.com/c42f/tinyformat
2014-01-23 16:05:00 +01:00
Ashley Holman d8b4b49667 Don't store or send side-chain blocks lower than last checkpoint. 2014-01-19 18:15:38 -06:00
Wladimir J. van der Laan 6c19ca1f92
Merge pull request #3490
7e08e29 better std::exception logging for block/undo files (Philip Kaufmann)
2014-01-18 12:25:05 +01:00
Pieter Wuille da0fecffa7 Store orphan blocks in serialized form 2014-01-11 23:39:29 +01:00
Philip Kaufmann 7e08e29117 better std::exception logging for block/undo files 2014-01-06 15:09:26 +01:00
Wladimir J. van der Laan 7aedb91476
Merge pull request #3401
012ca1c LoadWallet: acquire cs_wallet mutex before clearing setKeyPool (Wladimir J. van der Laan)
9569168 Document cs_wallet lock and add AssertLockHeld (Wladimir J. van der Laan)
19a5676 Use mutex pointer instead of name for AssertLockHeld (Wladimir J. van der Laan)
2014-01-06 10:34:01 +01:00
Wladimir J. van der Laan 19a5676280 Use mutex pointer instead of name for AssertLockHeld
This makes it useable for non-global locks such as the wallet and
keystore locks.
2013-12-19 09:46:11 +01:00
Wladimir J. van der Laan cd7fa8bb43 Move nTransactionFee from main.cpp to wallet.cpp
Transaction fee is only used by the wallet.
No need for it to be in main.cpp.
2013-12-13 16:34:57 +01:00
Pieter Wuille b2864d2fb3 Add main-specific node state 2013-12-08 14:51:37 +01:00
Gregory Maxwell 9b59e3bda8 Sanitize assert usage and refuse to compile with NDEBUG.
There were quite a few places where assert() was used with side effects,
 making operation with NDEBUG non-functional.  This commit fixes all the
 cases I know about, but also adds an  #error on NDEBUG because the code
 is untested without assertions and may still have vulnerabilities if
 used without assert.
2013-12-02 11:33:44 -08:00
Gavin Andresen a65edb104d Merge pull request #3329 from gavinandresen/syncdebug
mutex debugging routines: LocksHeld() and AssertLockHeld()
2013-12-01 17:43:37 -08: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
Gavin Andresen 0733c1bde6 Refactor: move GetValueIn(tx) to tx.GetValueIn()
GetValueIn makes more sense as a CTransaction member.
2013-11-30 15:42:10 +10:00
Gavin Andresen 98c7c8fd1d Remove dead transaction replacement code
This dead code can be resurrected from git history if
transaction replacement is ever implemented. Keeping
dead code in the source is a bad idea, because it implies
it was tested and worked at some point, which is not true.
2013-11-30 15:42:10 +10:00
Gavin Andresen c649637b6c mutex debugging routines: LocksHeld() and AssertLockHeld() 2013-11-29 17:46:19 +10:00
Mike Hearn a946aa8d3e Store and use a sanitized subVer 2013-11-26 13:26:00 +01:00
Mike Hearn ba6a4ea344 Add some additional logging to give extra network insight. 2013-11-26 13:26:00 +01:00
Mike Hearn 6a4c196dd6 Drop fees by 10x due to the persistently higher exchange rate.
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-26 15:56:28 +04:00
Julian Langschaedel 848fe68acd cleanup error message consistency
relicts from the CTransaction refactor.
2013-11-22 02:19:18 +01:00
Wladimir J. van der Laan d980f9b7d6
Merge pull request #3257
379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
2013-11-20 16:18:33 +01:00
Philip Kaufmann 379778bde6 core: remove includes in .cpp, if header is already in .h
- example: if util.h includes stdint.h, remove it from util.cpp, as
  util.h is the first header included in util.cpp
2013-11-15 12:20:16 +01:00
Cozz Lovan 8dfd8c62dc pass nBytes as parameter to GetMinFee(..) 2013-11-14 14:25:04 +01:00
Philip Kaufmann cd696e64df misc small changes to polish after include cleanup 2013-11-11 16:20:39 +01:00
Gavin Andresen 7d7df381f8 Merge pull request #3199 from sipa/mempoolmove
Cleanup refactoring of coins/mempool
2013-11-10 18:09:58 -08:00
Gavin Andresen 358ce2664d New reject p2p message 2013-11-11 10:31:08 +10:00
Pieter Wuille a0fa20a12b Move CCoins-related logic to coins.{cpp.h} 2013-11-10 19:37:56 +01:00
Pieter Wuille 84674082b0 Make CCoinsView use block hashes instead of indices 2013-11-10 19:22:53 +01:00