Commit Graph

4182 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 4851d09603
Merge pull request #4446
209377a Use GetBlockTime() more (jtimon)
2014-07-07 10:29:10 +02:00
Wladimir J. van der Laan 5e1b7a23b0
Merge pull request #4470
f4b00be Add CChain::GetLocator() unit test (Pieter Wuille)
3c85d2e Fix CChain::GetLocator (Pieter Wuille)
2014-07-07 10:28:09 +02:00
Wladimir J. van der Laan bc06e8f402
Merge pull request #4463
e832ab7 Rename SendMoneyToDestination to SendMoney. (Daniel Kraft)
2014-07-07 10:22:58 +02:00
jtimon 209377a7cb Use GetBlockTime() more 2014-07-07 10:20:28 +02:00
Wladimir J. van der Laan 6654a87e7b
Merge pull request #4462
3d0e92d [Qt] remove dup includes in bitcoingui (Philip Kaufmann)
2014-07-07 10:16:31 +02:00
Wladimir J. van der Laan 4ea8f632fe
Merge pull request #4467
1f740dd Remove unused variable (R E Broadley)
2014-07-07 10:14:10 +02:00
Wladimir J. van der Laan 73ac7abd08 Move ui_interface to bitcoin_server.a
There is no need for it in the utility libraries or tools.
Put it in init.cpp, and in the tests separately (as they can't link init).
2014-07-07 09:58:56 +02:00
Wladimir J. van der Laan 509030344c qt: Pick translation messages only from necessary files
Utility libraries (common, util) as well as extra tools shouldn't be
parsed for translation messages, only the server and wallet part qualify
here.
2014-07-07 09:57:37 +02:00
Daniel Kraft e832ab7754 Rename SendMoneyToDestination to SendMoney.
Get rid of SendMoney and replace it by the functionality of
SendMoneyToDestination.  This cleans up the code, since only
SendMoneyToDestination was actually used (SendMoney internally from this
routine).
2014-07-07 09:41:33 +02:00
Philip Kaufmann a339a37b28 error out, when we detect -socks argument 2014-07-07 08:15:14 +02:00
Philip Kaufmann 0127a9be14 remove SOCKS4 support from core and GUI
- now we support SOCKS5 only
2014-07-07 08:15:14 +02:00
Wladimir J. van der Laan 4ed2315e86
Merge pull request #4457
834e46e CBlockIndex()::SetNull() method to avoid code repetition (jtimon)
2014-07-07 07:44:48 +02:00
Wladimir J. van der Laan e1f7c7d173
Merge pull request #4472
9f4da19 Use pong receive time rather than processing time (Pieter Wuille)
2014-07-07 06:28:43 +02:00
Pieter Wuille 9f4da19bab Use pong receive time rather than processing time 2014-07-06 16:08:18 +02:00
Pieter Wuille 40f5cb878e Send rejects and apply DoS scoring for errors in direct block validation.
75f51f2a introduced asynchronous processing for blocks, where reject messages
and DoS scoring could be applied outside of ProcessBlock, because block
validation may happen later.

However, some types of errors are still detected immediately (in particular,
CheckBlock violations), which need acting after ProcessBlock returns.
2014-07-06 14:47:23 +02:00
Pieter Wuille f4b00beae5 Add CChain::GetLocator() unit test 2014-07-06 14:40:31 +02:00
Pieter Wuille 3c85d2ec37 Fix CChain::GetLocator 2014-07-06 13:42:29 +02:00
R E Broadley 1f740ddc4d Remove unused variable 2014-07-05 22:43:52 +07:00
Cozz Lovan ad87bc4de1 [Qt] Replace status bar unit icon with actual images 2014-07-05 17:18:26 +02:00
Philip Kaufmann 674c070e5d [Qt] seed OpenSSL PNRG with Windows event data
- see https://bitcointalk.org/index.php?topic=113496.msg1228193#msg1228193
  for the initial suggestion for this
- also ensure consistent debug.log message format
2014-07-04 17:16:36 +02:00
Philip Kaufmann 3d0e92dc83 [Qt] remove dup includes in bitcoingui 2014-07-04 16:51:25 +02:00
Wladimir J. van der Laan 2ec5a3d212
rpc: Prevent easy memory exhaustion attack
Allocate memory for POST message data only as bytes come in, instead of
all at once at the beginning.

Fixes #4343.
2014-07-04 09:20:39 +02:00
Wladimir J. van der Laan e81e2e8f7c
Merge pull request #4421
caf6150 Use async name resolving to improve net thread responsiveness (Huang Le)
2014-07-04 08:40:01 +02:00
Wladimir J. van der Laan 00fa78c35b
Merge pull request #3764
2e36866 Show nodeid instead of addresses (for anonymity) unless otherwise requested. (R E Broadley)
2014-07-04 08:04:30 +02:00
Wladimir J. van der Laan e61c6d69ad
Merge pull request #4450
0da6b3f Remove signal DoubleSpendDetected, use function (Tom Harding)
88dd359 Check signatures before respend relay (Tom Harding)
2014-07-04 05:50:53 +02:00
R E Broadley 2e36866fec Show nodeid instead of addresses (for anonymity) unless otherwise requested. 2014-07-04 09:38:44 +07:00
Gavin Andresen 21876d3831
Merge branch 'smartfee_wallet' 2014-07-03 15:50:24 -04:00
Gavin Andresen 13fc83c77b
Move fee policy out of core 2014-07-03 14:42:16 -04:00
Gavin Andresen 4b7b1bb1ac
Sanity checks for estimates
Require at least 11 samples before giving fee/priority estimates.

And have wallet-created transactions go throught the fee-sanity-check
code path.
2014-07-03 13:44:56 -04:00
Gavin Andresen b33d1f5ee5
Use fee/priority estimates in wallet CreateTransaction
The wallet now uses the mempool fee estimator with a new
command-line option: -txconfirmtarget (default: 1) instead
of using hard-coded fees or priorities.

A new bitcoind that hasn't seen enough transactions to estimate
will fall back to the old hard-coded minimum priority or
transaction fee.

-paytxfee option overrides -txconfirmtarget.

Relaying and mining code isn't changed.

For Qt, the coin control dialog now uses priority estimates to
label transaction priority (instead of hard-coded constants);
unspent outputs were consistently labeled with a much higher
priority than is justified by the free transactions actually
being accepted into blocks.

I did not implement any GUI for setting -txconfirmtarget; I would
suggest getting rid of the "Pay transaction fee" GUI and replace
it with either "target number of confirmations" or maybe
a "faster confirmation <--> lower fee" slider or select box.
2014-07-03 13:44:33 -04:00
Wladimir J. van der Laan 07b6c2b901
Merge pull request #4302
8969828 [Qt] New status bar Unit Display Control and related changes. (gubatron)
2014-07-03 17:47:58 +02:00
Wladimir J. van der Laan 4278b1df45
Clarify error message when invalid -rpcallowip
Also add to HelpMessage() what specifications are valid.
2014-07-03 07:11:59 +02:00
jtimon 834e46e847 CBlockIndex()::SetNull() method to avoid code repetition 2014-07-02 18:36:43 +02:00
Tom Harding 0da6b3fd18 Remove signal DoubleSpendDetected, use function
Also removes the need for forward reference to RelayableRespend.
2014-07-02 09:27:29 -07:00
JaSK a3e192a327 replaced MINE_ with ISMINE_ 2014-07-02 15:48:40 +02:00
JaSK 53a2148f0c fixed bug where validateaddress doesn't display information 2014-07-02 15:48:40 +02:00
JaSK f28707a845 fixed bug in ListReceived() 2014-07-02 15:48:40 +02:00
JaSK 519dd1c89a Added MINE_ALL = (spendable|watchonly) 2014-07-02 15:48:40 +02:00
JaSK 23b0506c91 Fixed some stuff in TransactionDesc 2014-07-02 15:48:39 +02:00
JaSK 80dda36a07 removed default argument values for ismine filter 2014-07-02 15:48:39 +02:00
Pieter Wuille d5087d1ba0 Use script matching rather than destination matching for watch-only.
This changes the keystore data format, wallet format and IsMine logic
to detect watch-only outputs based on direct script matching rather
than first trying to convert outputs to destinations (addresses).

The reason is that we don't know how the software that has the spending
keys works. It may support the same types of scripts as us, but that is
not guaranteed. Furthermore, it removes the ambiguity between addresses
used as identifiers for output scripts or identifiers for public keys.

One practical implication is that adding a normal pay-to-pubkey-hash
address via importaddress will not cause payments to the corresponding
full public key to be detected as IsMine. If that is wanted, add those
scripts directly (importaddress now also accepts any hex-encoded script).

Conflicts:
	src/wallet.cpp
2014-07-02 15:48:39 +02:00
JaSK 0fa2f8899a added includedWatchonly argument to listreceivedbyaddress/...account 2014-07-02 15:48:39 +02:00
JaSK f87ba3df64 added includeWatchonly argument to 'gettransaction' because it affects balance calculation 2014-07-02 15:48:39 +02:00
JaSK a5c6c5d6df fixed tiny glitch and improved readability like laanwj suggested 2014-07-02 15:48:39 +02:00
JaSK d7d5d23b77 Added argument to listtransactions and listsinceblock to include watchonly addresses 2014-07-02 15:48:39 +02:00
JaSK 952877e01c Showing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'.
It is only appended when the transaction involves a watchonly address.
2014-07-02 15:48:38 +02:00
JaSK 83f3543f20 Added argument to listaccounts to include watchonly addresses 2014-07-02 15:48:38 +02:00
JaSK d4640d7d8c Added argument to getbalance to include watchonly addresses and fixed errors in balance calculation. 2014-07-02 15:48:38 +02:00
JaSK d2692f6116 Watchonly transactions are marked in transaction history 2014-07-02 15:48:38 +02:00
JaSK ffd40da361 Watchonly balances are shown separately in gui. 2014-07-02 15:48:38 +02:00
Wladimir J. van der Laan 2935b21103 qt: Hide unspendable outputs in coin control 2014-07-02 15:48:38 +02:00
Pieter Wuille c8988460a2 Add support for watch-only addresses
Changes:
* Add Add/Have WatchOnly methods to CKeyStore, and implementations
  in CBasicKeyStore.
* Add similar methods to CWallet, and support entries for it in
  CWalletDB.
* Make IsMine in script/wallet return a new enum 'isminetype',
  rather than a boolean. This allows distinguishing between
  spendable and unspendable coins.
* Add a field fSpendable to COutput (GetAvailableCoins' return type).
* Mark watchonly coins in listunspent as 'watchonly': true.
* Add 'watchonly' to validateaddress, suppressing script/pubkey/...
  in this case.

Based on a patch by Eric Lombrozo.

Conflicts:
	src/qt/walletmodel.cpp
	src/rpcserver.cpp
	src/wallet.cpp
2014-07-02 15:48:37 +02: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 c9600ce640
Merge pull request #4312
fda3fed libsecp256k1 integration (Pieter Wuille)
5566826 secp256k1: Add build-side changes for libsecp256k1 (Cory Fields)
b150b09 secp256k1: add libtool as a dependency (Cory Fields)
2014-07-02 09:23:05 +02:00
Wladimir J. van der Laan 2882d594fe
Fix the Qt5 build after d95ba75
Sorry, my own fault this time.
2014-07-02 08:15:09 +02:00
Tom Harding 88dd3598d2 Check signatures before respend relay
Check that all inputs are completely valid before actually
relaying a double-spend.
2014-07-01 14:37:10 -07:00
Pieter Wuille fda3fed18a libsecp256k1 integration 2014-07-01 12:28:05 -04:00
Cory Fields 5566826635 secp256k1: Add build-side changes for libsecp256k1
Note: This is added to our existing automake targets rather than as a
libtool-style lib. The switch to libtool-style targets can come later if it
proves to not add any complications.
2014-07-01 12:27:19 -04: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 d95ba75825 qt: Log messages with type>QtDebugMsg as non-debug
More important messages should end up in the log no matter
if -debug=qt is set.
2014-07-01 14:58:02 +02:00
Wladimir J. van der Laan b29b509612
Merge pull request #4325
4aaa017 rework help messages for fee-related options (Philip Kaufmann)
2014-07-01 12:55:33 +02:00
Wladimir J. van der Laan dd638dd712
typedef std::map<uint256, CCoins> to CCoinsMap
This makes it possible to switch to a more efficient map type
without changing all occurences manually.

Merges half of #4413.
2014-07-01 12:48:16 +02:00
Philip Kaufmann 8d9cc7d743
fix copyright string in two of our *.rc files
- also make comment about rc-files in clientversion.h generic

Merges #4429.
2014-07-01 12:13:37 +02:00
Wladimir J. van der Laan 9aaa1cadf4
Merge pull request #4397
5d59921 add missing BOOST_FOREACH indentation in ThreadSocketHandler() (Philip Kaufmann)
9e9ca2b small cleanup of #ifdefs in BindListenPort() (Philip Kaufmann)
2014-07-01 09:54:41 +02:00
Wladimir J. van der Laan 3faf1f8294
test: Fix warning about integer signedness in P2SH tests 2014-06-30 16:37:59 +02:00
Wladimir J. van der Laan 5c184cb850
Merge pull request #4415
e35b37b RPC client: Simplify command line string-to-JSON-value conversion code (Jeff Garzik)
2014-06-30 15:56:01 +02:00
Wladimir J. van der Laan 77888d68d5
Fix the build for Qt5
Merging #3883 broke the Qt5 build, define the color in the standard
way.
2014-06-30 15:44:55 +02:00
Gavin Andresen 8ceb28afc3 Merge pull request #3883 from dgenr8/first_double_spend
Relay and alert user to double spends
2014-06-30 08:35:12 -04:00
Gavin Andresen 6fba25ef26 Merge pull request #4420 from sipa/skiplist
Add a skiplist to the CBlockIndex structure.
2014-06-30 08:21:46 -04:00
Wladimir J. van der Laan ac26571d2b
Merge pull request #4437
de79aaa Move non-trivial uint256.h methods to uint256.cpp (Pieter Wuille)
2014-06-30 11:27:46 +02:00
Pieter Wuille 236982c2b6 Add skiplist unit tests 2014-06-29 21:51:55 +02:00
Pieter Wuille c9a0918330 Add a skiplist to the CBlockIndex structure.
This allows fast (O(log n)) access to far predecessor blocks.
Use it to speed up CChain::FindFork and CChain::GetLocator.
2014-06-29 21:51:54 +02:00
Pieter Wuille aa81564700 Track peers' available blocks 2014-06-29 21:50:55 +02:00
kazcw 16f33f163d fix RPC error replies
After pull #4288, RPC messages indicating errors have a Content-Length unrelated
to their actual contents, rendering bitcoin-cli and curl unable to decode the
reply.

This patch sets the Content-Length field based on the actual content returned.

Additionally, pull #4288 clobbered the error descriptions provided in
ErrorReply, which bitcoin-cli relies upon; this patch moves #4288 http-error
descriptions to an HTTPError method, allowing HTTPReply to pass content on
unchanged.
2014-06-28 19:16:15 -07:00
Pieter Wuille de79aaa7a9 Move non-trivial uint256.h methods to uint256.cpp 2014-06-28 18:02:42 +02:00
Wladimir J. van der Laan 7b8fc9d8ad
Merge pull request #4436
675bcd5 Correct comment for 15-of-15 p2sh script size (Michael Ford)
2014-06-28 15:09:15 +02:00
Wladimir J. van der Laan c8b6c0a2cf
Merge pull request #4425
6ecf3ed Display unknown commands received. (R E Broadley)
2014-06-28 15:07:51 +02:00
Wladimir J. van der Laan 9125ef9421
Merge pull request #4398
86fe1b8 update coding.md to reflect changes by pull (Philip Kaufmann)
e10dcf2 ensure clean and consistent "namespace" usage (Philip Kaufmann)
2014-06-28 15:06:18 +02:00
Michael Ford 675bcd5892 Correct comment for 15-of-15 p2sh script size
The original comment forgets to account for the script push which will
need an OP_PUSHDATA2 + 2-bytes for the 513 script bytes.

props davecgh
fixes #4224
2014-06-28 20:57:46 +08:00
jtimon 645d497aa0 Replace HexBits with strprintf 2014-06-28 13:19:14 +02:00
Wladimir J. van der Laan ba81f45607
Merge pull request #3990
0dd5d3a Show only one zero instead of many when getblocks request received with a hashStop of uint256(0) (R E Broadley)
2014-06-28 10:16:09 +02:00
R E Broadley 6ecf3edfee Display unknown commands received. 2014-06-28 10:02:19 +07:00
R E Broadley 0dd5d3a009 Show only one zero instead of many when getblocks request received with a hashStop of uint256(0) 2014-06-28 09:55:24 +07:00
Tom Harding 7a19efe040 Formatting, spelling, comment fixes. 2014-06-27 16:47:33 -07:00
Wladimir J. van der Laan dfaa35d8cd
Merge pull request #4430
33c62c9 set shutdown title to main window title (Philip Kaufmann)
2014-06-27 18:53:11 +02:00
Tom Harding 9004798e62 Add -respendnotify option and new RPC data
-respendnotify=<cmd> Execute command when a network tx respends wallet
tx input (%s=respend TxID, %t=wallet TxID)

Add respendsobserved array to gettransaction, listtransactions, and
listsinceblock RPCs.  This omits the malleated clones that are included
in the walletconflicts array.

Add RPC help for respendsobserved and walletconflicts (help was missing
for the latter).
2014-06-27 07:54:21 -07:00
Tom Harding ada5a067c7 UI to alert of respend attempt affecting wallet.
Respend transactions that conflict with transactions already in the
wallet are added to it.  They are not displayed unless they also involve
the wallet, or get into a block.  If they do not involve the wallet,
they continue not to affect balance.

Transactions that involve the wallet, and have conflicting non-equivalent
transactions, are highlighted in red.  When the conflict first occurs, a
modal dialog is thrown.

CWallet::SyncMetaData is changed to sync only to equivalent transactions.

When a conflict is added to the wallet, counter nConflictsReceived is
incremented.  This acts like a change in active block height for the
purpose of triggering UI updates.
2014-06-27 07:54:21 -07:00
Tom Harding d640a3ceab Relay double-spends, subject to anti-DOS
Allows network wallets and other clients to see transactions that respend
a prevout already spent in an unconfirmed transaction in this node's mempool.

Knowledge of an attempted double-spend is of interest to recipients of the
first spend.  In some cases, it will allow these recipients to withhold
goods or services upon being alerted of a double-spend that deprives them
of payment.

As before, respends are not added to the mempool.

Anti-Denial-of-Service-Attack provisions:
 - Use a bloom filter to relay only one respend per mempool prevout
 - Rate-limit respend relays to a default of 100 thousand bytes/minute
 - Define tx2.IsEquivalentTo(tx1): equality when scriptSigs are not considered
 - Do not relay these equivalent transactions

Remove an unused variable declaration in txmempool.cpp.
2014-06-27 07:54:21 -07:00
Tom Harding 8fbf03995d CBloomFilter::clear() method 2014-06-27 07:54:21 -07:00
Gavin Andresen 6259937388 Merge pull request #4365 from gavinandresen/relax_isstandard
Relax IsStandard rules for pay-to-script-hash transactions
2014-06-27 10:53:24 -04:00
Philip Kaufmann 33c62c9c0b set shutdown title to main window title
- this ensures we don't show Bitcoin-Qt as that is still our
  internal application name
- fixes #4427
2014-06-27 15:09:41 +02:00
Wladimir J. van der Laan 4684c883bb
Merge pull request #4208
6a5c124 [Qt] don't allow translation of our example btc address (Philip Kaufmann)
2014-06-27 12:46:49 +02:00
Philip Kaufmann 40a158e100 minor code format fix in rpc-related files 2014-06-27 11:13:25 +02:00
Wladimir J. van der Laan d77f761be9
Merge pull request #4288
ed5769f Move AcceptedConnection class to rpcserver.h. (Jeff Garzik)
854d013 RPC code movement: separate out JSON-RPC execution logic from HTTP server logic (Jeff Garzik)
c912e22 RPC cleanup: Improve HTTP server replies (Jeff Garzik)
2014-06-27 10:03:19 +02:00
Jeff Garzik ed5769f536 Move AcceptedConnection class to rpcserver.h.
Also, add parens to HTTPReply() to assist readability.
2014-06-27 00:10:53 -04:00
Jeff Garzik 854d013012 RPC code movement: separate out JSON-RPC execution logic from HTTP server logic 2014-06-26 23:32:18 -04:00
Jeff Garzik c912e22db0 RPC cleanup: Improve HTTP server replies
1) support varying content types
2) support only sending the header
3) properly deliver error message as content, if HTTP error
4) move AcceptedConnection class to header, for wider use
2014-06-26 23:32:18 -04:00
Jeff Garzik e35b37b1b8 RPC client: Simplify command line string-to-JSON-value conversion code
By default, all command line parameters are converted into JSON string
values.  There is no need to manually specify the incoming type.

A binary decision "parse as string or JSON?" is all that's necessary.

Convert to a simple class, initialized at runtime startup, which offers
a quick lookup to answer "parse as JSON?" conversion question.

Future parameter conversions need only to indicate the method name
and zero-based index of the parameter needing JSON parsing.
2014-06-26 22:18:30 -04:00
Whit J c598f2acdb Fixed captitalization in bitcoin-cli-res.rc 2014-06-26 18:31:40 -07:00
Huang Le caf6150e97 Use async name resolving to improve net thread responsiveness
In the LookupIntern(), things changed are:

  1. Call getaddrinfo_a() instead of getaddrinfo() if available, the former is a sync version of the latter;
  2. Try using inet_pton()/inet_addr() to convert the input text to a network addr structure at first, if success the extra name resolving thread inside getaddrinfo_a() could be avoided;
  3.  An interruption point added in the waiting loop for return from getaddrinfo_a(), which completes the improve for thread responsiveness.

A easy way to see the effect is to kick off a 'bitcoind stop' immediately after 'bitcoind -daemon', before the change it would take several, or even tens of, minutes on a bad network situation to wait for the running bitcoind to exit, now it costs only seconds.

Signed-off-by: Huang Le <4tarhl@gmail.com>
2014-06-27 02:55:39 +08:00