11083 Commits

Author SHA1 Message Date
Johnson Lau
1fffc2b346 Add transaction tests for constant scriptCode
Tests showing that CONST_SCRIPTCODE is applied only to non-segwit transactions

Github-Pull: #11423
Rebased-From: 0f8719bb035187076eeac025e2c786feb0f452d7
2018-05-24 14:03:01 -04:00
Johnson Lau
d353dd121b Add constant scriptCode policy in non-segwit scripts
This disables OP_CODESEPARATOR in non-segwit scripts (even in an unexecuted branch), and makes a positive FindAndDelete result invalid. This ensures that the scriptCode serialized in SignatureHash() is always the same as the script passing to the EvalScript.

Github-Pull: #11423
Rebased-From: 9dabfe49c066301ef75bcfcb089fd308366127c4
2018-05-24 14:03:01 -04:00
Jesse Cohen
d6c3a08c48 Add unit tests for signals generated by ProcessNewBlock()
After a recent bug discovered in callback ordering in MainSignals,
this test checks invariants in ordering of
BlockConnected / BlockDisconnected / UpdatedChainTip signals

Github-Pull: #13023
Rebased-From: dd435ad40267f5c50ff17533c696f9302829a6a6
2018-05-24 13:56:00 -04:00
Jesse Cohen
bb79aaf93a Fix concurrency-related bugs in ActivateBestChain
If multiple threads are invoking ActivateBestChain, it was possible to have
them working towards different tips, and we could arrive at a less work tip
than we should.  Fix this by introducing a ChainState lock which must
be held for the entire duration of ActivateBestChain to enforce
exclusion in ABC.

Github-Pull: #13023
Rebased-From: a3ae8e68739023e5dba9e5cb190e707ed4603316
2018-05-24 13:55:57 -04:00
Matt Corallo
0948153ea6 Do not unlock cs_main in ABC unless we've actually made progress.
Technically, some internal datastructures may be in an inconsistent
state if we do this, though there are no known bugs there. Still,
for future safety, its much better to only unlock cs_main if we've
made progress (not just tried a reorg which may make progress).

Github-Pull: #13023
Rebased-From: ecc3c4a019e6db30e208b8554b1a3658dcb9a80a
2018-05-24 13:55:52 -04:00
Suhas Daftuar
c71e535aec Bugfix: ensure consistency of m_failed_blocks after reconsiderblock
Github-Pull: #13199
Rebased-From: 11fa6bb66e8c1562305d034903a0dc6aee6eea20
2018-05-24 13:55:49 -04:00
Wladimir J. van der Laan
50b2c9e0df
Merge #13253: [0.16] Further Backports
acdf4338221e35d5ec7b299bb18ccd953e28c985 Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip (Jesse Cohen)
5ff571e90c9fa71e189863e9cb21d15d5991f7da [wallet] [tests] Test disallowed multiwallet params (John Newbery)
4c14e7b67cd411b501e4a77385389da0afc9dd16 [wallet] Fix zapwallettxes/multiwallet interaction. (John Newbery)
4087dd08e7df5beedc335f4518b64eeab6a382c1 RPC Docs: gettxout*: clarify bestblock and unspent counts (David A. Harding)
b8aacd660eb9460b6a86d4402d886f0bb32af2b4 [qa] Handle disconnect_node race (Suhas Daftuar)

Pull request description:

  Backports:
  - #13201 [qa] Handle disconnect_node race
  - #13184 RPC Docs: gettxout*: clarify bestblock and unspent counts
  - #13030 [bugfix] [wallet] Fix zapwallettxes/multiwallet interaction.
  - #12988 Hold cs_main while calling UpdatedBlockTip() signal

  to the 0.16 branch.

Tree-SHA512: 8f65002bbafaf9c436f89051b2d79bf6a668fbd07bd317c64af238ed4a7c8efe776864b739a7f2869f1e3daa16f2f4366a85f41b188f9c454879d2c7b309be50
2018-05-24 10:31:36 +02:00
Adrian Gallagher
5c8e26d493
Litecoin: Basic changes for v0.16 release (#482)
* Litecon: Modify thread names

Since this string is displayed externally within lists of processes and should be consistent with branding, and not cause confusion for admins, when running "top", "ps aux", "pgrep" or similar commands.

* Litecoin: Remove invalid doxygen link

* Litecoin: Add additional optional build steps for osx builds

Fixes: https://github.com/litecoin-project/litecoin/issues/463

* Litecoin: Show scrypt sse2 status in configure and fix scrypt syntax issue
2018-05-18 22:45:23 +10:00
Wladimir J. van der Laan
5d8de76257
wallet: Exit SyncMetaData if there are no transactions to sync
Instead of crash with an assertion error, simply exit the function
`SyncMetaData` if there is no metadata to sync.

Fixes #13110.

Github-Pull: #13265
Rebased-From: b0d2ca9fb66d793e3c0f2e6ede811f1b16c33a9f
Tree-SHA512: 67e446e9ced901e37003a9661b6abea268e2ea648ac3b076d91c8d996de96bed389839a09d579a6562d930bcf501a091eb67454f474aae1174108a8650502072
2018-05-18 14:20:10 +02:00
Jesse Cohen
acdf433822
Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip
Ensures that callbacks are invoked in the order in which the chain is updated
Resolves #12978

GitHub-Pull: #12988
Rebased-From: d86edd3
2018-05-18 14:10:39 +08:00
John Newbery
4c14e7b67c
[wallet] Fix zapwallettxes/multiwallet interaction.
-zapwallettxes should be disallowed when starting bitcoin in multiwallet
mode.

GitHub-Pull: #13030
Rebased-From: 3476e3c
2018-05-17 10:50:28 +08:00
David A. Harding
4087dd08e7
RPC Docs: gettxout*: clarify bestblock and unspent counts
GitHub-Pull: #13184
Rebased-From: f30e9be
2018-05-17 10:50:28 +08:00
fanquake
9645aa6262 Remove blockmaxsize option from init.cpp 2018-05-01 20:57:58 +08:00
Matt Corallo
7847b92605 Default to defining endian-conversion DECLs in compat w/o config
While this isn't a supported build configuration, some build
systems need to build without going through our autotools steps,
so defaulting to something sane may make it easier to build.

Specifically, this fixes the inability to build
rust-bitcoinconsensus on some non-x86 platforms. It needs to build
without our autotools/configure steps to ensure correct compile
args are passed from the rust build system to gcc. Converting the
args from the rust build system to gcc would be a lot of
unmaintainable work.

GitHub-Pull: #12998
Rebased-From: 150b2f0
2018-04-26 23:43:54 +08:00
Chun Kuan Lee
1720eb3018 qt:Show the entire Window when double clicking on taskbar
GitHub-Pull: #12999
Rebased-From: 67bf2aa
2018-04-26 23:43:54 +08:00
John Newbery
e802c22947 [config] Remove blockmaxsize option
The blockmaxsize option was marked as deprecated in V0.15.1, and code
was added to convert provided blockmaxsize into blockmaxweight. However,
this code was incorrectly implemented, and blockmaxsize was silently
ignored.

No users have complained about blockmaxsize being ignored, so just
remove it in V0.17.

GitHub-Pull: #12756
Rebased-From: 4757c04
2018-04-26 23:43:54 +08:00
251
f118a7a35b Fix illegal default addProxy and addrSeparateProxyTor settings.
GitHub-Pull: #12650
Rebased-From: 40c5886
2018-04-26 23:43:54 +08:00
e0
f60e84dba4 Limit the number of IPs we use from each DNS seeder
A risk exists where a malicious DNS seeder eclipses a node by returning an enormous number of IP addresses. In this commit we mitigate this risk by limiting the number of IP addresses addrman learns to 256 per DNS seeder.

GitHub-Pull: #12626
Rebased-From: 46e7f80
2018-04-26 23:43:54 +08:00
Xinxi Wang
3f8b8a6c5f
Litecoin: M prefix added for script addresses 2018-03-15 16:47:12 -07:00
Adrian Gallagher
dd392b9acc
Litecoin: Update Qt translations 2018-03-15 16:47:04 -07:00
Adrian Gallagher
32ee7c79ae
Litecoin: Fix tests 2018-03-15 15:57:27 -07:00
Adrian Gallagher
f1e1ab4ebc
Litecoin: Update bech32 HRP's 2018-03-15 15:57:25 -07:00
Adrian Gallagher
f117e96e0f
Litecoin: Adjust fee system 2018-03-15 15:57:22 -07:00
Romano
08f2538862
Litecoin: Enable support for SSE2 instructions in scrypt via configure --enable-sse2 (#362) 2018-03-15 15:25:42 -07:00
Adrian Gallagher
020b92fb75
Litecoin: Update chainparams and blockchain size 2018-03-15 15:25:40 -07:00
Adrian Gallagher
e4aa272478
Litecoin: Update hardcoded seeds 2018-03-15 15:25:39 -07:00
Adrian Gallagher
5dab5e6757
Litecoin: Adjust splashscreen for testnet/regtest 2018-03-15 15:25:37 -07:00
Adrian Gallagher
a74a01e617
Litecoin: Branding 2018-03-15 15:25:31 -07:00
Tamas Blummer
e730b82b07 fix version typo
GitHub-Pull: #12556
Rebased-From: d16bfaa
2018-03-07 11:40:14 -05:00
Adrian Gallagher
fee6799b12
Litecoin: Protocol and default settings
0) Adjust BIP30 enforcement values

1) Reduce amount that peers can adjust our time to eliminate an attack vector. Thanks to
coblee for this fix.

2) Zeitgeist2 patch - 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.

3) Avoid overflow in CalculateNextWorkRequired(). Thanks to pooler for the overflow fix.

4) Zeitgeist2 bool fshift bnNew.bits(). Thanks to romanornr for this path.

5) SegWit ContextualCheckBlockHeader adjustment and extra coverage.

6) Reject peer proto version below 70002. Thanks to wtogami for this patch.

7) Send final alert message to nodes warning about removal of the alert system. Thanks to coblee for this patch.

8) Adjust default settings for Litecoin.
2018-03-04 18:13:23 -08:00
Wladimir J. van der Laan
a17fecfdf0
Merge #12518: [0.16] Bump leveldb subtree
835a21b Squashed 'src/leveldb/' changes from c521b3ac65..64052c76c5 (MarcoFalke)

Pull request description:

  The leveldb bump is the same branch/commit as in #12451

Tree-SHA512: 585a55747c75e990c9fd73399e98e548c01bef8b960c0a99844326de43663d004d2211b4689518f2d3e51cc48a732e9c92082939c356793143db411224fa75fa
2018-03-01 19:42:33 +01:00
Wladimir J. van der Laan
ea2e39fd20
qt: Remove faulty and unnecessary en_US translation
This faulty translation contained Chinese messages, and as en_US is our
source language, having a separate translation for it is pointless, remove it.

Tree-SHA512: 8493876926355890aa3b713851ed53d37ffe601280f7e0f45461abfe9671af10dc5c6ce966adb89b663486a46df43b0a36b797da7e1cd719597a7e15914bd4a2
2018-02-27 15:51:22 +01:00
Wladimir J. van der Laan
01f931b928
test: Add missing signal.h header
util_tests.cpp needs to include the signal.h header on FreeBSD.

Reported by denis2342 on IRC.

Github-Pull: #12447
Rebased-From: dd7e42cbb4390788705031ffa0bc893d26f0597e
Tree-SHA512: 10ead029bb59f5d69e37b5679c710f22d64051de26e1ec8342eec4e4dec4d76249e16dff78d192972bcb8d139d99c7555a7cb2fe43b2b911103eab6d6f943b79
2018-02-27 10:49:44 +01:00
Adrian Gallagher
ecf6fd0aab
Litecoin: Fix copyright year value 2018-02-26 18:57:17 -08:00
Adrian Gallagher
e838c27971
Litecoin: Fix various tests 2018-02-26 18:57:17 -08:00
Martin Smith
029707c6ee
Litecoin: Add Litecoin logos and icons
# Conflicts:
#	share/pixmaps/nsis-header.bmp
#	share/pixmaps/nsis-wizard.bmp
2018-02-26 18:57:17 -08:00
shaolinfry
4b588c670c
Litecoin: Add scrypt N=1024 PoW 2018-02-26 18:57:17 -08:00
shaolinfry
cbf7b9c79d
Litecoin: Adjust chain parameters 2018-02-26 18:57:17 -08:00
MarcoFalke
faa6dd27b1
Bump leveldb subtree 2018-02-16 08:59:28 -05:00
Wladimir J. van der Laan
51093478c0
qt: Pre-rc4 translations update
Tree-SHA512: b209b5d404395c8031d92f332885f3ec8f8d040090b0afe55a8b915192c040494c387060cc8da4dd25bdb06d2633f8d42adae27a83933704cccf31d26ad0717c
2018-02-15 23:04:45 +01:00
Pieter Wuille
3762ac127a
Make signrawtransaction accept P2SH-P2WSH redeemscripts
Github-Pull: #12427
Rebased-From: 5f605e172baee35421eb20736601befdd8cad796
Tree-SHA512: caf8c4e1806757d705493de30eea4f6a146a334ca6f6c93bc74cda43abda391b8406dd8ed6765fcde8eb86b3fb55689547ab69a30f34fca0d7896ea8c4e1db67
2018-02-15 22:38:14 +01:00
Cory Fields
ad10b90e50
fix possible shutdown assertion with -reindex-shutdown
Credit @eklitzke for reproducing.

Github-Pull: #12349
Rebased-From: ceaefdd5f362537a1908d0095059e4be788f3dee
Tree-SHA512: bdc614d3c3fba23147be9528c581e25bbf1f0c359b525b4a05472ab42484724a8b34c8b3ed151f3ff23e48235e972950f9daa155d9ca3c4a9de6d61bf0591b4b
2018-02-15 22:38:12 +01:00
Wladimir J. van der Laan
4d54e7ad41
test: Add unit test for LockDirectory
Add a unit test for LockDirectory, introduced in #11281.

Github-Pull: #12422
Rebased-From: 1d4cbd26e4220982f7f2f60e447199d6f62ae254
Tree-SHA512: 8186f4b22c65153e30ec1e0b68be20fd59d34e1fe565d99f3b5a302780125953b867fb14c37144de3fd7baf5751df94bf3901eebbb7b820491ca452706d4e205
2018-02-15 22:38:10 +01:00
Wladimir J. van der Laan
32a726846d
util: Fix multiple use of LockDirectory
This commit fixes problems with calling LockDirectory multiple times on
the same directory, or from multiple threads. It also fixes the build on
OpenBSD.

- Wrap the boost::interprocess::file_lock in a std::unique_ptr inside
  the map that keeps track of per-directory locks. This fixes a build
  issue with the clang 4.0.0+boost-1.58.0p8 version combo on OpenBSD
  6.2, and should have no observable effect otherwise.

- Protect the locks map using a mutex.

- Make sure that only locks that are successfully acquired are inserted
  in the map.

- Open the lock file for appending only if we know we don't have the
  lock yet - The `FILE* file = fsbridge::fopen(pathLockFile, "a");`
  wipes the 'we own this lock' administration, likely because it opens
  a new fd for the locked file then closes it.

Github-Pull: #12422
Rebased-From: fc888bfcacb875c45bc8f9d7ca1357ab70a30490
Tree-SHA512: c8b8942fad9ea9d9e55f8e5e360f7cf3a8b00cd17e6bc5ec5895e1e6ddcbca796e62e82856e82f0562869a624d75ad510e108077461bb47a87b2b52be0aba866
2018-02-15 22:38:08 +01:00
João Barbosa
f8938248ef
Interrupt loading thread after shutdown request
Github-Pull: #12415
Rebased-From: 2e9406c0c588ddf6f039fd3ff73c978177483869
Tree-SHA512: ad70df9fdcba38bc9eeac4e4e64f7d8607fbe92aefac3579a26939e642112d70ebee81c5a227bb8735bae87f95640061a5ab22b583275c7dd6c3277544bc427b
2018-02-15 14:42:27 +01:00
Russell Yanofsky
ff44101e8d
Fix rescan test failure due to unset g_address_type, g_change_type
New global variables were introduced in #11403 and not setting them causes:

    test_bitcoin: wallet/wallet.cpp:4259: CTxDestination GetDestinationForKey(const CPubKey&, OutputType): Assertion `false' failed.
    unknown location(0): fatal error in "importwallet_rescan": signal: SIGABRT (application abort requested)

It's possible to reproduce the failure reliably by running:

    src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/importwallet_rescan

Failures happen nondeterministically because boost test framework doesn't run
tests in a specified order, and tests that run previously can set the global
variables and mask the bug.

Github-Pull: #12424
Rebased-From: b7f6002ed5d12b461eb56b768d06f2468cd0c12e
Tree-SHA512: 1cc64db3b1d886d793e9d194b318dde3d5f628bde778a50513de4bf54dcfc77152885e72608927e3e490d253350ca0381847539a904cb31862f3a6fceac88dc1
2018-02-14 12:29:12 +01:00
Matt Corallo
0f616517e1
Fix ignoring tx data requests when fPauseSend is set on a peer
This resolves a bug introduced in
66aa1d58a158991a8014a91335b5bc9c00062f56 where, if when responding
to a series of transaction requests in a getdata we hit the send
buffer limit and set fPauseSend, we will skip one transaction per
call to ProcessGetData.

Bug found by Cory Fields (@theuni).

Github-Pull: #12392
Rebased-From: c4af7387634765d254d1432746385cf35917d367
Tree-SHA512: d2f7707eb9f925a655f66e5e77ce406c5266f7b2feccd5bcdabf6d5bc27a3f6578e753fac83d9c8c3fd7cf7de6fee086eee2f95f77af99ea2c4e5ae77c322c58
2018-02-12 10:30:50 +01:00
Sjors Provoost
d44cd7ed4b
Reset pblocktree before deleting LevelDB file
Github-Pull: #12401
Rebased-From: a8b5d20f4f171828b2bd70ab2405c42b1e452e5b
Tree-SHA512: 3a87b6113283c3588f46bb5c725ec33ac639e2f91c589b5c0eb4375e3d23bd6c18e7ba96faf70be2afea86d8e6252bf4dbcf9c9ed166ce2d49846ff947a36d2e
2018-02-12 10:30:48 +01:00
Wladimir J. van der Laan
4f63a43f6b
qt: Pre-rc3 translations update
Tree-SHA512: e91c44f19b4a6b18736e664e9f446f3e6b457a1b239999ed0171965cfb2af2702b0083340a789d26c293ebf71e52d4a87af0e44d4e6a83a920bbf98c1c3dffa9
2018-02-08 10:31:04 +01:00
fivepiece
758a41e100
Bech32 addresses in dumpwallet
Output bech32 addresses in dumpwallet if address type is not as legacy

Github-Pull: #12315
Rebased-From: 45eea40aa88f047111a9b1151fe4d1bad5c560e2
Tree-SHA512: 3426292ddaeaafebc25fe84802011f5569a0cbb47fcc3209e7f00f64fc6eb1e637732722bbd02dce8d46be87d0f3687ce8370e71e9286bf7d00afc0a895faecb
2018-02-08 10:07:45 +01:00