Commit graph

3121 commits

Author SHA1 Message Date
Philip Kaufmann 733511eda0 prevent compiler redefinition warnings
- I observed a massive amount of redefinition warnings after #3071, which
  are silenced by this patch
- uses the same style as we do in other places, where we define _WIN32_WINNT
2013-10-11 15:37:36 +02:00
Philip Kaufmann 48c011489b don't touch addressbook when using secure payment-requests
- fixes #3006 by preventing addressbook changes when using
  secure payment-requests

sq
2013-10-11 15:34:05 +02:00
Philip Kaufmann 06dfd23d41 paymentserver: use own HTML-esc / add new header const
- make processPaymentRequest() use our own HTML-escaping function from
  GUIUtil
- make string "application/bitcoin-payment" a constant (below similar
  constant strings in the .cpp file)
2013-10-11 14:40:08 +02:00
Philip Kaufmann 8a041f494f sendcoinsdialog: display real failed address string
- display the real string (faulty address), which causes the valid address
  check to fail, instead of a stringified "nonsense" CBitcoinAddress
2013-10-11 14:29:09 +02:00
Philip Kaufmann 057bf35bc5 sendcoinsentry: small clear() and setValue() changes
- clear(): clear all UI elements (for secure and insecure payments)
- setValue(): only modify UI elements, which need to be set (for secure
  or insecure payments)
2013-10-11 14:22:43 +02:00
Wladimir J. van der Laan 56c0ba7a0f Merge pull request #3071 from gavinandresen/windows_h
Remove include of windows.h from allocators.h
2013-10-11 05:11:21 -07:00
Wladimir J. van der Laan b0091bb896 wallet: remove automatic update of default key 2013-10-10 14:59:49 +02:00
Wladimir J. van der Laan a302c21e0b Merge pull request #3066 from Diapolo/rem_global
make fCommandLine a local variable in AppInit()
2013-10-09 23:35:42 -07:00
Gavin Andresen d8315d1650 Remove include of windows.h from allocators.h
Create an allocators.cpp, and move all of the #ifdef WIN32
code and the #include of windows.h into it.

Two motives for this cleanup:
1. I'm getting a weird error in windows.h in my smartfee branch.
2. allocators.h is included (indirectly) just about everywhere, so
this should speed up Windows compiles quite a lot.
2013-10-09 16:48:53 +10:00
Philip Kaufmann c7b1d6bbc7 Bitcoin-Qt: ensure Qt icon is shown with Qt >= 5.0 2013-10-08 12:27:57 +02:00
Philip Kaufmann 917ac1dcc1 make fCommandLine a local variable in AppInit() 2013-10-08 10:52:42 +02:00
Gavin Andresen aa56d317a5 Merge pull request #3059 from Diapolo/Shutdown
add missing Boost Thread join_all() call during shutdown
2013-10-07 15:42:07 -07:00
Philip Kaufmann 5ea66c54fb style-police: fixed badly readable code in ProcessMessage()
- I introduced the problem and fixed it with better readable code
2013-10-07 08:55:04 +02:00
Philip Kaufmann c55d1600da add missing Boost Thread join_all() call during shutdown
- fixes #3037 by adding missing join_all() call and brings bitcoind
  shutdown code in line with Bitcoin-Qt shutdown code
- added a comment for the if (!fRet) case
2013-10-07 08:52:54 +02:00
Wladimir J. van der Laan 695a722003 Merge pull request #3056 from Diapolo/stuck_debug_window
Bitcoin-Qt: prevent stuck/unusable debug window on exit
2013-10-06 04:57:08 -07:00
Philip Kaufmann a8d0c1e8cc Bitcoin-Qt: prevent stuck/unusable debug window on exit
- when closing the client with an open debug window, that window could
  become stuck/unsuable (it was still shown wherea the main window was
  hidden already)
- fix this by hiding the debug window, when quitting the the client
2013-10-05 13:15:50 +02:00
David Hill a5e685bcf8 Hurricane Electric uses block 2001:470::, not 2011:470:: 2013-10-04 08:46:45 -04:00
Gavin Andresen 16b3ff66e0 Lower maximum size for free transaction creation
Changes the maximum size of a free transaction that will be created
from 10,000 bytes to 1,000 bytes.

The idea behind this change is to make the free transaction area
available to a greater number of people; with the default 27K-per-block,
just three very-large very-high-priority transactions could fill the space.
2013-10-04 22:05:06 +10:00
Gavin Andresen ea1cd5b47f Remove CENT-output free transaction rule when relaying
Remove the (relay/mempool) rule that all outputs of free transactions
must be greater than 0.01 XBT. Dust spam is now taken care of by making
dusty outputs non-standard.
2013-10-04 22:05:06 +10:00
Josh Lehan 971bb3e901 Added ping time measurement.
New RPC "ping" command to request ping.
Implemented "pong" message handler.
New "pingtime" field in getpeerinfo, to provide results to user.
New "pingwait" field, to show pings still in flight, to better see newly lagging peers.
2013-10-04 01:30:12 -07:00
Philip Kaufmann fbed9c9d63 special case DoS value == 0 in ProcessMessage()
- prevents unneeded log messages, which could make users think something
  bad was happening
2013-10-04 10:12:55 +02:00
Gavin Andresen acb3ebc455 Merge pull request #2947 from gmaxwell/theyre_maturing_faster_these_days
[wallet] Consider generated coins mature at COINBASE_MATURITY+1
2013-10-03 22:52:38 -07:00
Gavin Andresen a68fd1ca14 Merge pull request #3040 from Diapolo/Qt_misc2
Bitcoin-Qt: add missing change from branch Qt_misc
2013-10-03 21:42:27 -07:00
Gavin Andresen af880e8d3a Merge pull request #3050 from Diapolo/fix_IsRFC4193_comment
fix #3049 by changing comment for CNetAddr::IsRFC4193()
2013-10-03 21:12:48 -07:00
Gavin Andresen fea7236ca3 Merge pull request #3051 from Diapolo/bitcoind-rc
rename bitcoin-res.rc to bitcoind-res.rc
2013-10-03 21:11:57 -07:00
Jeff Garzik 5ad5e2d836 Merge pull request #3038 from Diapolo/Log_Shutdown
log start and end of Shutdown()
2013-10-03 06:16:06 -07:00
Philip Kaufmann cbf87fc4a6 rename bitcoin-res.rc to bitcoind-res.rc
- helps recognizing that the resource file belongs to bitcoind.exe
2013-10-03 15:06:31 +02:00
Philip Kaufmann c1761a5df3 fix #3049 by changing comment for CNetAddr::IsRFC4193() 2013-10-03 15:03:33 +02:00
Jeff Garzik a79342479f Relay OP_RETURN data TxOut as standard transaction type 2013-10-02 11:49:43 -04:00
Jeff Garzik 28f6b8dbad RPC validateaddress: test pwalletMain for NULL (no-wallet mode) 2013-10-02 05:51:13 -04:00
Philip Kaufmann ced3c24816 log start and end of Shutdown()
- could be helpful when debugging shutdown related problems
2013-10-02 08:36:47 +02:00
Jeff Garzik 19e5ae7369 Merge branch 'pwalletmain' - checking pwalletMain for NULL,
a pre-req for no-wallet support.
2013-10-01 16:18:50 -04:00
Jeff Garzik b0730874d9 Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.
2013-10-01 16:14:37 -04:00
Wladimir J. van der Laan b63ae2a534 Merge pull request #2991 from Diapolo/translation_fixes
Bitcoin-Qt: translation fixes in sendcoins
2013-10-01 08:18:48 -07:00
Jeff Garzik 19c415b1cf Merge pull request #2888 from litecoin-project/getnetworkhashps
Add getnetworkhashps to get the estimated network hashrate
2013-10-01 07:09:04 -07:00
Philip Kaufmann 23b48d13f1 Bitcoin-Qt: translation fixes in sendcoins
- remove some unneeded translatable strings from sendcoinsentry.ui file and
  rename some elements for better readability
- optimize string prorcessing in SendCoinsDialog::on_sendButton_clicked()
- make all UI labels for secure payments plain text and move the settings
  to sendcoinsentry.ui file
- remove unneeded button and default button definiton from warning message
  boxes
- remove fixed font-size when sending coins to an address with label and
  use monospace font for addresses
2013-10-01 15:48:25 +02:00
Philip Kaufmann ab25271d3c Bitcoin-Qt: add missing change from branch Qt_misc
- remove an unneeded debug message in walletframe
2013-10-01 14:15:19 +02:00
Philip Kaufmann f65dddc7b2 misc small spelling/indentation fixes 2013-10-01 09:47:16 +02:00
Pieter Wuille 6865127551 Merge pull request #3015 from theuni/win32-version-info
Win32 version info
2013-09-29 06:49:23 -07:00
Philip Kaufmann d5f0ef54f8 several small Qt-related fixes
- make BitcoinGUI::showPaymentACK() use a reference for msg and use our
  own GUIUtil::HtmlEscape() function
- ensure QTimer usage in clientmodel is the same as in walletmodel
- remove an unneeded debug message in walletframe
- flag some parameters as unused in DebugMessageHandler()
- small code formatting changes
2013-09-28 19:32:34 +02:00
Pieter Wuille f5857e5cb5 Inline signature serializer
Instead of building a full copy of a CTransaction being signed, and
then modifying bits and pieces until its fits the form necessary
for computing the signature hash, use a wrapper serializer that
only serializes the necessary bits on-the-fly.

This makes it easier to see which data is actually being hash,
reduces load on the heap, and also marginally improves performances
(around 3-4us/sigcheck here). The performance improvements are much
larger for large transactions, though.

The old implementation of SignatureHash is moved to a unit tests,
to test whether the old and new algorithm result in the same value
for randomly-constructed transactions.
2013-09-28 18:37:00 +02:00
Wladimir J. van der Laan 7de4e47d5f Merge pull request #3031 from Diapolo/miner
internal miner: move 2 globals from main to miner
2013-09-28 01:21:57 -07:00
Wladimir J. van der Laan 18c5910e8f Merge pull request #3027 from cozz/cozz2
GUI: fix sendcoinsdialog/sendcoinsentry
2013-09-28 00:46:41 -07:00
Philip Kaufmann 8d750f1d21 internal miner: move 2 globals from main to miner
- moves 2 global variables from main.cpp/h to miner.cpp/h
- also removes 2 unneded includes in miner.cpp, that come from miner.h
  already
2013-09-25 15:48:11 +02:00
Cozz Lovan 5dc9164edc GUI: fix sendcoinsdialog/sendcoinsentry 2013-09-24 16:10:38 +02:00
Pieter Wuille 99740bab9c Skip unspendable outputs in consistency check 2013-09-24 14:11:20 +02:00
Gavin Andresen fb8724ee6c Merge pull request #2791 from sipa/proveprune
Prune provably-unspendable outputs
2013-09-23 14:23:14 -07:00
Pieter Wuille a28fb70e45 Merge pull request #3016 from sipa/lows
Use 'low S' as malleability breaker rather than 'even S'
2013-09-23 06:05:29 -07:00
Gavin Andresen ff4e3e63e7 Merge pull request #2949 from gmaxwell/fewer_fee_footguns
[raw] reject insanely high fees by default in sendrawtransaction
2013-09-22 16:44:35 -07:00
Wladimir J. van der Laan c2f4187263 Merge pull request #2995 from Diapolo/GUI_message
Bitcoin-Qt: BitcoinGUI::message() updates/fixes
2013-09-20 23:38:56 -07:00
Philip Kaufmann faaeae1eb3 fix some printf -> LogPrintf leftovers 2013-09-20 10:49:34 +02:00
Pieter Wuille e0e14e43d9 Use 'low S' as malleability breaker rather than 'even S' 2013-09-20 09:30:41 +02:00
Pieter Wuille 367c29d6e0 Bugfix: nHeightLast instead of nHeightFirst 2013-09-19 10:44:35 +02:00
Pieter Wuille 1657ed2ab4 Fix minor unit test memory leaks 2013-09-19 00:01:46 +02:00
Cory Fields dee632cc25 win32: add version info to bitcoind.exe
TODO: Add icon info
2013-09-18 17:58:53 -04:00
Cory Fields 7a3df1cd94 autotools: fix the Makefile.include to be safely included anywhere.
This way we can reuse rules rather than duplicating them.
2013-09-18 17:12:39 -04:00
Cory Fields c546dc05bb autotools: fix subdir m4 check, never let it return -I
If BDB_CPPFLAGS returns only "-I", the next argument sent to the preprocessor
is treated as a path. There are 2 fixes here:

1. Check in CPPFLAGS, as a user might have manually passed a path to check.
2. Ensure the value is not empty before setting BDB_CPPFLAGS to "-I value"
2013-09-18 17:11:41 -04:00
Wladimir J. van der Laan 9a4a7d3c6a qt: english translation update 2013-09-18 13:32:09 +02:00
Jeff Garzik acafc9ceb1 Add src/.gitignore: ignore src/test_bitcoin 2013-09-18 07:07:41 -04:00
Gavin Andresen 881a85a22d Replace printf with LogPrintf / LogPrint 2013-09-18 20:39:25 +10:00
Gavin Andresen e51321fb75 Refactor: OutputDebugStringF -> LogPrint(category, ...) 2013-09-18 20:39:24 +10:00
Gregory Maxwell d6eb259953 [Fee logic] Don't count txins for priority to encourage sweeping.
This changes the priority calculation to not include the size of per-txin
 data including up to 110 bytes of scriptsig so that transactions which
 sweep up extra UTXO don't lose priority relative to ones that don't.

I'd toyed with some other variations, but it seems like any formulation
 which results in an incentive stronger than making them not count will
 sometimes create incentives to add extra outputs so that you have
 extra inputs to consume later.  The maximum credit is limited so that
 users don't lose the disincentive to stuff random data in their
 transactions, the limit of 110 is based on the size of a P2SH
 redemption with a compressed public key.

This shouldn't need a staged deployment because the priority is not
 used as a relay criteria, only a mining criteria.
2013-09-17 10:56:54 -07:00
coblee d64eef48a4 Add getnetworkhashps to get the calculated network hashrate 2013-09-17 11:15:02 +08:00
Cory Fields 152e51c7af included-tests: generate binary data from test files for inclusion into test binaries
This change moves test data into the binaries rather than reading them from
the disk at runtime.

Advantages:
- Tests become distributable
- Cross-compile friendly. Build on one machine and execute in an arbitrary
  location on another.
- Easier testing for backports. Users can verify that tests pass without having
  to track down corresponding test data.
- More trustworthy test results and easier quality assurance as tests make
  fewer assumptions about their environment.
- Tests could theoretically run at client/daemon startup and exit on failure.

Disadvantages:
- Required 'hexdump' build-dependency. This is a standard bsd tool that should
  be usable everywhere. It is likely already installed on all build-machines.
- Tests can no longer be fudged after build by altering test-data.
2013-09-16 12:53:11 -04:00
Jeff Garzik a25cd0bfdf Merge pull request #3000 from gmaxwell/more_osx_fsync
More fixes for blockchain corruption on OSX.
2013-09-16 06:25:12 -07:00
Cory Fields cae63be6c9 autotools: fix a parallel build race condition spotted by the pull-tester
libleveldb.a and libmemenv.a should be able to build in parallel, but in
practice calling the leveldb makefile ends up rewriting build_config.mk. If
one target tries to build while the other is halfway through writing the
.mk, the make ends up in an undefined state.

Fix that by making one depend on the other. This also reorders the variables
to be passed by param rather than via the environment, and combines the targets
into a single rule to avoid needless duplication.
2013-09-16 01:59:03 -04:00
Gregory Maxwell e7bad10c12 More fixes for blockchain corruption on OSX.
As we'd previously learned, OSX's fsync is a data eating lie.

Since 0.8.4 we're still getting some reports of disk corruption on
 OSX but now all of it looks like the block files have gotten out of
 sync with the database. It turns out that we were still using fsync()
 on the block files, so this isn't surprising.
2013-09-15 20:34:29 -07:00
Gavin Andresen 2975db76b3 Merge pull request #2996 from theuni/qt-translation
Update translation process for autotools
2013-09-14 16:17:27 -07:00
Cory Fields 21ffa3ce3a autotools: add translate target for qt translations 2013-09-14 12:11:38 -04:00
Philip Kaufmann b26f9d893c Bitcoin-Qt: BitcoinGUI::message() updates/fixes
- ensure message boxes are shown in center of our main window, not
  centered on the users desktop
- always prefer user supplied titles for message boxes over the functions
  defaults (fixes a bug, where transaction info messages did not contain
  information, if it was incoming or outgoing)
2013-09-14 18:04:30 +02:00
Cory Fields f286aa1611 autotools: rearrange qt sources to make them more flexible
Add BITCOIN_MM QR_CPP and BITCOIN_CPP in order to better accomodate complicated
targets. This is a no-op change.
2013-09-14 11:51:44 -04:00
Peter Todd 2253642287
Make validateaddress provide redeemScript 2013-09-12 22:54:43 -04:00
Peter Todd be066fad7d Add RPC call decodescript 2013-09-12 22:53:54 -04:00
Peter Todd 463c9710f5 Move Parse{Hash|Hex} to be usable by all RPC code 2013-09-12 22:53:54 -04:00
Gregory Maxwell 11a79680b1 Merge pull request #2979 from luke-jr/autoconf
Autoconf fixes
2013-09-10 17:51:05 -07:00
Gregory Maxwell 85311c1ef8 Merge pull request #2982 from gmaxwell/20130908_ccoins_corrupt
Longer term workaround for chainstate corruption from negative versions.
2013-09-10 16:07:34 -07:00
Luke Dashjr 1e9d3b1392 Bugfix: Since test_bitcoin is being built and run inside src/test/, try using relative directories from that point 2013-09-10 23:04:56 +00:00
Luke Dashjr 941dba1783 configure: Check common include subdirectories for bdb headers, and refuse to use any version other than 4.8 by default 2013-09-10 22:26:00 +00:00
Cory Fields b4d8d03b86 autotools: use an absolute path to test data 2013-09-10 18:23:22 -04:00
Philip Kaufmann d78900cc1b fix some cosmetic glitches in the codebase
- rename URL into URI in paymentserver where correct
- add some missing Qt-coding-stuff in paymentserver
- change QSpinBox to QLineEdit as base for BitcoinAmountField in .ui files
  (as this is the result when converting the BAF back into base)
- remove some c_str() and replace with QString::fromStdString()
- remove several new-lines
- remove unneeded spaces
- indentation fixes
2013-09-09 12:36:04 +02:00
Gregory Maxwell f8b7aa8625 Longer term workaround for chainstate corruption from negative versions.
This also makes negative transaction versions non-standard.

This avoids an issue triggered in block 256818 where transactions with
negative version numbers were incorrectly serialized into the UTXO set.

On restart nodes detect the inconsistency and refuse to start so long as
a block with these transactions is inside the self-consistency check
window, logging "coin database inconsistencies found". The software
recommends reindexing, but reindexing does not correct the problem.

This should be fixed by changing the chainstate serialization, but
working around it seems harmless for now because the version is not
used by any network rule currently.

A patch free workaround is to start with -checklevel=2 which skips
the consistency checks, but the IsStandard change is important for
miners in order to protect unpatched nodes.
2013-09-09 02:11:11 -07:00
Gavin Andresen 4c723841e2 Merge pull request #2968 from TheBlueMatt/master
Don't warn about forks while fIsInitialDownload
2013-09-08 17:48:42 -07:00
Gregory Maxwell 102518fdb7 Rename -tor to -onion to better reflect what it does.
I've seen users confused multiple times thinking they
 should be using -tor to set their tor proxy and then
 finding in horror that they were still connecting to
 the IPv4 internet.

Even Jeff guesses wrong about what the knob does, so
 I think we should rename it. This leaves the old
 knob working, we can pull it out completely in a
 later release.
2013-09-08 04:54:06 -07:00
Jeff Garzik 15fd245b9a Merge pull request #2943 from theuni/autotools-final
Autotools buildsystem
2013-09-06 17:09:55 -07:00
Wladimir J. van der Laan 495242c1ad Merge pull request #2976 from laanwj/2013_09_txid_details
qt: add vout index to transaction id in transactions details dialog
2013-09-06 04:21:45 -07:00
Wladimir J. van der Laan ed4c7fd4fd qt: add vout index to transaction id in transactions details dialog 2013-09-06 12:12:18 +02:00
Philip Kaufmann 42018eff07 Bitcoin-Qt: Use qDebug() for printing to debug.log
- removes all usages of PrintDebugStringF from Qt code
- ensure same format for all debug.log messages "functionname : Message"
2013-09-06 10:32:07 +02:00
Cory Fields 35b8af9226 autotools: switch to autotools buildsystem 2013-09-05 21:31:03 -04:00
Gregory Maxwell a22eed6a1e Make settxfee clear that units are btc/kb. 2013-09-05 17:56:13 -07:00
Gavin Andresen 2fee100f03 Merge pull request #2944 from gavinandresen/acceptheader
Set Accept: application/bitcoin-paymentrequest header
2013-09-03 19:52:38 -07:00
Matt Corallo 55ed3f1475 Don't warn about forks while fIsInitialDownload 2013-09-03 22:22:13 -04:00
Gregory Maxwell dd30937ce3 Merge pull request #2948 from jgarzik/changeaddr
RPC: add getrawchangeaddress, for raw transaction change destinations
2013-09-02 20:29:02 -07:00
Wladimir J. van der Laan f4f048ee58 Merge pull request #2958 from laanwj/2013_08_txfee2
[Qt] Display txfee in first sendCoinsDialog message box
2013-09-02 09:48:10 -07:00
Timothy Stranex ccf3af77c1 Fix typo in a comment: it's base58, not base48. 2013-09-02 17:27:27 +02:00
Wladimir J. van der Laan 1537d174d7 Merge pull request #2951 from laanwj/2013_08_addressbook_purpose
[Qt] Handle address purpose in incremental updates
2013-09-02 05:47:58 -07:00
Philip Kaufmann e664c3d70c Bitcoin-Qt: allow to differentiate Qt log entries from core
- prepend "Bitcoin-Qt" in front of debug.log entries, which come from Qt
- move DebugMessageHandler installation upwards to the event handler
  installation, which fits much better
2013-08-31 15:35:39 +02:00
Jonas Schnelli 9e8904f6ae qt: Display txfee in first sendCoinsDialog message box
Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>
2013-08-31 12:41:47 +02:00
Wladimir J. van der Laan 9d2fee17e0 qt: Use GUIUtil::HtmlEscape to escape HTML
This is why we created this function. Avoids some #ifdef.
2013-08-30 14:38:09 +02:00
Wladimir J. van der Laan 5da998e887 qt: Add comment to sorting step in refreshAddressTable 2013-08-30 08:25:25 +02:00
Wladimir J. van der Laan 1a12b3e090 Merge pull request #2930 from Diapolo/displayUnit
Bitcoin-Qt: fixes for using display unit from options
2013-08-29 07:37:30 -07:00
Wladimir J. van der Laan dcd0b0775e qt: Handle address purpose in incremental updates
Correctly use the purpose of addresses that are added after the start
of the client. Addresses with purpose "refund" and "change" should not
be visible in the GUI. This is now handled correctly.
2013-08-29 16:25:51 +02:00
Pieter Wuille ae6eac667b Merge pull request #2940 from Diapolo/checkpoint
move Checkpoints:fEnabled from step 2 to step 3 in init
2013-08-29 01:59:35 -07:00
Philip Kaufmann bdd0c59ab0 Bitcoin-Qt: fixes for using display unit from options
- extend PaymentServer with setOptionsModel() and rework initNetManager()
  to make use of that
- fix all other places in the code to use display unit from options and no
  hard-coded unit
2013-08-29 10:38:51 +02:00
patrick s a42eef6f10 verify vchPubKey matches calculated public key unless fSkipCheck is set 2013-08-29 01:11:47 -07:00
patrick s 6e51b3bddf improve wallet load time by removing duplicated calls to EC_KEY_check_key and adding a hash for vchPubKey/vchPrivKey entries in wallet.dat
backwards compatible with previous wallet.dat format
2013-08-28 23:53:26 -07:00
Gregory Maxwell 9d14e689c8 [raw] reject insanely high fees by default in sendrawtransaction
There have been several incidents where mainnet experimentation with
 raw transactions  resulted in insane fees.  This is hard to prevent
 in the raw transaction api because the inputs may not be known.
 Since sending doesn't work if the inputs aren't known, we can catch
 it there.

This rejects fees > than 10000 * nMinRelayTxFee or 1 BTC with the
 defaults and can be overridden with a bool at the rpc.
2013-08-28 15:49:51 -07:00
Jeff Garzik e5e9904c1c RPC: add getrawchangeaddress, for raw transaction change destinations 2013-08-28 16:29:52 -04:00
Wladimir J. van der Laan ff33a3470d Merge pull request #2931 from Diapolo/intro
Bitcoin-Qt: add testnet check and icon to intro dialog
2013-08-28 12:17:17 -07:00
Gregory Maxwell 1ef0067eab Merge pull request #2904 from gmaxwell/newaddr-no-passphrase
[QT] Don't ask for a passphrase to getnewaddress.
2013-08-28 11:20:09 -07:00
Gregory Maxwell bf3a20a6e8 [wallet] Consider generated coins mature at COINBASE_MATURITY+1
We're not seeing large reorgs that would justify waiting a large
 amount past the rule required maturity, and the extra three
 hours is just a nuisance. Take one more block to at least give
 the 100th block time to propagate.
2013-08-28 10:16:50 -07:00
Gavin Andresen b773da064d Set Accept: application/bitcoin-paymentrequest header
Suggestion from BitPay: set an Accept: HTTP header when
fetching payment requests / payment ACKs.
2013-08-28 11:48:39 +10:00
Jeff Garzik bb7d0fc12f Merge pull request #2928 from jgarzik/cnb-txout
CreateNewBlock / getblocktemplate cleaning
2013-08-25 18:49:25 -07:00
Gavin Andresen b62dc051aa Merge pull request #2938 from petertodd/op-reserved-weirdness
Document and test OP_RESERVED weirdness
2013-08-25 18:17:59 -07:00
Jeff Garzik f1dbed9233 miner: constify CreateNewBlock() arg scriptPubKeyIn 2013-08-25 20:16:23 -04:00
Peter Todd 214d45b6b9
Document and test OP_RESERVED weirdness
Seems it was forgotten about when IsPushOnly() and the unittests were
written. A particular oddity is that OP_RESERVED doesn't count towards
the >201 opcode limit unlike every other named opcode.
2013-08-25 12:37:07 -04:00
Pieter Wuille 8a9e538227 Merge pull request #2935 from sipa/obounds
Fix out-of-bounds check
2013-08-25 07:42:21 -07:00
Philip Kaufmann 60fc1b4034 move Checkpoints:fEnabled from step 2 to step 3 in init
- it belongs to parameter-to-internal flags step, not parameter
  interactions phase
2013-08-25 13:25:21 +02:00
Jeff Garzik 3d86e7cd48 Merge pull request #2618 from fcicq/solaris-support
Partial solaris support
2013-08-24 20:19:24 -07:00
Jeff Garzik 750ae29664 Merge pull request #2852 from petertodd/getblock-chainwork
Add 'chainwork' to getblock
2013-08-24 19:45:50 -07:00
Pieter Wuille 24e5d7d5ae Fix out-of-bounds check 2013-08-24 23:22:27 +02:00
Pieter Wuille 877b5e3653 Merge src/leveldb changes for LevelDB 1.13 2013-08-24 22:21:41 +02:00
Philip Kaufmann d9baa28f92 Bitcoin-Qt: add testnet check and icon to intro dialog 2013-08-24 15:20:37 +02:00
Jeff Garzik 7bb0f6c5e8 RPC: getblocktemplate does not require a key, to create a block template
getblocktemplate only uses certain portions of the coinbase transaction,
notably ignoring the coinbase TX output entirely.

Use CreateNewBlock() rather than CreateNewBlockWithKey(), eliminating
the needless key passing.

Should be zero behavior changes.
2013-08-24 00:45:17 -04:00
Jeff Garzik 7e17018995 CreateNewBlock() now takes scriptPubKey argument,
rather than a key.

CreateNewBlockWithKey() helper is added to restore existing functionality,
making this an equivalent-transformation change.
2013-08-24 00:33:46 -04:00
Gregory Maxwell 71ac5052d8 Remove fAllowReuse from GetKeyFromPool.
With the GUI password fix this was always false.
2013-08-23 12:54:50 -07:00
Gregory Maxwell 20469d83dd [QT] Don't ask for a passphrase to getnewaddress.
With an encrypted wallet the GUI was prompting for a passphrase every time
 the user requested a new address.  This is unnecessary, increases the
 exposure to keyboard sniffers, and discourages using fresh addresses for
 every transaction.

Instead only prompt for a passphrase when the keypool runs out, also call
 the new address function with the flag that prevents reuse.

Thanks to AlexNagy on IRC for pointing this out and who wouldn't take any
 lip from a curmudgeonly developer and insisted on what he knew to be true.
2013-08-23 12:01:57 -07:00
Philip Kaufmann 6728e00776 Bitcoin-Qt: extend some checks for valid model pointers 2013-08-23 13:07:20 +02:00
Philip Kaufmann dbc0a6aba2 Bitcoin-Qt: tweak Qt walletXXX.cpp/h code
WalletView:
- add new signal showNormalIfMinimized()
- emit the new signal in handleURI() to fix a bug, preventing the main
  window to show up when using bitcoin: URIs

WalletStack:
- connect the showNormalIfMinimized() signal from WalletView with the
  showNormalIfMinimized() slot in BitcoinGUI
- rework setCurrentWallet() to return a bool
- add check for valid walletModel in addWallet()
- add missing gui attribute initialisation in constructor

WalletFrame:
- remove unused or unneded class attributes gui and clientModel
- add a check for valid clientModel in setClientModel()

General:
- small code formatting changes
2013-08-23 09:10:31 +02:00
Gavin Andresen e62f8d72f3 Merge pull request #2539 from gavinandresen/paymentrequest
Payment Protocol Work
2013-08-22 01:54:28 -07:00
Gavin Andresen a41d5fe019 Payment Protocol: X509-validated payment requests
Add support for a Payment Protocol to Bitcoin-Qt.

Payment messages are protocol-buffer encoded and communicated over
http(s), so this adds a dependency on the Google protocol buffer
library, and requires Qt with OpenSSL support.
2013-08-22 16:18:25 +10:00
Gavin Andresen 47d0534368 Route qDebug() messages to debug.log 2013-08-22 11:05:45 +10:00
Gavin Andresen a73aa68b84 Rework when payment server is started 2013-08-22 11:05:45 +10:00
Philip Kaufmann a2189fbaf6 update SelectParamsFromCommandLine() handling/order
- move SelectParamsFromCommandLine() from init.cpp to bitcoin.cpp to allow
  to use TestNet() for Bitcoin-Qt instead of GetBoolArg("-testnet", false)
- change order in bitcoind.cpp to match bitcoin.cpp functionality
- hamonize error message strings for missing datadir and failing
  SelectParamsFromCommandLine() in bitcoin.cpp and bitcoind.cpp
- use TestNet() call in splashscreen.cpp
2013-08-22 11:05:45 +10:00
Gavin Andresen 3624356e82 Refactor: Move GetAccountAddresses to CWallet 2013-08-22 11:05:45 +10:00
Gavin Andresen 618855133d Refactor: CAddressBookData for mapAddressBook
Straight refactor, so mapAddressBook stores a CAddressBookData
(which just contains a std::string) instead of a std::string.

Preparation for payment protocol work, which will add the notion
of refund addresses to the address book.
2013-08-22 11:05:45 +10:00
Gavin Andresen b94595bb7f GetDataDir(): cache paths for each network separately 2013-08-22 11:05:44 +10:00
Gavin Andresen 57d80467f1 Reject dust amounts during validation
Replaces the validation check for "amount == 0" with an isDust check,
so very small output amounts are caught before the wallet
is unlocked, a transaction is created, etc.
2013-08-22 11:05:44 +10:00
Philip Kaufmann 88ff655987 translations update for 0.8.4
- update translation master files
- include current translations from Transifex
- add several new languages
- fix a bug in bitcoin.qrc, which prevents some languages from beeing used
  (wrong file extension .ts instead of .qm was used)
2013-08-21 15:35:50 +02:00
Gavin Andresen b986663ccd Merge pull request #2919 from gmaxwell/bloom_faster
Update the bloom state on the real object, not the temporary one.
2013-08-20 20:12:51 -07:00
Gregory Maxwell a7f533a972 Update the bloom state on the real object, not the temporary one.
This resulted in just passing all transactions to filtered wallets
which worked surprisingly well, except where it didn't.
2013-08-20 17:46:07 -07:00
Gavin Andresen 449fb40aa9 Merge pull request #2915 from petertodd/murmurhash-tests
Add MurmurHash3() unit test
2013-08-20 17:19:28 -07:00
Gavin Andresen 5250fdcc6c Merge pull request #2914 from gmaxwell/bloom_faster
Performance optimization for bloom filters.
2013-08-20 15:52:49 -07:00
Pieter Wuille b28d8b423b Merge leveldb subtree change.
* On Mac OS X fsync does not guarantee write to disk. Use fcntl F_FULLFSYNC instead.
2013-08-20 15:13:34 +02:00
Peter Todd 4eecdcacaf
Add MurmurHash3() unit test
Useful as a source of test vectors to anyone re-implementing bloom
filters.
2013-08-20 07:30:39 -04:00
Gregory Maxwell 37c6389c5a Performance optimization for bloom filters.
This reduces a peer's ability to attack network resources by
 using a full bloom filter, but without reducing the usability
 of bloom filters.  It sets a default match everything filter
 for peers and it generalizes a prior optimization to
 cover more cases.
2013-08-20 02:27:26 -07:00
Gavin Andresen bb237705d0 Checkpoint at block 250,000 2013-08-20 17:30:33 +10:00
phelixbtc d1862bf309 makefile.mingw: Fix Win32 RPC Crashes.
8864019f6d
2013-08-19 17:19:08 +02:00
Pieter Wuille 4a9a8f3f48 Merge commit '84d6d69fc69662b2709fffbeaf3c3b4f53c535b1' 2013-08-18 00:58:04 +02:00
Gavin Andresen 317f57ec87 Merge pull request #2903 from Michagogo/listsinceblock-help
Clarified the listsinceblock help test
2013-08-15 20:34:00 -07:00
Gavin Andresen 31b28082fe Merge pull request #2891 from gavinandresen/leveldb_printerror
Use HandleError() consistently to handle leveldb errors
2013-08-15 19:02:32 -07:00
Gavin Andresen 3f20f82209 Merge pull request #2880 from gavinandresen/test_numequal
More unit tests for OP_NUMEQUAL
2013-08-15 18:53:49 -07:00
Gavin Andresen a0bb001431 Merge pull request #2886 from gavinandresen/rpctiming
Make RPC password resistant to timing attacks
2013-08-15 18:53:26 -07:00
Gavin Andresen 9be4cff5f6 Merge pull request #2876 from sipa/fixreorgcrash
Fix reorganization crash
2013-08-15 18:51:06 -07:00
Gregory Maxwell 47491a90b6 Merge pull request #2131 from sipa/evens
Only create signatures with even S, and verification mode to check.
2013-08-15 18:42:28 -07:00
Gavin Andresen 13d3b1c144 Merge pull request #2829 from sipa/bip32
BIP 32 derivation + test vectors
2013-08-15 16:40:03 -07:00
Pieter Wuille a81cd96805 Only create signatures with even S, and verification mode to check.
To fix a minor malleability found by Sergio Lerner (reported here:
https://bitcointalk.org/index.php?topic=8392.msg1245898#msg1245898)

The problem is that if (R,S) is a valid ECDSA signature for a given
message and public key, (R,-S) is also valid. Modulo N (the order
of the secp256k1 curve), this means that both (R,S) and (R,N-S) are
valid. Given that N is odd, S and N-S have a different lowest bit.
We solve the problem by forcing signatures to have an even S value,
excluding one of the alternatives.

This commit just changes the signing code to always produce even S
values, and adds a verification mode to check it. This code is not
enabled anywhere yet. Existing tests in key_tests.cpp verify that
the produced signatures are still valid.
2013-08-16 00:17:50 +02:00
Pieter Wuille 2461aba1ac Mempool consistency check 2013-08-15 23:55:35 +02:00
Pieter Wuille f0784ac470 Fix non-standard disconnected transactions causing mempool orphans 2013-08-15 23:53:55 +02:00
Micha 9afe5a2c32 Clarified the listsinceblock help test
Specifically, the fact that the command
relates to wallet transactions.
2013-08-16 00:15:39 +03:00
Gavin Andresen 4323bfeafd Merge pull request #2776 from jgarzik/keypoolsize
RPC: keypoolrefill now permits optional size parameter, to bump keypool
2013-08-14 22:01:22 -07:00
Gavin Andresen 8fa9b5cc45 Merge pull request #2658 from TheBlueMatt/forkalert
Detect any sufficiently long fork and alert the user just like any other alert
2013-08-12 23:33:40 -07:00
Roman Mindalev 2b6a8993fb Add missing 0x prefix in chainparams.cpp 2013-08-12 18:28:23 +04:00
Gavin Andresen b35e993200 Use HandleError() consistently to handle leveldb errors 2013-08-12 18:06:17 +10:00
Cozz Lovan c7fa1a3586 do not call BuildMerkleTree() unnecessarily twice 2013-08-10 15:27:25 +02:00
Gavin Andresen 8dc206a1e2 Reject non-canonically-encoded sizes
The length of vectors, maps, sets, etc are serialized using
Write/ReadCompactSize -- which, unfortunately, do not use a
unique encoding.

So deserializing and then re-serializing a transaction (for example)
can give you different bits than you started with. That doesn't
cause any problems that we are aware of, but it is exactly the type
of subtle mismatch that can lead to exploits.

With this pull, reading a non-canonical CompactSize throws an
exception, which means nodes will ignore 'tx' or 'block' or
other messages that are not properly encoded.

Please check my logic... but this change is safe with respect to
causing a network split. Old clients that receive
non-canonically-encoded transactions or blocks deserialize
them into CTransaction/CBlock structures in memory, and then
re-serialize them before relaying them to peers.

And please check my logic with respect to causing a blockchain
split: there are no CompactSize fields in the block header, so
the block hash is always canonical. The merkle root in the block
header is computed on a vector<CTransaction>, so
any non-canonical encoding of the transactions in 'tx' or 'block'
messages is erased as they are read into memory by old clients,
and does not affect the block hash. And, as noted above, old
clients re-serialize (with canonical encoding) 'tx' and 'block'
messages before relaying to peers.
2013-08-09 10:01:35 +10:00
Gavin Andresen 42656ea2e5 Make RPC password resistant to timing attacks
Fixes issue#2838; this is a tweaked version of pull#2845 that
should not leak the length of the password and is more generic,
in case we run into other situations where we need
timing-attack-resistant comparisons.
2013-08-08 19:58:57 +10:00
Gavin Andresen 6cc766fa55 Merge pull request #2856 from Diapolo/crypter_headers
remove windows.h from crypter.cpp includes
2013-08-08 02:16:56 -07:00
Gavin Andresen 9d23db58c1 Merge pull request #2883 from codler/patch-5
Replace with existing constants
2013-08-07 04:44:57 -07:00
Han Lin Yap 1511769239 Use existing RPC_INVALID_PARAMETER constant 2013-08-07 10:14:33 +02:00
Gavin Andresen ddd0e2f616 Merge pull request #2871 from gavinandresen/simplify_maporphan
Simplify storage of orphan transactions, fix CVE-2013-4627
2013-08-06 17:11:48 -07:00
Philip Kaufmann 265e2657b4 remove a newline from a string in init.cpp
- to match all other translatable strings in init.cpp and to simplify
  translations via Transifex
2013-08-06 10:28:52 +02:00
Gavin Andresen bdd34642dc More unit tests for NUMEQUAL 2013-08-06 16:06:07 +10:00
Wladimir J. van der Laan e07d9f77e9 Merge pull request #2879 from Diapolo/translations
translations update for Transifex 2013-08-05
2013-08-05 03:34:55 -07:00
Philip Kaufmann 0f1c8f23eb translations update for Transifex 2013-08-05 2013-08-05 11:06:45 +02:00
Gavin Andresen ae759b3788 Merge pull request #2849 from petertodd/if-else-else
Add unittests for multiple ELSEs in a row
2013-08-05 01:53:57 -07:00
Gavin Andresen 15047f5af0 Merge pull request #2851 from TheBlueMatt/master
Prepare for mempool testing in pull-tester and fix multi-block transaction resurrection
2013-08-05 01:53:17 -07:00
Gavin Andresen 2af267c150 Merge pull request #2857 from Diapolo/compat_cleanup
cleanup compat.h Windows stuff
2013-08-05 01:48:35 -07:00
Gavin Andresen e622f3f195 Merge pull request #2855 from Diapolo/guard_CreatePidFile
exclude CreatePidFile() function on WIN32 as it is unused
2013-08-05 01:05:59 -07:00
Gavin Andresen a4ae02969e Merge pull request #2827 from Diapolo/rpccon_winpos
Bitcoin-Qt: save and restore position of debug window
2013-08-05 00:58:05 -07:00
Gavin Andresen d687aaa311 Merge pull request #2865 from Diapolo/fix_intro_translation
fix string in intro.cpp, which is untranslatable on Transifex
2013-08-05 00:24:49 -07:00
Gavin Andresen 159bc48193 Simplify storage of orphan transactions
Orphan transactions were stored as a CDataStream pointer;
this changes the mapOrphanTransactions data structures to
store orphans as a CTransaction.

This also fixes CVE-2013-4627 by always re-serializing
transactions before relaying them.
2013-08-02 16:10:25 +10:00
Gavin Andresen 8f6f92c72b Revert "Truncate oversize 'tx' messages before relaying/storing."
This reverts commit c40a5aaaf4.
2013-08-02 15:50:04 +10:00
Wladimir J. van der Laan 6d89611c3a Merge pull request #2850 from Diapolo/fix_intro
fix possible infinite loop in intro.cpp thread
2013-07-31 22:15:05 -07:00
Jeff Garzik d247a5d130 Move internal miner/block creation to separate miner.cpp module.
Public functions referenced elsewhere are added to miner.h.
2013-07-31 09:43:35 -04:00
Jeff Garzik 18946846d5 Minor miner fixes (hey hey it's fun to say)
* Fix UpdateCoins() definition in main.h
* Remove pwalletMain reference from BitcoinMiner(), as it is passed
  a wallet argument.
2013-07-31 08:45:49 -04:00
Gavin Andresen 050d2e953f Remove #define loop from util.h
Replace the loop macro with while (true). The #define caused
problems for Qt.
2013-07-31 14:06:44 +10:00
Philip Kaufmann bef9f573b5 fix string in intro.cpp, which is untranslatable on Transifex
- seems the code tags in the original string cause errors, when using the
  Transifex site for translation
2013-07-29 16:56:03 +02:00
Philip Kaufmann c431e9f1f0 Bitcoin-Qt: save and restore position of debug window
- move the code for saving and restoring window positions from BitcoinGUI
  to GUIUtil, make it more generic and also use it for saving/restoring
  debug window positions
2013-07-29 16:22:46 +02:00
Pieter Wuille c4316fefa5 Make sure new wallet variables are initialized 2013-07-29 02:34:01 +02:00
Pieter Wuille 4bb77b4963 Merge pull request #2541 from luke-jr/bugfix_wallet_resend
Bugfix: Store last/next wallet resend times unique per CWallet object
2013-07-28 17:21:21 -07:00
Pieter Wuille 83a3597071 Merge pull request #2702 from vinniefalco/leveldb-subtree-at-1-10-0
Leveldb subtree at 1 12 0
2013-07-28 03:57:17 -07:00
Philip Kaufmann 5bc6d8e580 fix possible infinite loop in intro.cpp thread
- it was possible to trigger an infinite loop in FreespaceChecker::check() by
  simply removing the drive letter on Windows (which leads to an infinite
  loop in the FreespaceChecker thread)
- this was caused by not checking if we make progress with
  parentDir.parent_path()
2013-07-26 09:17:24 +02:00
Wladimir J. van der Laan 2b894bceac Merge pull request #2847 from Diapolo/fix_QApplication_include
Bitcoin-Qt: fix QApplication includes to match our include defaults
2013-07-25 22:42:16 -07:00
Wladimir J. van der Laan 7d3a50ddbe Merge pull request #2848 from Diapolo/translations
update bitcoin_en.ts to current master (2013-07-23)
2013-07-25 22:41:51 -07:00
Gavin Andresen 5e67e124cf Merge pull request #1889 from tcatm/multi-wallet
let user select wallet file with -wallet=foo.dat
2013-07-24 22:52:21 -07:00
Philip Kaufmann 852605d8d1 remove windows.h from crypter.cpp includes
- remove an unneeded windows.h include (comes from allocators.h, which is
  included in crypter.h)
2013-07-24 22:35:44 +02:00
Philip Kaufmann dd833a4cd8 cleanup compat.h Windows stuff
- remove an unneded include for mswsock.h as we use winsock2.h anyway
- move typedef u_int SOCKET; into the #ifndef WIN32 part
- remove typedef int socklen_t;  as this is defined in ws2tcpip.h
2013-07-24 16:24:38 +02:00
Philip Kaufmann a034c7ebb6 exclude CreatePidFile() function on WIN32 as it is unused 2013-07-24 09:30:09 +02:00
Peter Todd 1b3656d50b Add 'chainwork' to getblock
Returns nChainWork from the block index, the total work done by all
blocks since the genesis block.
2013-07-24 01:58:23 -04:00
Matt Corallo 9bf2a4aba2 Fix multi-block reorg transaction resurrection 2013-07-23 18:02:27 +02:00