Commit Graph

1494 Commits

Author SHA1 Message Date
Philip Kaufmann b69dd08ae7 fix two signed/unsigned comparison warnings in netbase.cpp 2012-06-05 07:32:27 +02:00
Philip Kaufmann 4e16306ae3 fix default Proxy address in Qt options (no hostname allowed currently) 2012-06-04 23:13:01 +02:00
Gavin Andresen 46e06b875d Merge branch 'netopt' of https://github.com/sipa/bitcoin 2012-06-04 14:15:19 -04:00
Chris Moore 831f59ce8b Fix coin selection to only include change when it's necessary. 2012-06-04 16:49:10 +00:00
Chris Moore d650f96d5f Preserve the shuffled order of coins with equal value to give more randomized coin selection. 2012-06-04 16:36:46 +00:00
Chris Moore 4ce190a015 Test that the coin selection code is suitably random, and add tests re. sub-cent change. 2012-06-04 16:36:43 +00:00
Chris Moore e333ab56d5 Move the random_shuffle call back into SelectCoinsMinConf() so we can unit test it. 2012-06-04 16:36:39 +00:00
Chris Moore 9b0369c773 Refactor SelectCoinsMinConf() and add unit tests.
AvailableCoins() makes a vector of available outputs which is then passed to SelectCoinsMinConf().  This allows unit tests to test the coin selection algorithm without having the whole blockchain available.
2012-06-04 16:36:34 +00:00
Wladimir J. van der Laan 882ba0e752 Merge pull request #837 from sje397/ShowImmatureBalance
Added 'immature balance' for miners. Only displayed if the balance is > 0
2012-06-02 02:35:48 -07:00
Wladimir J. van der Laan 88d7bc930a Merge pull request #1368 from Diapolo/verifymessagepage
GUI: change verifymessagepage behaviour to match RPC-call "verifymessage"
2012-06-02 02:33:41 -07:00
Philip Kaufmann 5d6b30271f move class HelpMessageBox to guiutil.cpp/.h / add button to show Bitcoin command-line options (in RPC Console -> Information) / resize Debug window a little to allow for a non-breaking display of the welcome message with non-english translation 2012-06-01 16:29:54 +02:00
Philip Kaufmann 8103b0bb62 change verifymessagepage behaviour to match RPC-call "verifymessage" (input address, signature and message) / display messages in status label (remove message boxes) / resize window to make signature fully readable / change signature font to BC-address font (like in messagepage) / remove checkAddress() and place code directly in on_verifyMessage_clicked() / add visual feedback to LineEdits / remove AddressTableModel references, as they are now unused / add addr.GetKeyID(keyID) check 2012-06-01 11:13:44 +02:00
Gavin Andresen 98474d3d6f Use ConvertTo to simplify sendmany/addmultisigaddress argument handling 2012-05-31 16:09:31 -04:00
Gavin Andresen ea7582bb41 Make sendrawtx return txid to be consistent with other send methods. 2012-05-31 16:05:07 -04:00
Ricardo M. Correia 10b45b4c2e Use C++-style numeric limits instead of C-style. 2012-05-31 20:33:22 +02:00
Ricardo M. Correia 78e851f94f Fix noinline definition so that it works for more compilers. 2012-05-31 20:33:14 +02:00
Pieter Wuille 587f929c64 Rework network config settings 2012-05-31 18:12:35 +02:00
Philip Kaufmann 407e20c11a sync english translation master file with current master branch 2012-05-31 11:11:04 +02:00
Pieter Wuille 10ed8178fc Update bitcoinstrings.cpp 2012-05-30 23:00:21 +02:00
Gregory Maxwell 20cb17e1f9 Merge pull request #1392 from gavinandresen/testnet_reset
Testnet reset
2012-05-27 19:26:47 -07:00
Pieter Wuille a52c7a1b65 Merge pull request #1357 from sipa/keyid
Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
2012-05-26 10:17:27 -07:00
Pieter Wuille 1e07068adf Merge pull request #1370 from Diapolo/add_startuptime_to_log
add client startup time as an entry to debug.log
2012-05-26 01:55:17 -07:00
Gavin Andresen c87c8cd163 Add a testnet checkpoint at block 546 2012-05-25 14:36:40 -04:00
Gavin Andresen 248bceb30c Fix issue#1082, testnet difficulty unsigned integer underflow 2012-05-25 14:36:40 -04:00
Gavin Andresen feeb761ba0 Testnet, Mark III 2012-05-25 14:36:40 -04:00
Gavin Andresen 4e6e3293ff Remove newlines from JSON strings
Newlines in JSON strings are against the JSON spec,
so remove them from the script*.json unit tests to
make python's jsonrpc happy (json::spirit didn't care).
2012-05-25 13:58:44 -04:00
Gavin Andresen 787f5e9949 Unit tests for transaction size limits 2012-05-25 11:37:34 -04:00
sje397 8fdb7e108f Added 'immature balance' for miners. Only displayed if the balance is greater than zero.
This adds a field labelled 'Immature' in the overview section under the 'unconfirmed' field, which shows mined
income that has not yet matured (which is currently not displayed anywhere, even though the transactions
exist in the transaction list). To do that I added a 'GetImmatureBalance' method to the wallet, and connected
that through to the GUI as per the 'GetBalance' and 'GetUnconfirmedBalance' methods. I did a small 'no-op'
change to make the code in adjacent functions a little more readable (imo); it was a change I had made in my
repo earlier...but I thought it wouldn't hurt so left it in. Immature balance comes from mined income that is
at least two blocks deep in the chain (same logic as displayed transactions).

My reasoning is:
- as a miner, it's a critical stat I want to see
- as a miner, and taking into account the label 'immature', the uncertainty is pretty clearly implied
- those numbers are already displayed in the transaction list
- this makes the overview numbers add up to what's in the transaction list
- it's not displayed if the immature balance is 0, so won't bother non-miners

I also 'cleaned' the overview UI a little, moving code to the XML and removing HTML.
2012-05-25 23:15:27 +10:00
Gavin Andresen 6b8a17119e Lots more Script unit test cases. 2012-05-24 17:32:09 -04:00
Pieter Wuille 1025440184 Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
This introduces internal types:
* CKeyID: reference (hash160) of a key
* CScriptID: reference (hash160) of a script
* CTxDestination: a boost::variant of the former two

CBitcoinAddress is retrofitted to be a Base58 encoding of a
CTxDestination. This allows all internal code to only use the
internal types, and only have RPC and GUI depend on the base58 code.

Furthermore, the header dependencies are a lot saner now. base58.h is
at the top (right below rpc and gui) instead of at the bottom. For the
rest: wallet -> script -> keystore -> key. Only keystore still requires
a forward declaration of CScript. Solving that would require splitting
script into two layers.
2012-05-24 20:26:19 +02:00
Pieter Wuille fd61d6f506 Encapsulate public keys in CPubKey 2012-05-24 19:58:12 +02:00
Gavin Andresen f04017f702 More CScript unit tests. 2012-05-24 13:29:08 -04:00
Jeff Garzik b92095f18c DoS_tests: fix signed/unsigned comparison warnings
test/DoS_tests.cpp: In member function ‘void DoS_tests::DoS_mapOrphans::test_method()’:
test/DoS_tests.cpp:200:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
test/DoS_tests.cpp:208:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
test/DoS_tests.cpp: In member function ‘void DoS_tests::DoS_checkSig::test_method()’:
test/DoS_tests.cpp:260:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
test/DoS_tests.cpp:267:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
test/DoS_tests.cpp:280:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
test/DoS_tests.cpp:307:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2012-05-24 12:18:50 -04:00
Jeff Garzik 2ae4ad004a Merge pull request #1387 from Diapolo/rem_unused_rpcdump
remove dead "using namespace boost::asio;" from rpcdump.cpp
2012-05-24 09:14:59 -07:00
Jeff Garzik ec9c902133 Merge pull request #1383 from jgarzik/rawtx
JSON-RPC: Add 'sendrawtx' op, for sending pre-built TX's to network
2012-05-24 09:14:04 -07:00
Philip Kaufmann bd09334d1a remove dead "using namespace boost::asio;" from rpcdump.cpp 2012-05-24 18:13:03 +02:00
Jeff Garzik 8e154e4d74 Merge branch 'merge2' into merge 2012-05-24 11:57:51 -04:00
Jeff Garzik 480d44bd0b rpcdump: include cleanup. move JSONRPCError def to bitcoinrpc.h. 2012-05-23 23:20:07 -04:00
Jeff Garzik 429039d45d Refactor: move runCommand() to util.cpp 2012-05-23 23:10:59 -04:00
Jeff Garzik 976c08b68a JSON-RPC: Add 'sendrawtx' op, for sending pre-built TX's to network 2012-05-23 16:21:25 -04:00
Philip Kaufmann 41c6b8abc6 add client startup time as an entry to debug.log (note: logged time in debug.log differs by a few seconds from the one displayed in the Debug window) / make ClientModel::formatClientStartupTime() return a QString 2012-05-23 18:44:28 +02:00
Jeff Garzik 9ac282ca0c Refactor: add IsChainFile helper. LoadBlockIndex() code movement. 2012-05-23 00:17:07 -04:00
Gregory Maxwell 7a99821377 Merge pull request #1342 from rebroad/LastSeenMinusMinus
Should not be T minus, as this indicate duration to future event.
2012-05-22 20:33:35 -07:00
Luke Dashjr f9189543bf CDBEnv: fix qt build 2012-05-22 20:47:42 -04:00
Pieter Wuille f29f242758 Merge pull request #1380 from gavinandresen/optimize2
Move signature cache from CKey::Verify to CheckSig in script.cpp
2012-05-22 15:13:36 -07:00
Jeff Garzik 0134a1c08c Merge branch 'dbenv' into tmp
Conflicts:
	src/db.cpp
2012-05-22 17:45:00 -04:00
Jeff Garzik 5d0f7c4f47 Merge pull request #1381 from jgarzik/check-deser
Prevent crashes due to missing or corrupted database records
2012-05-22 14:39:49 -07:00
Pieter Wuille fa638ec8af Merge pull request #1369 from sipa/bootorder
Reorder AppInit2
2012-05-22 13:54:46 -07:00
Jeff Garzik 78eb2789b2 ProcessMessage(): remove duplicate orphan tx debug message 2012-05-22 15:33:04 -04:00
Jeff Garzik 8fe791e4e2 Prevent crashes due to missing or corrupted blk????.dat records
In LoadExternalBlockFile(), errors are already caught... silently.
Add a warning message, even though we do not abort the program due to
load error.
2012-05-22 15:23:17 -04:00
Jeff Garzik f94b64c2f3 Prevent crashes due to missing or corrupted database records
Any problems seen during deserialization will throw an uncaught
exception, crashing the entire bitcoin process.  Properly return an
error instead, so that we may at least log the error and gracefully
shutdown other portions of the app.
2012-05-22 15:12:52 -04:00
Gavin Andresen acf513cfe7 Move signature cache from CKey::Verify to CheckSig in script.cpp
More than doubles the speed of verifying already-cached signatures
that use compressed pubkeys:
Before: ~200 microseconds
After:  ~80 microseconds
(no caching at all: ~3,300 microseconds per signature)

Also encapsulates the signature cache code in a class
and fixes a signed/unsigned comparison warning.
2012-05-22 14:15:11 -04:00
Wladimir J. van der Laan d1edab602a Merge pull request #1379 from laanwj/2012_05_macoshide
Remove duplicate behavior on MacOSX
2012-05-22 10:33:03 -07:00
Wladimir J. van der Laan b06f9c1364 Remove duplicate behavior on MacOSX
Dock icon on macosx already has show/hide functionality. This results in erratic behavior.
2012-05-22 18:28:10 +02:00
Gavin Andresen 43d16f0361 Merge branch 'master' of github.com:bitcoin/bitcoin 2012-05-22 11:14:30 -04:00
Gavin Andresen d0e4051cd8 Merge branch 'optimize' 2012-05-22 11:13:00 -04:00
Gregory Maxwell 09cec19e2f Merge pull request #1378 from rebroad/ProcessMessagesDebugCorrect
Correct debug.log output to show correct function the debug is coming from.
2012-05-22 08:06:05 -07:00
R E Broadley ea591ead85 Correct debug.log output to show correct function the debug is coming from. 2012-05-22 12:06:08 +01:00
Jeff Garzik 7b671f52e0 Define BOOST_SPIRIT_THREADSAFE in all makefiles
rather than at each include site.

Fixes #1371
2012-05-21 22:25:54 -04:00
Pieter Wuille 63407fd6e2 Merge pull request #917 from mndrix/reopen-log-file
Reopen log file on SIGHUP
2012-05-21 10:04:26 -07:00
Wladimir J. van der Laan bc5053d93e Merge pull request #1329 from laanwj/2012_05_addrremovewhitespace
Filter out whitespace and zero-width non-breaking spaces in address field validator
2012-05-21 09:54:24 -07:00
Wladimir J. van der Laan ce7896070c Remove autocorrection of 0/i in addresses in UI 2012-05-21 18:52:56 +02:00
Wladimir J. van der Laan 25047eb3e9 Filter out whitespace and zero-width non-breaking spaces in validator
- Fixes issues with copy/pasting from web or html emails (#1325)
2012-05-21 18:52:15 +02:00
Pieter Wuille 7d80d2e3d7 Reorder AppInit2
This reorders AppInit2 into 10 sections:
1)  basic setup (OS stuff, signal handlers)
2)  parameter interactions (softset)
3)  interpreting options without side effects (just setting internal variables)
4)  application initialization (datadir lock, daemonize, pidfile, log file)
5)  network initialization (network params, proxy, binding)
6)  load blockchain
7)  load wallet
8)  import blocks (-loadblock=)
9)  load peers
10) start node/rpc threads
11) finished

This means invalid configurations will be detected as soon as possible
(in particular, before loading the block chain).
2012-05-21 18:43:22 +02:00
Wladimir J. van der Laan 3b9473afa2 Merge pull request #1365 from Diapolo/askpassphrasedialog
GUI: start rows in askpassphrasedialog.ui at 0 (not 1)
2012-05-21 09:41:51 -07:00
Jeff Garzik 9c137aaccf BDB: restore DB_PRIVATE flag to environment
Satoshi's commits fdbf76d and c8ad9b8 (SVN import) removed the
DB_PRIVATE flag from the environment.  In part, this enables processes
other than bitcoind to examine the active database environment.

However, this incurs a slight performance penalty versus working
entirely within application memory (DB_PRIVATE).  Because bitcointools
and other direct-BDB-accessing tools are not used by the vast
majority of users, prefer to default with DB_PRIVATE with the option
of disabling it if needed via -privdb=0.
2012-05-21 12:38:45 -04:00
Pieter Wuille 46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Pieter Wuille 6e86c4700b Merge pull request #1363 from Diapolo/remove_strncasecmp
remove strncasecmp() + strnicmp() calls use boost::algorithm::istarts_with()
2012-05-20 12:26:43 -07:00
Philip Kaufmann 4dfbc78a88 start rows in askpassphrasedialog.ui at 0 (not 1) 2012-05-20 15:55:39 +02:00
Wladimir J. van der Laan 239c11d0dd Make testcases build, prevent windows symbol collision 2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan 0832c0d166 Process address book updates incrementally
- No longer invalidates selection model, thus retains selection on address book changes
- Fixes selection of new address when added
2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan ab1b288fa7 Convert UI interface to boost::signals2.
- Signals now go directly from the core to WalletModel/ClientModel.
  - WalletModel subscribes to signals on CWallet: Prepares for multi-wallet support, by no longer assuming an implicit global wallet.
- Gets rid of noui.cpp, the few lines that were left are merged into init.cpp
- Rename wxXXX message flags to MF_XXX, to make them UI indifferent.
- ThreadSafeMessageBox no longer returns the value `4` which was never used, converted to void.
2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan fe4a655042 Fine-grained UI updates
Gets rid of `MainFrameRepaint` in favor of specific update functions that tell the UI exactly what changed.

This improves the efficiency of various handlers. Also fixes problems with mined transactions not showing up until restart.

The following notifications were added:

- `NotifyBlocksChanged`: Block chain changed
- `NotifyKeyStoreStatusChanged`: Wallet status (encrypted, locked) changed.
- `NotifyAddressBookChanged`: Address book entry changed.
- `NotifyTransactionChanged`: Wallet transaction added, removed or updated.
- `NotifyNumConnectionsChanged`: Number of connections changed.
- `NotifyAlertChanged`: New, updated or cancelled alert. As this finally makes it possible for the UI to know when a new alert arrived, it can be shown as OS notification.

These notifications could also be useful for RPC clients. However, currently, they are ignored in bitcoind (in noui.cpp).

Also brings back polling with timer for numBlocks in ClientModel. This value updates so frequently during initial download that the number of signals clogs the UI thread and causes heavy CPU usage. And after initial block download, the value changes so rarely that a delay of half a second until the UI updates is unnoticable.
2012-05-20 10:41:54 +02:00
Wladimir J. van der Laan 563f3efda3 Merge pull request #1323 from Diapolo/string_fixes
translation updates / string updates
2012-05-20 01:34:06 -07:00
Wladimir J. van der Laan 6f3b919ae1 Merge pull request #1353 from Diapolo/RPC_OpenDebugLog_Icon
GUI: add an icon for Debug logfile -> Open in the RPC console
2012-05-20 01:32:18 -07:00
Wladimir J. van der Laan 01ecb074a7 Merge pull request #1302 from laanwj/2012_05_utilstrings
Get rid of snprintf (except one) with fixed buffers, shorten code
2012-05-20 01:30:18 -07:00
Jeff Garzik ffe8b77a61 Further CDBEnv encapsulation work. 2012-05-19 20:46:52 -04:00
Jeff Garzik 94e34fa0ad CDB::CDB: properly initialize activeTxn to NULL 2012-05-19 20:45:39 -04:00
Jeff Garzik 8b1202c52c Remove unused nested BDB transaction support 2012-05-19 20:45:39 -04:00
Jeff Garzik 24b57e3c6a Create CDBEnv::TxnBegin(), and use it in CDB::TxnBegin() 2012-05-19 20:44:31 -04:00
Jeff Garzik cd9696fc97 Encapsulate BDB environment inside new CDBEnv class
Cleans up and organizes several scattered functions and variables related to
the BDB env.  Class CDBInit() existed to provide a
guaranteed-via-C++-destructor cleanup of the db environment.

A formal CDBEnv class provides all of this inside a single wrapper.
2012-05-19 20:43:19 -04:00
Jeff Garzik b52a270538 Reorganize(): remove spurious TxnAbort()
If Reorganize() fails, then its caller, CBlock::SetBestChain(),
will call TxnAbort().

Redundant TxnAbort() calls are harmless.  The second will return an
error return value, with no other side effects.  TxnAbort() return
values are generally never checked.  The impact is nil.
2012-05-19 20:40:43 -04:00
Philip Kaufmann 00fb08158d remove strncasecmp() + strnicmp() calls and replace that code via boost::algorithm::istarts_with() / do not call ipcInit() on Mac and Windows as this is unneeded currently 2012-05-20 00:48:34 +02:00
Jeff Garzik cde87ee75c Merge pull request #1360 from jgarzik/datasync
Default to DB_TXN_WRITE_NOSYNC for all transactional operations
2012-05-19 12:33:19 -07:00
Pieter Wuille bd795bd543 Merge pull request #1358 from luke-jr/shared_lockchk
Shared code for wallet lock help and check
2012-05-19 08:34:27 -07:00
Gavin Andresen 973ca019bc Merge pull request #1296 from Diapolo/CheckDiskSpace
make CheckDiskSpace() use 50 * 1024 * 1024 Bytes
2012-05-19 05:48:48 -07:00
Gavin Andresen 23e5c5b11a Merge pull request #1289 from Diapolo/Bitcoin_as_noun
change strings to Bitcoin (uppercase), where it is used as a noun and up...
2012-05-19 05:45:50 -07:00
Wladimir J. van der Laan e3f72a3555 Merge pull request #1362 from laanwj/2012_05_debugwindowicon2
Replace debug window icon with LGPL-licensed one (fixes #1348)
2012-05-19 03:48:09 -07:00
Wladimir J. van der Laan 8a6a35e9d9 Replace debug window icon with LGPL-licensed one (fixes #1348) 2012-05-19 12:47:01 +02:00
Jeff Garzik 394b9298fa Default to DB_TXN_WRITE_NOSYNC for all transactional operations
* This is safer than DB_TXN_NOSYNC, and does not appear to impact
  performance.
* Applying this to the dbenv is necessary to avoid many fdatasync(2)
  calls on db 5.x
* We carefully and thoroughly flush databases upon shutdown and
  other important events already.
2012-05-19 01:25:06 -04:00
Luke Dashjr 29875dcb4b Shared code for wallet lock help and check 2012-05-18 23:13:21 +00:00
Michael Hendricks 9af080c351 Reopen debug.log on SIGHUP
The best log rotation method formerly available was to configure
logrotate with the copytruncate option.  As described in the logrotate
documentation, "there is a very small time slice between copying the
file and truncating it, so some logging data might be lost".

By sending SIGHUP to the server process, one can now reopen the debug
log file without losing any data.
2012-05-18 16:20:03 -06:00
Michael Hendricks fea25712ca Serialize access to debug.log stream
Acquire an exclusive, advisory lock before sending output to debug.log
and release it when we're done. This should avoid output from multiple
threads being interspersed in the log file.

We can't use CRITICAL_SECTION machinery for this because the debug log
is written during startup and shutdown when that machinery is not
available.

(Thanks to Gavin for pointing out the CRITICAL_SECTION problems based
on his earlier work in this area)
2012-05-18 16:19:09 -06:00
Philip Kaufmann ff0ee876bb change strings to Bitcoin (uppercase), where it is used as a noun and update strings to use "Qt" (and not qt or QT) / update initialisation of notificator to use qApp->applicationName() instead of a static string 2012-05-18 23:13:58 +02:00
Jeff Garzik d6615a54c6 Merge pull request #1350 from jgarzik/del-deprecated
JSON-RPC: remove 'getblocknumber' deprecated RPC
2012-05-18 08:26:40 -07:00
Pieter Wuille 660ff174f2 Use boost::thread locking instead of interprocess 2012-05-18 16:56:12 +02:00
Gavin Andresen 62922c8ab0 Cache signature verifications
Create a maximum-10MB signature verification result cache.
This should almost double the number of transactions that
can be processed on a given CPU, because before this change
ECDSA signatures were verified when transactions were added
to the memory pool and then again when they appeared in
a block.
2012-05-18 10:41:18 -04:00
Gavin Andresen 4add41a2a6 Further DoS prevention: Verify signatures last
Loop over all inputs doing inexpensive validity checks first,
and then loop over them a second time doing expensive signature
checks. This helps prevent possible CPU exhaustion attacks
where an attacker tries to make a victim waste time checking
signatures for invalid transactions.
2012-05-18 10:41:18 -04:00
Gavin Andresen 7a15109c04 Remove invalid dependent orphans from memory
Remove orphan transactions from memory once
all of their parent transactions are received
and they're still not valid.
Thanks to Sergio Demian Lerner for suggesting this fix.
2012-05-18 10:41:17 -04:00
Gavin Andresen 77b99cf7ad Optimize orphan transaction handling
Changes suggested by Sergio Demian Lerner to
help prevent potential DoS attacks.
2012-05-18 10:13:21 -04:00