Commit graph

2224 commits

Author SHA1 Message Date
Pieter Wuille
487db8a2b1 Make test_bitcoin run in a temp datadir 2012-11-29 22:09:16 +01:00
Pieter Wuille
597fa4cd63 Add GetTempPath() to util 2012-11-29 01:00:35 +01:00
Jeff Garzik
e6955d0411 New 'checkpoints' option should default to true. 2012-11-28 12:10:57 -05:00
Jeff Garzik
857b3ad923 Add "checkpoints" option, to permit disabling of checkpoint logic. 2012-11-28 12:07:42 -05:00
Wladimir J. van der Laan
5c37be2db6 Merge pull request #2044 from Diapolo/backupwallet
do not silently ignore errors on "backupwallet" RPC cmd
2012-11-27 23:41:50 -08:00
Philip Kaufmann
f82102121f split of createTrayIconMenu() from createTrayIcon() in BitcoinGUI
- this allows to setup the trayicon before we have and want a trayicon menu
- should be of great use, when we remove that splash screen
- fixes a small bug with the toggleHideAction icon, which is not only used with
  trayicon but also with the Mac dock
2012-11-27 22:20:43 +01:00
Pieter Wuille
0c50d8b007 Merge pull request #2006 from robbak/make-leveldb-macro
Change 'make' to $(MAKE) in leveldb make command line
2012-11-27 12:49:37 -08:00
Philip Kaufmann
ad525e9c8f do not silently ignore errors on "backupwallet" RPC cmd 2012-11-27 16:27:54 +01:00
Luke Dashjr
2646080e3d Allow -printpriority without -debug 2012-11-26 16:30:54 +00:00
Philip Kaufmann
5350ea4171 update CClientUIInterface and remove orphan Wx stuff
- fix ThreadSafeMessageBox always displays error icon
- allow to specify MSG_ERROR / MSG_WARNING or MSG_INFORMATION without a
  custom caption / title
- allow to specify CClientUIInterface::ICON_ERROR / ICON_WARNING and
  ICON_INFORMATION (which is default) as message box icon
- remove CClientUIInterface::OK from ThreadSafeMessageBox-calls, as
  the OK button will be set as default, if none is specified
- prepend "Bitcoin - " to used captions
- rename BitcoinGUI::error() -> BitcoinGUI::message() and add function
  documentation
- change all style parameters and enum flags to unsigned
- update code to use that new API

- update Client- and WalletModel to use new BitcoinGUI::message() and
  rename the classes error() method into message()
- include the possibility to supply the wanted icon for messages from
  Client- and WalletModel via "style" parameter
2012-11-26 13:32:31 +01:00
Pieter Wuille
231b399952 Bugfix: remove conflicting transactions from memory pool
When a transaction A is in the memory pool, while a transaction B
(which shares an input with A) gets accepted into a block, A was
kept forever in the memory pool.

This commit adds a CTxMemPool::removeConflicts method, which
removes transactions that conflict with a given transaction, and
all their children.

This results in less transactions in the memory pool, and faster
construction of new blocks.
2012-11-25 11:50:35 +01:00
Pieter Wuille
3ed1ccb089 Merge pull request #2004 from alexanderkjeldaas/simplify-cmutexlock
Simplify CMutexLock
2012-11-24 13:55:00 -08:00
Pieter Wuille
7818d230a2 Merge pull request #2013 from sipa/blockheader
Split off CBlockHeader from CBlock
2012-11-24 13:54:12 -08:00
burger2
ecd67a1420 Fix duplicate shortcut usage in sign/verify message dialog. 2012-11-22 22:50:30 +01:00
Pieter Wuille
c07a1a6ee4 Merge pull request #1980 from sipa/noreorgsame
Do not reorganize if new branch has same amount of work
2012-11-22 13:33:03 -08:00
Wladimir J. van der Laan
b0e228a4b0 Merge pull request #2024 from Diapolo/fix_qt_crash
Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()
2012-11-22 02:08:42 -08:00
Gavin Andresen
a91efb2d8d Add assert and comment for subtle pay-to-script-hash logic 2012-11-21 13:58:10 -05:00
Philip Kaufmann
be8e1f8479 Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()
- can be triggerd by just adding -proxy=crashme with 0.7.1
- crash occured, when AppInit2() was left with return false; after the
  first call to bitdb.open() (Step 6 in init)
- this is caused by GetDataDir() or .string() in CDBEnv::EnvShutdown()
  called via the bitdb global destructor
- init fDbEnvInit and fMockDb to false in CDBEnv::CDBEnv()
2012-11-18 14:10:26 +01:00
Wladimir J. van der Laan
4725e96a3a Merge pull request #2022 from Diapolo/fix_#2018
fix pull #2018
2012-11-17 01:00:20 -08:00
Philip Kaufmann
11406c89fe ConnectBlock(): fix error() format to be unsigned
- I introduced the wrong format macro with my former patch (#2018), this
  needs to be signed not unsigned (thanks Luke-Jr)
2012-11-17 09:57:58 +01:00
Wladimir J. van der Laan
98e7771ca1 Merge pull request #2019 from Diapolo/bitcoinstrings_upd
update bitcoinstrings.cpp and bitcoin_en.ts
2012-11-16 17:29:04 -08:00
Philip Kaufmann
baa510b210 update bitcoinstrings.cpp and bitcoin_en.ts 2012-11-16 19:02:39 +01:00
Gavin Andresen
e45d39f9ee Merge pull request #2009 from sipa/fixmove
Prevent RPC 'move' from deadlocking
2012-11-16 08:09:41 -08:00
Philip Kaufmann
42152c3da9 ensure we use our format macros to avoid compilation warnings
- fixes 2 warnings I observed while compiling on Windows with MinGW
2012-11-16 08:29:47 +01:00
Wladimir J. van der Laan
0c42ee8130 Merge pull request #1767 from Diapolo/RPCCon_clear_history
clear history when using clear button in RPC console
2012-11-15 22:31:12 -08:00
Jeff Garzik
3ef292dc7d Merge pull request #1670 from luke-jr/blksubstr
Use full block hash as unique identifier in debug.log
2012-11-15 18:47:07 -08:00
Jeff Garzik
848c0d5d95 Merge pull request #1945 from centromere/leveldb_fix
Fixed compile error on FreeBSD 9.
2012-11-15 18:31:20 -08:00
Jeff Garzik
34ea321ccd Merge pull request #1987 from jgarzik/no-pw-match
RPC: Forbid RPC username == RPC password
2012-11-15 18:22:50 -08:00
Jeff Garzik
824e196054 Merge pull request #2005 from Diapolo/fixes_main
some small fixes for main.cpp/.h
2012-11-15 18:20:35 -08:00
Jeff Garzik
a0bf93b809 Merge pull request #2012 from luke-jr/invblk_errs
Print error for coinbase-pays-too-much case of ConnectBlock failing
2012-11-15 18:18:55 -08:00
Jeff Garzik
fdbb537d26 Add new RPC "lockunspent", to prevent spending of selected outputs
and associated RPC "listlockunspent".

This is a memory-only filter, which is empty when a node restarts.
2012-11-15 21:11:30 -05:00
Jeff Garzik
7e1610d51e RPC: Forbid RPC username == RPC password
Added security measure.
2012-11-15 20:33:42 -05:00
Pieter Wuille
bb76267cc4 Merge pull request #2010 from Diapolo/bind_unsigned
make enum and parameter used in Bind() unsigned
2012-11-15 15:37:00 -08:00
Pieter Wuille
e754cf4133 Split off CBlockHeader from CBlock
Cleaner and removes the need for the application-specific flags in
serialize.h.
2012-11-16 00:12:33 +01:00
Pieter Wuille
99d0d0f356 Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
2012-11-15 23:00:16 +01:00
Luke Dashjr
4ade04ddbd Print error for coinbase-pays-too-much case of ConnectBlock failing 2012-11-14 19:16:56 +00:00
Philip Kaufmann
29e214aaf5 make enum and parameter used in Bind() unsigned
- it's good practise to use unsigned int for enum flags, so change this
  one, as I introduced this for Bind()
2012-11-14 16:13:18 +01:00
Alexander Kjeldaas
bfc9620799 Simplify CMutexLock
o Remove unused Leave and GetLock functions
o Make Enter and TryEnter private.
o Simplify Enter and TryEnter.
  boost::unique_lock doesn't really know whether the
  mutex it wraps is locked or not when the defer_lock
  option is used.
  The boost::recursive_mutex does not expose this
  information, so unique_lock only infers this
  knowledge.  When taking the lock is defered, it
  (randomly) assumes that the lock is not taken.
  boost::unique_lock has the following definition:

        unique_lock(Mutex& m_,defer_lock_t):
            m(&m_),is_locked(false)
        {}

        bool owns_lock() const
        {
            return is_locked;
        }
  Thus it is a mistake to check owns_lock() in Enter
  and TryEnter - they will always return false.
2012-11-14 00:00:23 -03:00
Pieter Wuille
4291e8feab Prevent RPC 'move' from deadlocking
It seemed to create two CWalletDB objects that both grab the
database lock.
2012-11-14 00:31:56 +01:00
Luke Dashjr
c34a32699e Change block references in debug.log to full hash instead of just 0..20 2012-11-13 21:19:58 +00:00
Luke Dashjr
f3a84c3a6b Abstract block hash substr extraction (for debug.log) into BlockHashStr inline 2012-11-13 21:18:32 +00:00
Philip Kaufmann
966a0e8cc9 add CWalletTx::GetImmatureCredit() and use it in CWallet::GetImmatureBalance() 2012-11-13 07:56:48 +01:00
Wladimir J. van der Laan
0d5b1d2a3e Merge pull request #2002 from alexanderkjeldaas/clang-warnings
o Removed verbose clang warning
2012-11-12 22:26:08 -08:00
Robert Backhaus
978770b59d Change 'make' to $(MAKE) in leveldb make command line 2012-11-13 11:45:07 +10:00
Philip Kaufmann
13e5cce4c3 some small fixes for main.cpp/.h
- remove an unwanted ";" at the end of the ~CCoinsView() destructor
- in FindBlockPos() and FindUndoPos() only call fclose(), is file is open
- fix an error string in the CBlockUndo class
2012-11-11 13:16:42 +01:00
Pieter Wuille
e12efb9d33 Merge pull request #1970 from Arnavion/fix-make-leveldb
leveldb cannot compile with custom CFLAGS / CXXFLAGS / LDFLAGS
2012-11-11 03:20:29 -08:00
Pieter Wuille
537c890f24 Merge pull request #1997 from Diapolo/bdb_open
simplify CDBEnv::Open() / fix small glitches
2012-11-11 03:16:52 -08:00
Pieter Wuille
337f876cbb Merge pull request #2000 from Diapolo/fix_indentation
fix some missing indentations in main.cpp for better readability
2012-11-11 02:23:10 -08:00
Alexander Kjeldaas
25511af4a5 o Annotated lock-like functions in net.h.
o Removed unused function EndMessageAbortIfEmpty
2012-11-11 00:55:48 -03:00
Alexander Kjeldaas
05f97d1263 o Added AnnotatedMixin which adds locking annotations to the mutex
API, compatible with clang's -Wthread-safety
2012-11-11 00:55:48 -03:00
Alexander Kjeldaas
c043ff79e3 o Added threadsafety.h - a set of macros using the -Wthread-safety
feature in clang.  These macros should primarily be used to
  document which locks protect a given piece of data.  Secondary it
  can be used to document the set of held and excluded locks when
  entering a function.
2012-11-11 00:53:00 -03:00
Alexander Kjeldaas
40c5e409e1 o Removed verbose clang warning 2012-11-11 00:25:19 -03:00
Pieter Wuille
6ca2ea2fa2 Merge pull request #1979 from sipa/corefndoc
One-line comments for public main functions
2012-11-10 13:47:00 -08:00
Pieter Wuille
160b028b88 One-line comments for public main functions 2012-11-10 22:40:21 +01:00
Pieter Wuille
45a9365f18 Fix status text after reindex 2012-11-10 22:08:46 +01:00
Gregory Maxwell
91cee34638 Merge pull request #1992 from Diapolo/no_memset
don't use memset() in privacy/security relevant code parts
2012-11-10 09:29:32 -08:00
Philip Kaufmann
b56585d067 fix some missing indentations in main.cpp for better readability 2012-11-10 14:26:34 +01:00
Wladimir J. van der Laan
e88f8887b6 Merge pull request #1977 from Diapolo/rem_printf_redef_rpc
remove printf redefinition from bitcoinrpc.cpp
2012-11-10 03:47:11 -08:00
Wladimir J. van der Laan
d7db72998b Merge pull request #1993 from Diapolo/qt_header_cleanup
Qt: small header changes / fixes
2012-11-10 03:46:35 -08:00
Philip Kaufmann
c74bae0fdf simplify CDBEnv::Open() / fix small glitches
- remove pathEnv from CDBEnv, as this attribute is not needed
- change path parameter in ::Open() to a reference
- make nDbCache variable an unsigned integer
- remove a missplaced ";" behin ::IsMock()
2012-11-10 01:11:22 +01:00
Philip Kaufmann
c73323eec9 allow listening on -bind=address for blocked networks
- this allows the client to listen on via -bind specified addresses
  (e.g. 127.0.0.1), even when a network (IPv4 in that case) was blocked
  via e.g -onlynet="Tor"
- introduce enum BindFlags to avoid passing multiple bools to Bind()
- make -bind help text clear we ALWAYS listen on the specified address
- remove an unused variable
- remove 2 unneeded IsLimited() checks before calling Bind(), which does
  these checks anyway

- usage case: specify -bind=127.0.0.1 -onlynet="Tor" to allow incoming
  connections to a Tor hidden service, but still don't allow other IPv4
  nodes to connect / get connected
2012-11-10 00:29:12 +01:00
Pieter Wuille
c7075c4b65 Fix tests after cache tweaks 2012-11-10 00:09:57 +01:00
Pieter Wuille
485cf044ba Merge pull request #1943 from sipa/reindex2
Add -reindex, to perform in-place reindexing of block chain files
2012-11-09 14:50:30 -08:00
Jeff Garzik
8146591a53 Merge branch 'http-improvements'
The base bits of pull req #1982.
2012-11-09 17:34:25 -05:00
Pieter Wuille
b41de54a2c Merge pull request #1978 from sipa/nodetach
Remove -detachdb and stop's detach argument.
2012-11-09 14:10:50 -08:00
Philip Kaufmann
d0b0925be9 make CBase58Data class use zero_after_free_allocator
- this way there is no need for an explicit destructor, who does the same
  thing anyway
2012-11-09 19:25:20 +01:00
Philip Kaufmann
0f8a647782 don't use memset() in privacy/security relevant code parts
As memset() can be optimized out by a compiler it should not be used in
privacy/security relevant code parts. OpenSSL provides the safe
OPENSSL_cleanse() function in crypto.h, which perfectly does the job of
clean and overwrite data.

For details see: http://www.viva64.com/en/b/0178/

- change memset() to OPENSSL_cleanse() where appropriate
- change a hard-coded number from netbase.cpp into a sizeof()
2012-11-09 12:53:53 +01:00
Pieter Wuille
7fea484674 Add -reindex, to perform in-place reindexing of block chain files
Flushes the blktree/ and coins/ databases, and reindexes the
block chain files, as if their contents was loaded via -loadblock.

Based on earlier work by Jeff Garzik.
2012-11-09 01:06:32 +01:00
Pieter Wuille
7a5b7535bf Move ThreadImport to init.cpp 2012-11-09 01:06:32 +01:00
Pieter Wuille
05d9726805 LoadExternalBlockFile switched to CBufferedFile 2012-11-09 01:06:06 +01:00
Pieter Wuille
b5d5f44c95 Add CBufferedFile 2012-11-09 01:06:06 +01:00
Pieter Wuille
16d9d61f99 Merge pull request #1981 from sipa/caches
Cache size optimizations
2012-11-08 14:17:37 -08:00
Philip Kaufmann
128eefa0f8 Qt: small header changes / fixes
- ensure header inclusion guard is named after the header file
- add missing comments at the end of some inclusion guards
- add a small Qt5 compatibility fix in macdockiconhandler.h
2012-11-08 21:45:32 +01:00
Pieter Wuille
cd6dc96c4f Do not reorganize if new branch has same amount of work 2012-11-05 21:24:11 +01:00
Wladimir J. van der Laan
86406daeca Merge pull request #1830 from Diapolo/trans_rem_spaces
fix some double-spaces in strings
2012-11-04 23:34:57 -08:00
Jeff Garzik
fcf234fc08 RPC: HTTP server uses its own ReadHTTPRequestLine()
rather than reusing ReadHTTPStatus() from the client mode.

The following additional HTTP request validations are added, both in line with
existing HTTP client practice:

1) HTTP method must be GET or POST.  Most clients use POST, some
   use GET.  Either way, this continues to work.
2) HTTP URI must start with "/" character.
   Normal URI is "/" (a 1-char string), so this is fine.
2012-11-04 17:16:46 -05:00
Jeff Garzik
2306dc4b76 RPC, cosmetic: push down ReadHTTPStatus() calls into ReadHTTP() callers
ReadHTTPStatus() is currently overloaded:  In client mode, it properly parses
and receives an HTTP status line.  In server mode, it incorrectly parses the
HTTP request line as an HTTP status line.

This server mode bug has never mattered, because the RPC server never
cared about the URI (path) provided in the HTTP request.  That will change in
the future, so go ahead and begin fixing the problem.

This patch is cosmetic, and should result in NO behavior changes.

Further renames:
ReadHTTPHeader -> ReadHTTPHeaders
ReadHTTP -> ReadHTTPMessage
2012-11-04 16:06:38 -05:00
Pieter Wuille
1c83b0a377 Cache size optimizations 2012-11-04 18:06:25 +01:00
Pieter Wuille
92467073ad Remove -detachdb and stop's detach argument.
As the only BDB database left is the wallet, and it is always
detached.

Also remove IsChainFile() predicate and related chainfile-specific
logic.
2012-11-04 12:59:06 +01:00
Philip Kaufmann
ed552cfae0 remove printf redefinition from bitcoinrpc.cpp
- as the redefiniton of printf happens in util.h, which is included in
  bitcoinrpc.cpp, we don't need another redefinition
2012-11-04 11:24:54 +01:00
Pieter Wuille
a56d3f8a10 Merge pull request #1971 from sipa/bugfix_norelayspent
Bugfix: do not keep relaying spent wallet transactions
2012-11-03 11:51:13 -07:00
Pieter Wuille
9d6633ac0d Comments for constants 2012-11-03 00:14:43 +01:00
Pieter Wuille
c9c7d4824f Add virtual destructor to CCoinsView 2012-11-01 22:54:06 +01:00
Pieter Wuille
5eaf91a428 Bugfix: do not keep relaying spent wallet transactions
The original test (checking whether the transaction occurs in the
txindex) is not usable anymore, as it will miss anything already
fully spent. However, as merkle transactions (and by extension,
wallet transactions) track which block they were last seen being
included in, we can use that to determine the need for
rebroadcasting.
2012-11-01 18:06:29 +01:00
Arnav Singh
8986a1369f Fixed making leveldb with custom CFLAGS/CXXFLAGS in the same way as makefile.unix 2012-11-01 08:29:17 -07:00
Philip Kaufmann
6f959c4cb3 Bitcoin-Qt: use statustips in addition to tooltips
- add setStatusTip() in addition to setTooltip() where it makes sense
- add only setStatusTip() if GUI element is only used in main- or tray menu

- add an event filter on our BitcoinGUI object to prevent garbelled text
  on the status bar, which happens when we use it for e.g. displaying
  block-sync state and then a QEvent::StatusTip wants to write own text to it

- remove a double translation of "Bitcoin client"
2012-10-31 08:05:27 +01:00
Wladimir J. van der Laan
578fc80003 Merge pull request #1932 from Diapolo/thread_printf
fix some thread related log messages
2012-10-30 23:19:35 -07:00
Pieter Wuille
41db7c224a Merge pull request #1963 from sipa/bugfix_nonewblock
Bugfix: don't crash by trying to write unchanged best block
2012-10-30 13:53:11 -07:00
Gavin Andresen
ae8fc19788 Merge branch 'rawtx_p2sh' 2012-10-29 15:49:46 -04:00
Matt Corallo
38fe2e6a68 Add missing calls to ranlib in Windows makefiles 2012-10-29 15:43:18 -04:00
Matt Corallo
f53b125507 Fix linux-mingw makefile's leveldb build by setting CXX. 2012-10-29 15:43:17 -04:00
Matt Corallo
3b4f8ad71d Use && instead of ; in leveldb calls to makefile. 2012-10-29 15:43:17 -04:00
Gavin Andresen
34226be7a8 New createmultisig rpc command
This is to support the signrawtransaction API call; given the public
keys involved in a multisig transaction, this gives back the redeemScript
needed to sign it.
2012-10-29 13:34:35 -04:00
Gavin Andresen
03346a61b1 Add redeemScript to listunspent output and signrawtransaction input
signrawtransaction was unable to sign pay-to-script-hash inputs
when given the list of private keys to use. With this commit
you can provide the p2sh redemption script in the list of
inputs.
2012-10-29 13:34:35 -04:00
Gavin Andresen
2d43f88e1f Tests for raw transactions argument checking 2012-10-29 13:34:35 -04:00
Gavin Andresen
c4d884e20e No need for test fixture now that multisig is enabled on main network. 2012-10-29 13:34:35 -04:00
Pieter Wuille
28982cc9dc Remove P2SH transition code: P2SH violations may cause DoS trigger 2012-10-29 00:41:39 +01:00
Pieter Wuille
0b297a614f Bugfix: don't crash by trying to write unchanged best block 2012-10-28 19:14:51 +01:00
Philip Kaufmann
6b3783a9c9 fix some double-spaces in strings
- remove some unneeded stuff in sendcoinsentry.ui
- harmonize some "Error:"-messages
2012-10-25 22:25:50 +02:00
Pieter Wuille
bb790aa24d First flush block tree, then coin set
As the coinset data refers to the best block, stored in the block
tree. Flushing the coin set first can cause inconsistencies if
the process gets killed in between.
2012-10-25 20:47:17 +02:00
tucenaber
3026baaa7c Added checks for null pointers in Shutdown
Estetics
2012-10-25 20:45:38 +02:00
Pieter Wuille
344620e953 Merge pull request #1904 from laanwj/2012_10_remove_getorder
remove "checkorder" P2P command
2012-10-25 11:41:22 -07:00
Pieter Wuille
e74d0ab675 Merge pull request #1899 from Diapolo/proxy_optionsmodel
make optionsmodel query real proxy state for ::data()
2012-10-25 11:33:59 -07:00
Pieter Wuille
66444558a5 Merge pull request #1953 from gmaxwell/createnewblock-race
Fixes a race condition in CreateNewBlock and a future null deref on testnet.
2012-10-25 11:30:51 -07:00
Philip Kaufmann
847593228d fix some thread related log messages
- "ThreadIRCSeed started" was not displayed, even if the thread ran
  (although only for a short time as the "do we want this thread?"-checks
  happen IN ThreadIRCSeed2())
- the patch ensures we always get that message
- add a "ThreadIRCSeed trying to connect..." message
- add missing "ThreadDumpAddress started" message
2012-10-25 16:12:40 +02:00
Wladimir J. van der Laan
1f7c5c5a3e Merge pull request #1926 from laanwj/2012_10_maindummybounds
Fix out-of-bounds read in main (issue #1924)
2012-10-25 06:12:10 -07:00
Wladimir J. van der Laan
7a1786084d Merge pull request #1956 from laanwj/2012_10_prerelease_warning
Show warning when using prerelease version
2012-10-25 05:52:55 -07:00
Pieter Wuille
2e9e6641e1 Merge pull request #1955 from gmaxwell/gbt_paramfix
Don't force getblocktemplate to have a parameter.
2012-10-25 05:37:51 -07:00
Philip Kaufmann
83a3fb81f3 ensure AskPassphraseDialog::eventFilter forwards events
- instead of "return false;" use "return QDialog::eventFilter(object,
  event);" to harmonize this event filter with our default behaviour
- remove orphan spaces found while editting the files
2012-10-25 11:52:34 +02:00
Wladimir J. van der Laan
62e21fb5d0 Show warning when using prerelease version
Implements #1948

- Add macro `CLIENT_VERSION_IS_RELEASE` to clientversion.h
- When running a prerelease (the above macro is `false`):
  - In UI, show an orange warning bar at the top. This will be used for other
    warnings (and alerts) as well, instead of the status bar.
  - For `bitcoind`, show the warning in the "errors" field in `getinfo`
    response.
2012-10-25 07:33:45 +02:00
Gregory Maxwell
3beac9837f Don't force getblocktemplate to have a parameter.
This looks like it was just a munged merge when ultraprune
was committed.
2012-10-24 12:39:46 -04:00
Pieter Wuille
55913c9971 Merge pull request #1947 from centromere/freebsd_cpu_fix
Fixed 100% CPU utilization problem on FreeBSD 9
2012-10-24 02:15:54 -07:00
Wladimir J. van der Laan
4fbad9124e Fix out-of-bounds read noticed by Ricardo Correia
Sizeof() returned the size of a pointer instead of the size of the buffer.
Fixes issue #1924.
2012-10-24 08:26:50 +02:00
Gregory Maxwell
faff50d129 Fixes a race condition in CreateNewBlock and a future null deref on testnet.
CreateNewBlock was reading pindexBest at the start before taking the lock
so it was possible to have the the block content not match the prevheader
and this can also trigger a newly added assert in ConnectBlock.

I noticed this during a code review after twobitcoins reported that ab91bf39
(BIP30 for all blocks) could cause a null dereference on a modified node
that mined during the IBD, or on testnet when it reached heights 91842 and
91880 due to CreateNewBlock calling ConnectBlock with pindex->phashBlock NULL.
2012-10-24 02:13:03 -04:00
Pieter Wuille
4afc0b5411 Bugfix: actually use CCoinsViewMemPool 2012-10-23 01:43:33 +02:00
Pieter Wuille
c2ed184f98 Added some comments
Some clarifications after a code review by Mike Hearn.
2012-10-23 00:27:17 +02:00
Pieter Wuille
1e64c2d585 Bugfix: off-by-one in priority calculation 2012-10-23 00:23:39 +02:00
Pieter Wuille
9e957fb3b1 Bugfix: add missing fee check 2012-10-23 00:23:39 +02:00
Pieter Wuille
56424040a4 Bugfix: off-by-one error in coinbase maturity check 2012-10-23 00:23:39 +02:00
Alex
39ad0aa692 Fixed 100% CPU utilization problem on FreeBSD 9 2012-10-22 08:37:17 -04:00
Alex
17bfb1f437 Fixed compile error on FreeBSD 9.
See http://code.google.com/p/leveldb/issues/detail?id=98
2012-10-22 01:46:31 -04:00
Gregory Maxwell
2ef15697f8 Merge pull request #1939 from sipa/bugfix_zerobalance
Bugfix: do not mark all future coins spent
2012-10-21 16:20:04 -07:00
Philip Kaufmann
729b180686 change blockchain -> block chain (spelling)
- Wiki says "block chain" is correct ;)
- remove some unneeded spaces I found in the source, while fixing the spelling
2012-10-21 21:32:25 +02:00
Philip Kaufmann
039bcbf12d remove init messages from ThreadImport()
- remove uiInterface.InitMessage() calls from ThreadImport(), as Qt
  doesn't like them getting called out of it's main thread and because the
  thread will continue to run after the GUI was loaded
2012-10-21 21:16:52 +02:00
grimd34th
46936f343c Add NATIVE_WINDOWS
With a change of libs, and specifying NATIVE_WINDOWS as TARGET_OS it should compile libleveldb.a and libmemenv.a just fine, it did for me and Diapolo when testing.
2012-10-21 11:38:12 -03:00
Pieter Wuille
80fe60959d Tab instead of 4 spaces in makefile.mingw 2012-10-21 16:10:01 +02:00
Pieter Wuille
ddba582377 Bugfix: do not mark all future coins spent 2012-10-21 15:19:19 +02:00
Gregory Maxwell
d12b694106 Merge pull request #1938 from sipa/v0799
Update version numbers to 0.7.99
2012-10-21 03:12:25 -07:00
Pieter Wuille
fcfa7a588e Update version numbers to 0.7.99 2012-10-21 12:10:08 +02:00
Gregory Maxwell
67e2c8a40a Merge pull request #1916 from jgarzik/caddrdb-bug
Fix: CAddrMan: verify pchMessageStart file marker, before reading address data
2012-10-20 15:06:25 -07:00
Pieter Wuille
f50fb5470b Merge pull request #1936 from sipa/morehashwriter
Use CHashWriter also in SignatureHash(), and for message signing
2012-10-20 14:53:43 -07:00
Pieter Wuille
4ca60bba5c Remove BDB block database support 2012-10-20 23:08:57 +02:00
Pieter Wuille
beeb57610c Add gettxout and gettxoutsetinfo RPCs 2012-10-20 23:08:57 +02:00
Pieter Wuille
e1bfbab802 Add LevelDB MemEnv support
Support LevelDB memory-backed environments, and use them in unit tests.
2012-10-20 23:08:57 +02:00
Pieter Wuille
2d8a48292b LevelDB block and coin databases
Split off CBlockTreeDB and CCoinsViewDB into txdb-*.{cpp,h} files,
implemented by either LevelDB or BDB.

Based on code from earlier commits by Mike Hearn in his leveldb
branch.
2012-10-20 23:08:57 +02:00
Pieter Wuille
44d40f26dc Flush and sync block data 2012-10-20 23:08:57 +02:00
Pieter Wuille
d979e6e36a Use singleton block tree database instance 2012-10-20 23:08:57 +02:00
Pieter Wuille
857c61df0b Prepare database format for multi-stage block processing
This commit adds a status field and a transaction counter to the block
indexes.
2012-10-20 23:08:57 +02:00
Pieter Wuille
4fea06db25 Automatically reorganize at startup to best known block
Given that the block tree database (chain.dat) and the active chain
database (coins.dat) are entirely separate now, it becomes legal to
swap one with another instance without affecting the other.

This commit introduces a check in the startup code that detects the
presence of a better chain in chain.dat that has not been activated
yet, and does so efficiently (in batch, while reusing the blk???.dat
files).
2012-10-20 23:08:57 +02:00
Pieter Wuille
13c51f20f6 Direct CCoins references
To prevent excessive copying of CCoins in and out of the CCoinsView
implementations, introduce a GetCoins() function in CCoinsViewCache
with returns a direct reference. The block validation and connection
logic is updated to require caching CCoinsViews, and exploits the
GetCoins() function heavily.
2012-10-20 23:08:57 +02:00
Pieter Wuille
64dd46fd05 Transaction hash caching
Use CBlock's vMerkleTree to cache transaction hashes, and pass them
along as argument in more function calls. During initial block download,
this results in every transaction's hash to be only computed once.
2012-10-20 23:08:57 +02:00
Pieter Wuille
ae8bfd12da Batch block connection during IBD
During the initial block download (or -loadblock), delay connection
of new blocks a bit, and perform them in a single action. This reduces
the load on the database engine, as subsequent blocks often update an
earlier block's transaction already.
2012-10-20 23:08:57 +02:00
Pieter Wuille
450cbb0944 Ultraprune
This switches bitcoin's transaction/block verification logic to use a
"coin database", which contains all unredeemed transaction output scripts,
amounts and heights.

The name ultraprune comes from the fact that instead of a full transaction
index, we only (need to) keep an index with unspent outputs. For now, the
blocks themselves are kept as usual, although they are only necessary for
serving, rescanning and reorganizing.

The basic datastructures are CCoins (representing the coins of a single
transaction), and CCoinsView (representing a state of the coins database).
There are several implementations for CCoinsView. A dummy, one backed by
the coins database (coins.dat), one backed by the memory pool, and one
that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock,
DisconnectBlock, ... now operate on a generic CCoinsView.

The block switching logic now builds a single cached CCoinsView with
changes to be committed to the database before any changes are made.
This means no uncommitted changes are ever read from the database, and
should ease the transition to another database layer which does not
support transactions (but does support atomic writes), like LevelDB.

For the getrawtransaction() RPC call, access to a txid-to-disk index
would be preferable. As this index is not necessary or even useful
for any other part of the implementation, it is not provided. Instead,
getrawtransaction() uses the coin database to find the block height,
and then scans that block to find the requested transaction. This is
slow, but should suffice for debug purposes.
2012-10-20 23:08:57 +02:00
Pieter Wuille
bba89aa82a Pre-allocate block and undo files in chunks
Introduce a AllocateFileRange() function in util, which wipes or
at least allocates a given range of a file. It can be overriden
by more efficient OS-dependent versions if necessary.

Block and undo files are now allocated in chunks of 16 and 1 MiB,
respectively.
2012-10-20 23:08:57 +02:00
Pieter Wuille
5382bcf8cd Multiple blocks per file
Change the block storage layer again, this time with multiple files
per block, but tracked by txindex.dat database entries. The file
format is exactly the same as the earlier blk00001.dat, but with
smaller files (128 MiB for now).

The database entries track how many bytes each block file already
uses, how many blocks are in it, which range of heights is present
and which range of dates.
2012-10-20 23:08:57 +02:00
Pieter Wuille
8adf48dc9b Preliminary undo file creation
Create files (one per block) with undo information for the transactions
in it.
2012-10-20 23:08:57 +02:00
Pieter Wuille
630fd8dcb6 One file per block
Refactor of the block storage code, which now stores one file per block.
This will allow easier pruning, as blocks can be removed individually.
2012-10-20 23:08:57 +02:00
Pieter Wuille
44ac1c0fe3 Add CTxUndo: transaction undo information
The CTxUndo class encapsulates data necessary to undo the effects of
a transaction on the txout set, namely the previous outputs consumed
by it (script + amount), and potentially transaction meta-data when
it is spent entirely.
2012-10-20 23:08:56 +02:00
Pieter Wuille
10fd8604d7 Add CCoins: pruned list of transaction outputs
The CCoins class represents a pruned set of transaction outputs from
a given transaction. It only retains information about its height in
the block chain, whether it was a coinbase transaction, and its
unspent outputs (script + amount).

It has a custom serializer that has very low redundancy.
2012-10-20 23:08:56 +02:00
Pieter Wuille
0fa593d0fb Compact serialization for amounts
Special serializer/deserializer for amount values. It is optimized for
values which have few non-zero digits in decimal representation. Most
amounts currently in the txout set take only 1 or 2 bytes to
represent.
2012-10-20 23:08:56 +02:00