Commit graph

2932 commits

Author SHA1 Message Date
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
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
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
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
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
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