Commit Graph

73 Commits

Author SHA1 Message Date
Jonas Schnelli 50c72f23ad [Move Only] Move wallet related things to src/wallet/
could once be renamed from /src/wallet to /src/legacywallet.
2015-03-12 14:13:02 +01:00
Cory Fields 1630219d90 openssl: abstract out OPENSSL_cleanse
This makes it easier for us to replace it if desired, since it's now only in
one spot. Also, it avoids the openssl include from allocators.h, which
essentially forced openssl to be included from every compilation unit.
2015-02-15 11:34:02 -05:00
Philip Kaufmann a6516686dc [Qt] prevent amount overflow problem with payment requests
Bitcoin amounts are stored as uint64 in the protobuf messages (see
paymentrequest.proto), but CAmount is defined as int64_t. Because
of that we need to verify that single and accumulated amounts are
in a valid range and no variable overflow has happened.

- fixes #5624 (#5622)

Thanks @SergioDemianLerner for reporting that issue and also supplying us
with a possible solution.

- add static verifyAmount() function to PaymentServer and move the logging
  on error into the function
- also add a unit test to paymentservertests.cpp
2015-02-04 13:47:32 +01:00
Pavel Janík 5262fde0ec Remove whitespaces before double colon in errors and logs 2015-01-31 17:38:28 -05:00
Wladimir J. van der Laan 7823598fa4
Merge pull request #5620
6715efb [Qt] Payment request expiration bug fix (re-done) (Philip Kaufmann)
2015-01-29 12:48:27 +01:00
Philip Kaufmann 0c03a93e70 [Qt] add debug logging for -rootcertificates option
- now logs if -rootcertificates="" was used to disable payment request
  authentication via X.509 certificates
- also logs which file is used as trusted root cert, if -rootcertificates
  is set
2015-01-15 14:30:44 +01:00
Philip Kaufmann 6715efb9ca [Qt] Payment request expiration bug fix (re-done)
- this is based on #4122 (which can be closed)

Currently a payment request is only checked for expiration upon receipt.
It should be checked again immediately before sending coins to prevent
the user from paying to an expired invoice which would then require a
customer service interaction.

- add static verifyExpired() function to PaymentServer to be able to use
  the same validation code in GUI and unit-testing code
- extend unit tests to use that function and also add an unit test which
  overflows, because payment requests allow expires as uint64, whereas we
  use int64_t for verification of expired payment requests
2015-01-15 09:08:22 +01:00
Philip Kaufmann 17005bc0fc [Qt] add payment request unit test for non matching networks
- verify that payment request network matches client network
- add static verifyNetwork() function to PaymentServer to be able to use
  the same validation code in GUI and unit-testing code
2015-01-14 13:15:26 +01:00
Cory Fields a3241998e1 namespace: remove boost namespace pollution 2015-01-02 15:12:03 -05:00
Philip Kaufmann 643415aade [Qt] update a translation string and argument counts 2014-12-31 12:03:00 +01:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01:00
Philip Kaufmann 5ec654b8ce [Qt] update paymentserver license and cleanup ordering 2014-12-08 16:09:02 +01:00
Philip Kaufmann 31f84944a5 [Qt] add BIP70 payment request size DoS protection for URIs
- current code only does this for payment request files, which are
  used on Mac
- also rename readPaymentRequest to readPaymentRequestFromFile, so it's
  obvious that function only handles payment request files and not URIs
- small logging changes in readPaymentRequestFromFile
2014-12-08 16:08:59 +01:00
Philip Kaufmann 2284ccbd13 [Qt] remove dup lock that is done in SetAddressBook() 2014-12-08 16:08:59 +01:00
Philip Kaufmann 1ec753f734 [Qt] ensure socket is set to NULL in PaymentServer::ipcSendCommandLine 2014-12-08 16:08:58 +01:00
Philip Kaufmann 814429dc72 [Qt] add BIP70/BIP71 constants for all messages and mime types
- also rename current ones to match the new ones
- remove constant from guiconstant.h and add it to paymentserver.cpp
2014-12-08 16:08:58 +01:00
Philip Kaufmann b82695b89f [Qt] make PaymentServer::ipcParseCommandLine void
- the function only returned true, so make it void
- add a comment about payment request network detection
2014-12-08 16:08:57 +01:00
Mark Friedenbach a372168e77 Use a typedef for monetary values 2014-09-26 15:42:04 -07:00
Pieter Wuille 0be990ba34 Move CTxDestination from script/script to script/standard 2014-09-16 19:14:32 +02:00
Wladimir J. van der Laan f23869e14b
Merge pull request #4623
e84843c Broken addresses on command line no longer trigger testnet. (Ross Nicoll)
2014-09-10 15:07:58 +02:00
Ross Nicoll e84843c0db Broken addresses on command line no longer trigger testnet.
When passing a bitcoin: URI on the command line, invalid addresses do not incorrectly send the
user to the test network.
2014-08-30 09:39:59 +01:00
Wladimir J. van der Laan ad49c256c3 Split up util.cpp/h
Split up util.cpp/h into:

- string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach)
- money utilities (parsesmoney, formatmoney)
- time utilities (gettime*, sleep, format date):
- and the rest (logging, argument parsing, config file parsing)

The latter is basically the environment and OS handling,
and is stripped of all utility functions, so we may want to
rename it to something else than util.cpp/h for clarity (Matt suggested
osinterface).

Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26 13:25:22 +02:00
Wladimir J. van der Laan 488a616439
qt: Demote ReportInvalidCertificate message to qDebug
Too spammy.
2014-08-04 16:41:42 +02:00
Wladimir J. van der Laan bd26fee10b
qt: Update some messages after suggestions by translators
- *cannot* is more common, thus preferred to *can not*
- Use *Watch-only* instead of *Watchonly* as one word
2014-07-31 16:58:23 +02:00
Ross Nicoll 509f926e80 Payment request parsing on startup now only changes network if a valid network name is specified. 2014-07-08 22:10:46 +01:00
Philip Kaufmann 0127a9be14 remove SOCKS4 support from core and GUI
- now we support SOCKS5 only
2014-07-07 08:15:14 +02:00
Gavin Andresen 13fc83c77b
Move fee policy out of core 2014-07-03 14:42:16 -04:00
Julian Haight dd49e92fb0
qt: fix 'opens in testnet mode when presented with a BIP-72 link with no fallback'
Passes tests:

```
$ ./bitcoin-qt 'bitcoin:?r=http://www.example.com/'
.. fixed the original problem - this launches mainnet.

$ ./bitcoin-qt 'bitcoin:mngeNQbTKnmaMbx8EXCYdwUbnt9JJD52cC'
.. launches testnet

$ ./bitcoin-qt -testnet 'bitcoin:1NXXeQRyMFFFRfyUix2o7mk1vhvk2Nxp78'
.. sanity check - launches mainnet.
```

Fixes #4355. Closes #4411.
2014-07-02 09:47:47 +02:00
Wladimir J. van der Laan 33fdd99288 qt: Change serious messages from qDebug to qWarning
By changing the logging stream for warnings from qDebug to qWarning,
these will always be logged to debug.log.
2014-07-01 15:21:17 +02:00
Wladimir J. van der Laan 84ce18ca93 Remove unnecessary dependencies for bitcoin-cli
This commit removes all the unnecessary dependencies (key, core,
netbase, sync, ...) from bitcoin-cli.

To do this it shards the chain parameters into BaseParams, which
contains just the RPC port and data directory (as used by utils and
bitcoin-cli) and Params, with the rest.
2014-06-25 10:31:35 +02:00
Wladimir J. van der Laan 09eb201b1b Remove `using namespace std` from header file
It's considered bad form to import things into the global namespace in a
header. Put it in the cpp files where it is needed instead.
2014-06-16 17:42:54 +02:00
Philip Kaufmann f5ae6c9826 add NetworkIDString() to chainparams
- returns the BIP70 network string
- use that new function in the core and GUI code and remove unused code
  and functions
2014-06-12 13:19:12 +02:00
Wladimir J. van der Laan 62fdf381fa
Merge pull request #3824
f0a83fc Use Params().NetworkID() instead of TestNet() from the payment protocol (jtimon)
2871889 net.h was using std namespace through chainparams.h included in protocol.h (jtimon)
c8c52de Replace virtual methods with static attributes, chainparams.h depends on protocol.h instead of the other way around (jtimon)
a3d946e Get rid of TestNet() (jtimon)
6fc0fa6 Add RPCisTestNet chain parameter (jtimon)
cfeb823 Add RequireStandard chain parameter (jtimon)
21913a9 Add AllowMinDifficultyBlocks chain parameter (jtimon)
d754f34 Move majority constants to chainparams (jtimon)
8d26721 Get rid of RegTest() (jtimon)
cb9bd83 Add DefaultCheckMemPool chain parameter (jtimon)
2595b9a Add DefaultMinerThreads chain parameter (jtimon)
bfa9a1a Add MineBlocksOnDemand chain parameter (jtimon)
1712adb Add MiningRequiresPeers chain parameter (jtimon)
2014-06-09 12:52:29 +02:00
Gavin Andresen c6cb21d17a Type-safe CFeeRate class
Use CFeeRate instead of an int64_t for quantities that are
fee-per-size.

Helps prevent unit-conversion mismatches between the wallet,
relaying, and mining code.
2014-06-06 10:34:18 -04:00
jtimon f0a83fc256 Use Params().NetworkID() instead of TestNet() from the payment protocol 2014-06-04 15:33:11 +02:00
Philip Kaufmann bdc83e8f45 [Qt] ensure payment request network matches client network
- replaces checks in SendCoinsDialog::handlePaymentRequest() that belong
  to PaymentServer (normal URIs are special cased, as only an isValid
  check is done on BTC addresses)
- prevents the client to handle payment requests that do not match the
  clients network and shows an error instead (mainly a problem with
  drag&drop payment requests onto the client window)
- includes some small comment changes also
2014-05-06 21:20:00 +02:00
Philip Kaufmann 1ba3560fe8 [Qt] let OptionsModel::getProxySettings() directly query proxy
- as a proxy set via GUI can be overridden via -proxy, directly query the
  core to get active proxy
- give a warning, if active proxy is not SOCKS5 (needs to be SOCKS5 for
  the Qt networking code to work)
- also remove an obsolete connect() call from optionsdialog.cpp and a
  reference to Bitcoin-Qt (now just GUI)
2014-01-17 15:43:44 +01:00
Philip Kaufmann c704532294 [Qt] small paymentserver header cleanup 2014-01-14 17:57:32 +01:00
Wladimir J. van der Laan f126973fd0
Merge pull request #3374
bd70562 [Qt] add messages when handling local payment request files (Philip Kaufmann)
2014-01-13 17:11:05 +01:00
Wladimir J. van der Laan 5b45bf400e
Merge pull request #3488
2102ab9 ui: Fix GUI initialization order (Wladimir J. van der Laan)
2014-01-10 11:39:42 +01:00
Wladimir J. van der Laan 28352af060 qt: protect SetAddressBook with cs_wallet lock everywhere 2014-01-06 13:36:24 +01:00
Wladimir J. van der Laan 2102ab9f5c ui: Fix GUI initialization order
Fixes at least #3478.

Splits and documents the phases:
1. Parse command-line options. These take precedence over anything else.
2. Basic Qt initialization (not dependent on parameters or configuration)
3. Application identification
4. Initialization of translations
5. Now that settings and translations are available, ask user for data directory
6. Determine availability of data directory and parse bitcoin.conf
7. URI IPC sending
8. Main GUI initialization

Splits command line parsing logic from ipcSendCommandLine into
ipcParseCommandLine, as isTestNet() can only be overridden in the early
stages before choosing a data directory. Sending however needs to happen
after choosing a data directory.
2014-01-05 12:55:03 +01:00
Philip Kaufmann bd70562f66 [Qt] add messages when handling local payment request files
- important for the open URI dialog to give users feedback
  when a file is invalid etc.
2013-12-10 11:04:37 +01:00
Philip Kaufmann 4cf3411056 [Qt] misc PaymentServer changes (e.g. changes to eventFilter())
- make eventFilter() private and pass events on to QObject::eventFilter()
  instead of just returning false
- re-work paymentservertest.cpp to correctly handle the event test
  after the above change (rewrite test_main to allow usage of
  QCoreApplication:: in the tests)
- delete socket when we were unable to connect in ipcSendCommandLine()
- show a message to the user if we fail to start-up (instead of just a
  debug.log entry)
- misc small comment changes
2013-12-06 11:06:57 +01:00
Gavin Andresen 1e01f7c506 Payment request URI syntax changed, from request=... to r=...
BIP 72 was changed to save six bytes in bitcoin: URIs.
2013-12-04 13:18:09 +10:00
Philip Kaufmann 7634e0d8de [Qt] paymentserver: start netManager in uiReady()
- remove explicit init of netManager as this is done in the constructor
  anyway
- move initNetManager() call to uiReady(), which removes an assert() and
  allows us to use message() in initNetManager() (currently unused but
  could be necessary because of proxy related messages)
- make initNetManager() private
- update paymentservertests.cpp
2013-11-11 14:20:00 +01:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
Wladimir J. van der Laan 65d0fc4b73
Merge pull request #3145
395d0d5 rework an ugly hack in processPaymentRequest() (Philip Kaufmann)
952d2cd make processPaymentRequest() use a single SendCoinsRecipient (Philip Kaufmann)
983cef4 payment-request UI: use SendCoinsRecipient.message for memo (Philip Kaufmann)
c6c97e0 [Qt] Rework of payment request UI (mainly for insecure pr) (Philip Kaufmann)
2013-11-06 16:43:18 +01:00
Wladimir J. van der Laan e592d43f51 qt: add license header to source files
Closes #839
2013-11-04 16:27:09 +01:00
Philip Kaufmann 395d0d5af0 rework an ugly hack in processPaymentRequest()
- use a QStringList to store valid addresses and format them for GUI and
  debug.log usage via .join()
2013-10-31 17:51:40 +01:00