Commit graph

9167 commits

Author SHA1 Message Date
langerhans ae9065a17e Merge branch 'rnicoll-rnicoll/1591-rebase' into 1.14-maint 2019-07-14 19:17:14 +02:00
Ross Nicoll dbfb33abe0 Revert behaviour change in getauxblock
Change getauxblock to respond with a "target" field instead of "_target".
2019-07-13 19:23:36 +00:00
rllola 8fbd1680bb Added coments on chain parameters for regtest 2019-07-12 21:36:26 +00:00
langerhans ccd17d1b48 Update chainparams with more recent data 2019-04-14 18:32:15 +02:00
John Newbery c4b8fbf57f [rpc] Add initialblockdownload to getblockchaininfo 2019-04-14 18:32:15 +02:00
langerhans 936bf6f05b Fix some strings still referencing bitcoin 2019-03-25 05:36:12 +00:00
Michi Lumin 20aa821ec9 Actual dogecoin icons instead of bitcoin ones for OSX build.
Actual dogecoin icons in ICNS format for OSX build, instead of old bitcoin ones.
2019-03-25 05:36:12 +00:00
Michi Lumin d84837a838 Cherry-pick from Bitcoin repo, 1ec0c0a: small changes for OSX build
Cherry-pick from Bitcoin repo, 1ec0c0a: adds "const" suffix to several lines in txmempool.h and miner.h to make this build succeed under OSX w. clang++ and Boost lib 1.66+
2019-03-25 05:36:12 +00:00
langerhans 8c8ceb7dc1 Add rule to generate raw.h file to test Makefile 2019-03-25 05:36:12 +00:00
Ross Nicoll 7ccf62e1a4 [Qt] Disable milli and micro units, introduce kilo and mega units (#1463)
milli- and micro-Dogecoins are below dust threshold so do not make
any sense as display units. Instead, kilo- and mega-dogecoins are
probably more useful, as those make common amounts easier to read
instead of harder
2019-03-25 05:36:12 +00:00
Ross Nicoll 443b058a77 Update Gitian descriptors and keys (#1455)
* Replace Gitian keys - Note I've removed Leofidus' key due to inactivity, and added a weight of 20
to whit's key.
* Replace Bitcoin with Dogecoin in Gitian descriptors
* Fix Makefile refrence to bash-completion files
* Rename remaining bash-completion files
* Add wallet_bgcoin to Qt Makefile
* Add PureHeader sources to libdogecoinconsensus
2019-03-25 05:36:12 +00:00
Ross Nicoll 43b585b3cc Add dogechain and chain.so as default block explorers 2019-03-25 05:36:12 +00:00
Sporklin f5d306e9f5 Amount to send field now goes up/down 1 DOGE at a time (#1441) 2019-03-25 05:36:12 +00:00
Max K 2a0c66035d Re-add paperwallet printer (#1467)
* Add paper wallet generator to QT wallet

* Replace print icon with Typeicons equivalent

* Re-add printer support to Qt

* depends: fix fontconfig with newer glibc

See comment for more detail

* Set fixed size for paper wallet dialog
2019-03-25 05:36:12 +00:00
J Ross Nicoll 74814cfb24 Update about menu icon to Dogecoin
Icon provided by cdeverett
2019-03-25 05:36:12 +00:00
Ross Nicoll 3a62bcc51f Update URI tests for Dogecoin (#1457)
Note that the test address was invalid in Bitcoin Core, and as such rather than
re-encoding as a Dogecoin address, I've simply swapped the first byte. Still
invalid, but looks correct at least.
2019-03-25 05:36:12 +00:00
Ross Nicoll f93d42df1d rebrand dogecoin-tx test (#1450) 2019-03-25 05:36:12 +00:00
Ross Nicoll 4a87b53e55 Update QT client messages and translations to Doge equivalents (#1429)
Update QT client messages and translations to Doge equivalents.
2019-03-25 05:36:11 +00:00
Ross Nicoll 4dd8838b3a Rename binaries to match Dogecoin 2019-03-25 05:36:11 +00:00
Ross Nicoll 148a2aca05 Introduce basic Dogecoin branding 2019-03-25 05:36:11 +00:00
Ross Nicoll d0133b27fc Drop use of smart fees
Drop use of smart fees when calculating transaction fees. Dogecoin fees are intentionally
on a fixed schedule.
2019-03-17 10:00:38 -07:00
Ross Nicoll 199cf694ef Update miner confirmation window
* Update miner confirmation window to 240 for Dogecoin main net, and update related values.
* Re-enable PoW tests with Dogecoin values.
* Update version bit tests based on Dogecoin mining values.
2018-09-23 21:22:58 +01:00
Ross Nicoll 140cc1dba1 Create v1 transactions for compatibility with 1.10 (#1485)
Create v1 transactions for compatibility with 1.10. See https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki for context.
This should NOT be merged into 1.16.
2018-09-19 22:11:47 +01:00
Ross Nicoll 41c868f47e Re-introduce alert functionality (#1470)
Re-introduce alert functionality removed from Bitcoin upstream
2018-09-19 22:11:47 +01:00
Ross Nicoll dee5e404b3 Update or eliminate remaining tests (#1483)
* Change amount tests to use rounded values
* Disable legacy tests
2018-09-19 22:11:47 +01:00
Ross Nicoll 9c3a11b248 Clean up RPC tests (#1465)
* Enable full block tests
* Fix invalidblocktest
* Move watch only address funding to immediately before it's used, so node 0 doesn't spend the output before it checks it later.
* Fix `fundrawtransaction` tests and sanitize fee calculation at the same time
* Correct resolution of chain parameters when validating tx inputs, especially from previous coinbase transactions
* Set block versions on full block tests so that the generated blocks are AuxPoW compatible
2018-09-19 22:11:47 +01:00
Ross Nicoll a9db76f39d Insert Dogecoin testnet merkle tree root value (#1469) 2018-09-19 22:11:47 +01:00
langerhans 0df972131e Add PureHeader sources to libdogecoinconsensus 2018-09-19 22:11:47 +01:00
Ross Nicoll b6b5ee7502 Update RPC tests for Dogecoin (#1431)
* Make most of the RPC tests pass
* Add AUXPoW rpc tests
- Tests the auxpow rpc interface `getauxblock`
- Tests consensus constraints for auxpow:
  - Minimum block height
  - Valid scrypt proof of work
  - Foreign chain ID
2018-09-19 22:11:47 +01:00
Ross Nicoll 57dae15a77 Replace HMAC_SHA256 with Bitcoin's version (#1438) 2018-09-19 22:11:47 +01:00
Ross Nicoll 5618d8497a Update payment protocol to match Dogecoin (#1433)
* Revised payment request handling to use genesis block hash instead of network name, enabling
support for more networks that just Bitcoin main and test net.
* Disable payment protocol certificate unit tests; we don't modify this code, and regenerating the test data is likely to be significantly time consuming. Will re-enable once discussion on spec is concluded.
2018-09-19 22:11:47 +01:00
Ross Nicoll ea52cb3ae0 Add block height to block notification substitution options (#1430) 2018-09-19 22:11:47 +01:00
Ross Nicoll 2860c4bc31 Enforce minor Dogecoin parameters (#1427)
* Minimum number of blocks and blockchain size are increased for pruning. In comparison to Bitcoin this uses 24 hours as a minimum, rather than 48, although given blocks are rarely full this likely reflects a lot longer in reality.
* Multiply fork detection parameters by 5. The wall clock time elapsed for "long" forks is therefore half that of Bitcoin, but IMHO those figures are excessive for a chain with 1 minute block times.
* BIP16 and BIP30 have both been enabled on Dogecoin since inception and should not be conditional.
2018-09-19 22:11:47 +01:00
Ross Nicoll ad9e54ca72 Update test cases at 1000-byte boundaries (#1439)
Update test cases for 1,000 byte TX boundaries; in 1.10 and before the fees for these were rolled up to the next DOGE, however that results in incorrect fees because the UI currently uses 1,000 bytes as a predicted size. This updates the tests to match new behaviour in 1.14.
2018-09-19 22:11:41 +01:00
Ross Nicoll 3c060b31fe Load AuxPoW blocks from index correctly (#1443)
Load AuxPoW blocks from index correctly, by setting the version on the block before trying to check if it's AuxPoW. Previously the AuxPoW part of the block was never loaded because the check always failed.
2018-09-19 21:09:16 +01:00
Ross Nicoll 4d5e53e7b2 Initialise left/right consensus branches to null (#1435)
Strictly speaking the left/right consensus branches haven't been initialised so contain random values.
Most of the time these happen to be null, but sometimes causes client crashes (at least it does in 1.15, but fixing in earlier versions to be sure).
2018-09-19 21:09:16 +01:00
Ross Nicoll 3d363eccd4 Bring 1.14 fees in line with 1.10 (#1425)
* Disable free transactions
* Updating remaining fee calculation constants
* Round up to the nearest 1k, not up 1k so the UI fee estimator is correct
2018-09-19 21:09:16 +01:00
Ross Nicoll 493f02ba2a Always use parameters at block 0 to get genesis block hash (#1416)
This doesn't actually change behaviour, but stylistically is more correct.
2018-09-19 21:09:16 +01:00
Patrick Lodder 33db4921e5 [auxpow] Guarantee backward compatibility on getauxblock
Adds a wrapper around getauxblock to return boolean responses
for getauxblock rather than bip22 responses.
2018-09-19 21:09:16 +01:00
Ross Nicoll 4b33236028 Change result from getauxblock to BIP22 validation state 2018-09-19 21:09:16 +01:00
Ross Nicoll 7b81f4de0a Move COINBASE_MATURITY to the consensus parameters (#1426) 2018-09-19 21:09:16 +01:00
Ross Nicoll ec40df46b5 Check only the base block version (#1411)
Check only the base block version when looking for unexpected version numbers
2018-09-19 21:09:16 +01:00
Ross Nicoll 18850d359b Add Dogecoin current fee calculation logic (#1413)
Introduces 1 COIN/kb fees, rounded up to the next 1 COIN.
2018-09-19 21:09:16 +01:00
Lola Dam 65342fa48f Verify when doing 'backupwallet' that destination is not the same path of the original wallet.dat file. (#1406) 2018-09-19 19:24:06 +01:00
Ross Nicoll 277f207457 Update dogecoin-tx tests (#1409)
Update Python test address and key values to match Dogecoin format
2018-09-19 19:24:06 +01:00
Ross Nicoll c6eeab75a1 Change count type used by gettxoutsetinfo (#1415)
changing CAmount (is a int64_t) to arith_uint256 for nTotalAmount in CCoinsStats to prevent overflow
2018-09-19 19:24:06 +01:00
Ross Nicoll 7d647782dd Update checkpoints and chain work (#1410)
* Update checkpoints and chain work

* Correct checkpoint syntax

* Correct timestamp of last checkpoint block
2018-09-19 19:24:06 +01:00
Max K 60f8ff05e4 Fix 1.14 unit tests (#1408)
* Fix BlockEncodings test by setting a legacy block version

* Fix RPC test by adding missing RPC call

* Add missing regtest genesis hashes
2018-09-19 19:24:06 +01:00
Ross Nicoll 1be681a1b9 Modify chain consensus parameters to be height aware (#1396)
* Modify chain consensus parameters to be height aware
* Correct implementation of simplified rewards in parameters
* Correct max money
* Use base block version in IsSuperMajority() instead of full version
* Correct mining of blocks in AuxPoW tests
* Add in missing pre-AuxPoW consensus checks
2018-09-19 19:24:06 +01:00
Ross Nicoll a89d54c4b2 Change BIP65/66 enforcement to match Dogecoin (#1403)
* Introduce first estimates at BIP lock-in blocks

* Introduce Dogecoin BIP parameters

* Re-introduce supermajority rules for BIP65

* Add BIP65 supermajority rules

* Tighten v3 block constraints

* Don't enforce coinbase in v2 blocks

* Correct testnet majority params

* Change to using base version when checking supermajority
2018-09-19 19:23:29 +01:00
Ross Nicoll 92054123b8 Set SegWit timeout to zero to disable it (#1405) 2018-09-19 19:23:29 +01:00
Ross Nicoll 5833455f74 Stop sending a Bitcoin alert to Dogecoin clients 2018-09-19 19:23:29 +01:00
Ross Nicoll e9c0ac7afb Handle legacy v2 block at #66064 2018-09-19 19:23:29 +01:00
Ross Nicoll 0a403a2227 Correct PoW calculation logic to use locally calcualted difficulty 2018-09-19 19:23:29 +01:00
Ross Nicoll 1de15c70ce Sync changes from Dogecoin 1.10 2018-09-19 19:23:29 +01:00
Ross Nicoll fcde864334 Sync mining code from Namecore to resolve unit test failures (#1385) 2018-09-19 19:23:29 +01:00
Ross Nicoll bc8cca4896 Merge AuxPoW support from Namecore
Changes are as below:

Wrap CBlockHeader::nVersion into a new class (CBlockVersion).  This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID.

Update getauxblock.py for new 'generate' RPC call.

Add 'auxpow' to block JSON.

Accept auxpow as PoW verification.

Add unit tests for auxpow verification.

Add check for memory-layout of CBlockVersion.

Weaken auxpow chain ID checks for the testnet.

Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks.  Use this to disable the checks on testnet.

Introduce CPureBlockHeader.

Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two.

Differentiate between uint256 and arith_uint256.

This change was done upstream, modify the auxpow code.

Add missing lock in auxpow_tests.

Fix REST header check for auxpow headers.

Those can be longer, thus take that into account.  Also perform the check actually on an auxpow header.

Correctly set the coinbase for getauxblock results.

Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be.  (BIP30 block height and COINBASE_FLAGS.)

Implement getauxblock plus regression test.

Turn auxpow test into FIXTURE test.

This allows using of the Params() calls.

Move CMerkleTx code to auxpow.cpp.

Otherwise we get linker errors when building without wallet.

Fix rebase with BIP66.

Update the code to handle BIP66's nVersion=3.

Enforce that auxpow parent blocks have no auxpow block version.

This is for compatibility with namecoind.  See also https://github.com/namecoin/namecoin/pull/199.

Move auxpow-related parameters to Consensus::Params.
2018-09-19 19:22:45 +01:00
Ross Nicoll 42aa48ea69 Annotate work to be done to Dogecoin-ify 2018-09-19 19:21:49 +01:00
Ross Nicoll f0f9fd0292 Add Dogecoin difficulty calculations 2018-09-19 19:21:49 +01:00
coblee 8279f81b44 Litecoin: Fix zeitgeist2 attack thanks to Lolcust and ArtForz. This fixes an issue where a 51% attack can change difficulty at will. Go back the full period unless it's the first retarget after genesis. 2018-09-19 19:21:49 +01:00
Warren Togami b506efbe74 Litecoin: Scrypt n=1024 Pow hash based upon Colin Percival's Tarnsnap (2009) Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher 2018-09-19 19:21:49 +01:00
Ross Nicoll 3cff8e9773 Replace test data with Dogecoin values
Replace test data with Dogecoin equivalents in the folowing tests:

* base58
* bip32
* keys
* miner
* pow

Replace RPC and deterministic signatures in unit tests with Dogecoin values. While
conventionally I'd use an alternative implementation for these, as RFC 6979
compliant signature generation isn't terribly common, and there's no reason
to suspect we've modified this code, I'm going to assert that it's good enough
to test that the code doesn't provide different values.

Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are
replaced by the Dogecoin PoW tests.
2018-09-19 19:21:49 +01:00
Ross Nicoll 8c0468c2d2 Add Dogecoin block subsidy calculations. 2018-09-19 19:21:49 +01:00
Ross Nicoll 64af132fdb Replace consensus values with Dogecoin equivalents
* Replace chain parameters with Dogecoin values
* Update maximum coins to match Dogecoin
* Disable version 2 block requirement
* Update coinbase maturity to match Dogecoin
2018-09-19 19:21:48 +01:00
Suhas Daftuar 52965fbaef
Fix crash bug with duplicate inputs within a transaction
Introduced by #9049

Github-Pull: #14247

Tree-SHA512: 54ccf896e4c816ba8532644affc984a091ed801d8387bb01a836953c9ec4a345359d98fb58dd5f929617afd42bce0cc40293fecf943a1584207c82dd78da0ea5
2018-09-18 13:05:49 +02:00
Marco c0107cc33f Articols matter in Italian 2017-10-22 03:00:35 +02:00
Wladimir J. van der Laan 91be5e3c1e
Merge #10516: Backports for 0.14.3
ff274d3 [doc] Add hint about getmempoolentry to getrawmempool help. (Karl-Johan Alm)
76f9cf9 contrib: Update location of seeds.txt (Wladimir J. van der Laan)
12adedf Trivial: remove extra character from comment (CryptAxe)
d2ec969 Fixed typo in documentation for merkleblock.h (Mikerah)
3612219 contrib/init/bitcoind.openrcconf: Don't disable wallet by default (Luke Dashjr)
692dbb0 [doc] Minor corrections to osx dependencies (fanquake)
87a21d5 Fix: make CCoinsViewDbCursor::Seek work for missing keys (Pieter Wuille)
28b8b8b [wallet] Securely erase potentially sensitive keys/values (Thomas Snider)
ff13f59 [wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call. (Karl-Johan Alm)
e23cef0 Fix some empty vector references (Pieter Wuille)
6ad45b8 Re-enable upnp support in contrib/debian (Matt Corallo)
e9a0d89 Build with QT5 on Debian-based systems using contrib/debian (Matt Corallo)
2ea0358 Bump minimum boost version in contrib/debian (Matt Corallo)
c94e262 Update contrib/debian to latest Ubuntu PPA upload. (Matt Corallo)
96c7f2c Add CheckQueue Tests (Jeremy Rubin)
e207342 Fix CCheckQueue IsIdle (potential) race condition and remove dangerous constructors. (Jeremy Rubin)
ef810c4 [trivial] Fix a typo (introduced two days ago) in the default fee warning (practicalswift)
7abe7bb Qt/Send: Give fallback fee a reasonable indent (Luke Dashjr)
3e4d7bf Qt/Send: Figure a decent warning colour from theme (Luke Dashjr)
c5adf8f [Qt] Show more significant warning if we fall back to the default fee (Jonas Schnelli)
ee1a60d [tests] update disconnect_ban.py test case to work with listbanned (John Newbery)
d289b56 [net] listbanned RPC and QT should show correct banned subnets (John Newbery)
0422693 [tests] disconnect_ban: remove dependency on urllib (John Newbery)
98bd0c3 [tests] disconnect_ban: use wait_until instead of sleep (John Newbery)
bfd1cf6 [tests] disconnectban test - only use two nodes (John Newbery)
5bc75bb [tests] fix nodehandling.py flake8 warnings (John Newbery)
c25d0a8 Update release notes to include RPC error code changes. (John Newbery)
f5efe82 Return correct error codes in fundrawtransaction(). (John Newbery)
4943d7a Return correct error codes in setban(). (John Newbery)
18c109d Return correct error codes in removeprunedfunds(). (John Newbery)
fe51c89 Return correct error codes in blockchain.cpp. (John Newbery)
3ad00b4 Return correct error codes in bumpfee(). (John Newbery)
71463a7 [qa] Test prioritise_transaction / getblocktemplate interaction (Suhas Daftuar)
d28d583 Bugfix: PrioritiseTransaction updates the mempool tx counter (Suhas Daftuar)

Tree-SHA512: fa3628527c8e176e438de992b9c5815cc2f3c296dbe5d81b592d17a907554e9c6af7eb595e96a2c345de399ba5326c07b4791a91b7b07f89dce0787c85891206
2017-07-06 18:57:00 +02:00
Wladimir J. van der Laan cc23438af0
qt: 0.14.2 pre-rc2 translations update 2017-06-06 15:06:16 +02:00
Karl-Johan Alm ff274d3b00 [doc] Add hint about getmempoolentry to getrawmempool help.
Github-Pull: #10310
Rebased-From: 3a0a5bc234
2017-06-05 22:58:53 +00:00
CryptAxe 12adedff0b Trivial: remove extra character from comment
Github-Pull: #10309
Rebased-From: 3503716f1e
2017-06-05 22:58:53 +00:00
Mikerah d2ec96909a Fixed typo in documentation for merkleblock.h
Github-Pull: #10258
Rebased-From: dd07068d6b
2017-06-05 22:58:53 +00:00
Pieter Wuille 87a21d5922 Fix: make CCoinsViewDbCursor::Seek work for missing keys
Thanks to Suhas Daftuar for figuring this out.

Github-Pull: #10445
Rebased-From: 822755a424
2017-06-05 22:58:25 +00:00
Thomas Snider 28b8b8b603 [wallet] Securely erase potentially sensitive keys/values
Github-Pull: #10308
Rebased-From: 6c914ac176
2017-06-05 22:58:24 +00:00
Karl-Johan Alm ff13f592c5 [wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call.
Github-Pull: #10265
Rebased-From: c36ea693ee
2017-06-05 22:58:24 +00:00
Pieter Wuille e23cef0c94 Fix some empty vector references
streams.h has some methods that can be tricked into dereferencing
null pointers or end() iterators. Fix this.

Github-Pull: #10250
Rebased-From: f478d98fe4
2017-06-05 22:58:23 +00:00
Luke Dashjr 1b864c9820 Merge #9497 via remote-tracking branch 'origin-pull/9497/head' into 0.14.2_fixes 2017-06-05 22:58:00 +00:00
Luke Dashjr 77de9bbc57 Merge #10008 via branch 'fee_warning-0.14' into 0.14.2_fixes 2017-06-05 22:57:49 +00:00
Luke Dashjr aca4b6dbcb Merge #9481 via remote-tracking branch 'jonas/2017/01/fee_warning' into 0.14.2_fixes 2017-06-05 22:57:35 +00:00
Luke Dashjr e05799a381 Merge #10234, #10143 (fixes only), and #9853 via branch 'disconnect_ban_fixes-0.14' into 0.14.2_fixes 2017-06-05 22:57:27 +00:00
John Newbery d289b564e3 [net] listbanned RPC and QT should show correct banned subnets
Github-Pull: #10234
Rebased-From: 77c54b270d
2017-06-05 22:56:05 +00:00
Luke Dashjr 99e5dbd0aa Merge #9853 via branch 'fixerrorcodes-0.14' into 0.14.2_fixes 2017-06-05 19:33:18 +00:00
Luke Dashjr 74653a41fe Merge #10196 via branch 'prioritisetx_gbtcache-0.14' into 0.14.2_fixes 2017-06-05 19:33:01 +00:00
John Newbery f5efe82a83 Return correct error codes in fundrawtransaction().
The fundrawtransaction() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when funding the transaction
failed). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

That error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: dab804c18a
2017-06-05 19:01:16 +00:00
John Newbery 4943d7a9fe Return correct error codes in setban().
The setban() RPC was returning misleading or incorrect error
codes (for example RPC_CLIENT_NODE_ALREADY_ADDED when an invalid IP
address was entered). This commit fixes those error codes:

- RPC_CLIENT_INVALID_IP_OR_SUBNET should be returned if the client
  enters an invalid IP address or subnet.

This commit also updates the test cases to explicitly test the error code.

This commit also adds a testcase for trying to setban on an invalid subnet.

Github-Pull: #9853
Rebased-From: a012087667
2017-06-05 19:01:16 +00:00
John Newbery 18c109ddb1 Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

This error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: 960bc7f778
2017-06-05 19:01:16 +00:00
John Newbery fe51c8924e Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
  errors, only for genuine internal errors such as corrupted data.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.

Github-Pull: #9853
Rebased-From: c1190963b3
2017-06-05 19:01:16 +00:00
John Newbery 3ad00b4b32 Return correct error codes in bumpfee().
The bumpfee() RPC was returning misleading or incorrect error codes
(for example RPC_INVALID_ADDRESS_OR_KEY when the transaction was not
BIP125 replacable). This commit fixes those error codes:

- RPC_INVALID_ADDRESS_OR_KEY if an invalid address was provided:
    - Invalid change address given
- RPC_INVALID_PARAMETER if a single (non-address/key) parameter is incorrect
    - confTarget and totalFee options should not both be set.
    - Invalid confTarget
    - Insufficient totalFee (cannot be less than required fee)
- RPC_WALLET_ERROR for any other error
    - Transaction has descendants in the wallet
    - Transaction has descendants in the mempool
    - Transaction has been mined, or is conflicted with a mined transaction
    - Transaction is not BIP 125 replaceable
    - Transaction has already been bumped
    - Transaction contains inputs that don't belong to the wallet
    - Transaction has multiple change outputs
    - Transaction does not have a change output
    - Fee is higher than maxTxFee
    - New fee rate is less than the minimum fee rate
    - Change output is too small.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: 6d07c62322
2017-06-05 19:01:16 +00:00
practicalswift ef810c4cd4 [trivial] Fix a typo (introduced two days ago) in the default fee warning
Github-Pull: #10008
Rebased-From: a3ca43bb32
2017-06-03 21:19:05 +00:00
Wladimir J. van der Laan 4a41de4585
build: bump version to 0.14.2 2017-06-02 07:39:56 +02:00
Cory Fields 9e3ad50078
net: only enforce the services required to connect
also once half of all outgoing nodes have our preferred flags, require only
minimal flags from the rest.

Github-Pull: #10441
Rebased-From: b6fbfc2282
2017-06-01 13:26:12 +02:00
Gregory Sanders 18476423fb
[Wallet] unset change position when there is no change on exact match 2017-05-31 10:57:16 +02:00
Cory Fields ae479bc45b
build: fix bitcoin-config.h regeneration after touching build files
This was a long-standing and annoying problem.

If autogen.sh was not manually run after touching configure.ac,
bitcoin-config.h would not be properly regenerated. This causes very subtle
problems when configure appears to enable a new value, but it does not end up
reflected in the build.
2017-05-31 10:54:19 +02:00
Jonas Schnelli 4bc99c3b28
Add missing <atomic> header in clientmodel.h 2017-05-31 10:53:47 +02:00
Jonas Schnelli 222f3775cf
Set both time/height header caches at the same time 2017-05-31 10:53:47 +02:00
Jonas Schnelli 7da133772d
Declare headers height/time cache mutable, re-set the methods const 2017-05-31 10:53:47 +02:00
Jonas Schnelli 9ac40e853c
Update the remaining blocks left in modaloverlay at init. 2017-05-31 10:53:47 +02:00
Jonas Schnelli 1e936d7e87
Reduce cs_main locks during modal overlay by adding an atomic cache 2017-05-31 10:53:46 +02:00
Matt Corallo 0aee4a132b
Check interruptNet during dnsseed lookups 2017-05-31 10:52:56 +02:00
Russell Yanofsky 321419bc06
Fix importwallet edge case rescan bug
Start importwallet rescans at the first block with timestamp greater or equal
to the wallet birthday instead of the last block with timestamp less or equal.
This fixes an edge case bug where importwallet could fail to start the rescan
early enough if there are blocks with decreasing timestamps or multiple blocks
with the same timestamp.

Github-Pull: #10410
Rebased-From: 2a8e35a11d
2017-05-23 17:09:42 +02:00
Alex Morcos 37a8fc54d4
Populate services in GetLocalAddress
Previously if we didn't have any local addresses, GetLocalAddress would return
0.0.0.0 and then we'd swap in a peer's notion of our address in AdvertiseLocal,
but then nServices would never get set.

Github-Pull: #10424
Rebased-From: 307013469f
2017-05-22 12:56:13 +02:00
Warren Togami 51c787dfb4
Clarify importprivkey help text with example of blank label without rescan
Occasionally I waste a lot of time not remembering that the second parameter to importprivkey must be blank if you intend to stop rescan with "false" as the third parameter.

Github-Pull: #10207
Rebased-From: c9e31c36ff
2017-04-20 08:18:50 +02:00
Suhas Daftuar d28d583820 Bugfix: PrioritiseTransaction updates the mempool tx counter
The mempool's nTransactionsUpdated is used by getblocktemplate
to trigger new invocations of CreateNewBlock().

Github-Pull: #10196
Rebased-From: 909306cde3770ed7019e7b635e24cedbd9de66ce
2017-04-19 20:10:02 +00:00
Wladimir J. van der Laan 348a71701d
qt: translations update pre-rc2 2017-04-14 12:25:51 +02:00
Cory Fields 30fa231011
net: define NodeId as an int64_t
This should make occurances of NodeId wrapping essentially impossible for
real-world usage.

Github-Pull: #10176
Rebased-From: c851be4b25
2017-04-14 10:35:49 +02:00
John Newbery 3c796026e5
[rpc] rename disconnectnode argument
Github-Pull: #10204
Rebased-From: 883154cbcb
2017-04-14 10:19:06 +02:00
Wladimir J. van der Laan 47d24c85b7
Bump version to 0.14.1 2017-04-05 09:12:36 +02:00
Suhas Daftuar ea060c7495
Bugfix: ancestor modifed fees were incorrect for descendants
If prioritisetransaction was called for a tx with in-mempool
descendants, the modified ancestor fee values for those descendants was
incorrect.

Github-Pull: #10144
Rebased-From: 9bef02e365
2017-04-05 08:37:12 +02:00
Alex Morcos 0e5133cb2e
Make threshold for flushing more conservative.
Always leave a reasonable buffer of 50MB for usage from newly connected block (once over 50%) and increase the high water mark buffer to 200MB.

Github-Pull: #10133
Rebased-From: 1b55e07b7a
2017-04-05 08:23:02 +02:00
Alex Morcos d6867689d1
Lower default memory footprint slightly
Github-Pull: #10133
Rebased-From: f33afd3b2b
2017-04-05 08:23:01 +02:00
Alex Morcos ab864d3e49
Make pcoinsTip memory calculations consistent
Since we are more accurately measuring pcoinsTip peak usage at twice the current in dynamic usage, it makes sense to double the default (this will lead to the same effective usage and peak usage as previously).
We should also double the buffer used to avoid flushing if above 90% but still sufficient space remaining.

Github-Pull: #10133
Rebased-From: 5b95a190e8
2017-04-05 08:23:01 +02:00
Gregory Maxwell a44a6a15f9
Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have
 a coinbase transaction.

This also results in more useful error reporting on corrupted input.

Thanks to rawodb for the bug report.

Github-Pull: #10146
Rebased-From: 4f15ea102d
2017-04-04 09:01:03 +02:00
Gregory Maxwell 2fea10ad03
Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn.
This isn't actually needed anywhere, but it's less brittle.

Github-Pull: #10146
Rebased-From: ada0caa165
2017-04-04 09:01:03 +02:00
practicalswift f15268db3b
[rpc] Remove auth cookie on shutdown
Accidentally removed in 40b556d374

Github-Pull: #10139
Rebased-From: 4b87973c32
2017-04-03 08:54:53 +02:00
Pieter Wuille 0b5e162b84
Compensate for memory peak at flush time
Github-Pull: #10126
Rebased-From: 7228ce853d
2017-03-31 12:07:18 +02:00
Wladimir J. van der Laan fa6b5fc1cc
Merge #10127: [0.14 backport] Mining: Prevent slowdown in CreateNewBlock on large mempools
a296c60 Update benchmarking with package statistics (Suhas Daftuar)
10028fb Add benchmarking for CreateNewBlock (Suhas Daftuar)
b5c3440 Mining: return early when block is almost full (Suhas Daftuar)

Tree-SHA512: 7c39d03a778abe00412743958981a1a55d22fc1843c9a3aef7a56506622e6f5d6b8962c586a339b6031e1ee4815d6981351cf527e8fbe5b265824c81d6c7199d
2017-03-31 12:06:56 +02:00
Wladimir J. van der Laan e4c9a90fe9
util: Work around (virtual) memory exhaustion on 32-bit w/ glibc
glibc-specific: On 32-bit systems set the number of arenas to 1. By
default, since glibc 2.10, the C library will create up to two heap
arenas per core. This is known to cause excessive virtual address space
usage in our usage. Work around it by setting the maximum number of
arenas to 1.

Github-Pull: #10120
Rebased-From: 625488ace5
2017-03-31 11:48:59 +02:00
John Newbery f59e3dfc59
Add tests for bitcoin-tx input checking
Github-Pull: #10130
Rebased-From: 19ecd1e2e1
2017-03-31 11:47:50 +02:00
John Newbery ecc523288c
Check stderr when testing bitcoin-tx
Github-Pull: #10130
Rebased-From: 21704f6334
2017-03-31 11:47:50 +02:00
Awemany 04c21afcdf
bitcoin-tx: Fix missing range check
The number of arguments is not checked MutateTxAddOutAddr(..), meaning
that

> ./bitcoin-tx -create outaddr=

accessed the vStrInputParts vector beyond its bounds.

This also includes work by jnewbery to check the inputs for
MutateTxAddPubKey()

Github-Pull: #10130
Rebased-From: eb66bf9bdd
2017-03-31 11:47:50 +02:00
Suhas Daftuar a296c6009f Update benchmarking with package statistics
Github-Pull: #9959
Rebased-From: 011124a2b2
2017-03-30 15:18:02 -04:00
Suhas Daftuar 10028fb555 Add benchmarking for CreateNewBlock
Github-Pull: #9959
Rebased-From: 42cd8c890f
2017-03-30 15:06:14 -04:00
Suhas Daftuar b5c3440b05 Mining: return early when block is almost full
Github-Pull: #9959
Rebased-From: eed816af6c
2017-03-30 15:05:33 -04:00
MarcoFalke 142fbb2fec rpc: Rename first named arg of createrawtransaction
Github-Pull: #10084
Rebased-From: fa55853219
2017-03-27 23:44:08 +02:00
Suhas Daftuar fc3d7db580 Optimize GetWitnessHash() for non-segwit transactions
Github-Pull: #9912
Rebased-From: 02c57b521a
2017-03-27 23:44:08 +02:00
Andrew Chow ddc2dd1612 Ensure an item exists on the rpcconsole stack before adding
Ensures that there is an item on the rpcconsole stack before adding something to the current stack so that a segmentation fault does not occur.

Github-Pull: #10060
Rebased-From: 4df76e270c
2017-03-27 23:08:24 +02:00
James Evans 4d8e66017f Trivial: Fix typo in help getrawtransaction RPC
Github-Pull: #10037
Rebased-From: 05a9f22358
2017-03-27 23:07:56 +02:00
Wladimir J. van der Laan ccb47bf830
Merge #10006: [0.14 backport] Don't require segwit in getblocktemplate for segwit signalling or mining
2cd2cd5 Test transaction selection when gbt called without segwit support (Suhas Daftuar)
569596c Don't require segwit in getblocktemplate for segwit signalling or mining (Suhas Daftuar)

Tree-SHA512: bf2672287713e5adc7e851791207e17490679f941d0b9ed38467ffede3aa3000d229151b8ae54323fc8037e0a8569b2fd910ec19f034fb85d9142289648793c3
2017-03-18 11:39:04 +01:00
Matt Corallo 4e2502bb51 Add missing braces in semaphore posts in net
Github-Pull: #9953
Rebased-From: 819b513a54
2017-03-17 14:56:57 -07:00
Matt Corallo d2548a4f97 Fix shutdown hang with >= 8 -addnodes set
We previously would block waiting for a CSemaphoreGrant in
ThreadOpenAddedConnections, when we did not need to. This would
block as the posts in CConnman shutdown were both to the wrong
semaphore and in the wrong location.

Github-Pull: #9953
Rebased-From: e007b243c4
2017-03-17 14:55:43 -07:00
Suhas Daftuar 569596cc51 Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.

Github-Pull: #9955
Rebased-From: abe7b3d3ab
2017-03-16 10:43:54 -04:00
Russell Yanofsky ad24256a65
Fix importmulti returning rescan errors for wrong keys
Bug was a missing ++i line in a new range for loop added in commit e2e2f4c
"Return errors from importmulti if complete rescans are not successful"

Github-Pull: #9829
Rebased-From: 306bd72157
2017-02-28 13:53:28 +01:00
Wladimir J. van der Laan 8d2d08efaa
qt: pre-rc3 translations update 2017-02-28 12:49:29 +01:00
Pieter Wuille 1825a03f81
Avoid VLA in hash.h
Github-Pull: #9791
Rebased-From: 5c8fd50811
2017-02-28 12:48:19 +01:00
Marijn Stollenga 289204fbe0
Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did).
Github-Pull: #9865
Rebased-From: 83ac719d34
2017-02-28 12:01:06 +01:00
Russell Yanofsky 08e0690f3f
Update sendfrom RPC help to correct coin selection misconception
Github-Pull: #9840
Rebased-From: f81f0d0030
2017-02-28 11:41:58 +01:00
Cory Fields 775cf54d0e
prevector: assert successful allocation
Github-Pull: #9856
Rebased-From: d4ee7baef7
2017-02-28 11:40:50 +01:00
Cory Fields 69832aaad5
don't throw std::bad_alloc when out of memory. Instead, terminate immediately
Github-Pull: #9856
Rebased-From: c5f008a416
2017-02-28 11:40:50 +01:00
Wladimir J. van der Laan 50953c2aad
tests: Fix dangling pwalletMain pointer in wallet tests
Github-Pull: #9875
Rebased-From: 75a109338f
2017-02-28 11:40:50 +01:00
Wladimir J. van der Laan 847e3753a6
qt: pre-rc2 translations update 2017-02-23 20:31:57 +01:00
Cory Fields 05e906dbc6
build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.

Github-Pull: #9789
Rebased-From: 205830a37b
2017-02-23 10:49:07 +01:00
John Newbery 9d3f9d2a59
[Trivial] Remove incorrect help message from gettxoutproof()
Github-Pull: #9711
Rebased-From: 9949ebfa6a
2017-02-22 13:03:55 +01:00
Russell Yanofsky 9072395e5f
Return errors from importmulti if complete rescans are not successful
Github-Pull: #9773
Rebased-From: e2e2f4c856
2017-02-22 12:45:43 +01:00
Jonas Schnelli 7d75a5a93c
Fix segfault crash when shutdown the GUI in disablewallet mode
Github-Pull: #9817
Rebased-From: 312c4f1057
2017-02-21 15:14:17 +01:00
kirit93 e22c0671c7
Fix for issue #9775. Added check for open() returning a NULL pointer.
Github-Pull: #9798
Rebased-From: 40f11f8872
2017-02-21 14:33:34 +01:00
Pavel Janík 3972a8efb2
Read/write mempool.dat as a binary.
mempool.dat is a binary file and thus it should be read/written as such.

Fixes #9810.

Github-Pull: #9813
Rebased-From: 171fc91f06
2017-02-21 12:35:38 +01:00
Luke Dashjr 6552729f38
Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
Github-Pull: #9619
Rebased-From: 9fc7f0bce9
2017-02-20 17:32:59 +01:00
Russell Yanofsky 40c754cb38
[wallet] Remove importmulti always-true check
Remove "nLowestTimestamp <= chainActive.Tip()->GetBlockTimeMax()" check from
importmulti, which is always true because nLowestTimestamp is set to the
minimum of the most recent block time and all the imported key timestamps,
which is necessarily lower than the maximum block time.

Github-Pull: #9760
Rebased-From: ec1267f13b
2017-02-20 17:30:26 +01:00
Cory Fields 2afefeade6
boost: remove iostreams includes
They're unused and produce nasty deprecation warnings

Github-Pull: #9786
Rebased-From: 3301587dc5
2017-02-17 21:50:30 +01:00
Pieter Wuille 973e345f7f
Move BIP70_MAX_PAYMENTREQUEST_SIZE to header
Github-Pull: #9785
Rebased-From: c801c82e25
2017-02-17 21:50:22 +01:00
Pieter Wuille f873564231
Make KEY_SIZE a compile-time constant
Github-Pull: #9785
Rebased-From: 914fad155d
2017-02-17 21:50:14 +01:00