Commit Graph

18908 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
1f46de1973
Merge #12618: Set SCHED_BATCH priority on the loadblk thread.
d54874d Set SCHED_BATCH priority on the loadblk thread. (Evan Klitzke)

Pull request description:

  Today I came across #10271, and while reading the discussion #6358 was linked to. Linux systems have a `SCHED_BATCH` scheduler priority that is useful for threads like loadblk. You can find the full details at [sched(7)](http://man7.org/linux/man-pages/man7/sched.7.html), but I'll quote the relevant part of the man page below:

  > ...this policy will cause the scheduler to always assume that the thread is
  CPU-intensive. Consequently, the scheduler will apply a small scheduling penalty
  with respect to wakeup behavior, so that this thread is mildly disfavored in
  scheduling decisions.
  >
  > This policy is useful for workloads that are noninteractive, but do not want to
  lower their nice value, and for workloads that want a deterministic scheduling
  policy without interactivity causing extra preemptions (between the workload's
  tasks).

  I think this change is useful independently of #10271 and irrespective of whether that change is merged. Under normal operation the loadblk thread will just import `mempool.dat`. However, if Bitcoin is started with `-reindex` or `-reindex-chainstate` this thread will use a great deal of CPU while it rebuilds the chainstate database (and the block database in the case of `-reindex`). By setting `SCHED_BATCH` this thread is less likely to interfere with interactive tasks (e.g. the user's web browser, text editor, etc.).

  I'm leaving the nice value unchanged (which also affects scheduling decisions) because I think that's better set by the user. Likewise I'm not using [ioprio_set(2)](http://man7.org/linux/man-pages/man2/ioprio_set.2.html) because it can cause the thread to become completely I/O starved (and knowledgeable users can use `ionice(1)` anyway).

Tree-SHA512: ea8f7d3921ed5708948809da771345cdc33efd7ba3323e9dfec07a25bc21e8612e2676f9c178e2710c7bc437e8c9cafc5e0463613688fea5699b6e8e2fec6cff
2020-12-15 22:34:03 -06:00
MarcoFalke
1d13370973
Merge #12849: Tests: Add logging in loops in p2p_sendhears.py
8dd547d82b Adding logging for loop iteration level in p2p_sendheaders.py (ccdle12)

Pull request description:

  PR for #12453

  New contributor looking at mainly the 'good first issues'.

  From my understanding of the issue:
   * Track the iteration level of loop when test fails in Travis CI

  Further clarification on the issue would be greatly appreciated to narrow down what can be fixed or updated.

Tree-SHA512: 228524aad54c09979d990a0fc6818e13a11e1ab5e78b606b892e897bba7b1e09bf25447feb631049e45ac017eeb61fbf1c1f11e8bd5103648f976a05099ba9f9
2020-12-15 22:30:55 -06:00
Wladimir J. van der Laan
97260e84b0
Merge #12787: rpc: Adjust ifdef to avoid unreachable code
61f8298 rpc: Adjust ifdef to avoid unreachable code (practicalswift)

Pull request description:

  Adjust `ifdef` to avoid unreachable code.

  Introduced in 1e79c055cd.

Tree-SHA512: c775cc9181e4034f26c5b219974e06886435275933249b169d2bc8bc98f639c4027e1e7d991f43bded62146a141acee6d3be1f2b313042d9bbc0a5d2e71d6c7c
2020-12-15 22:18:26 -06:00
Wladimir J. van der Laan
2aee09c5ab
Merge #11881: Remove Python2 support
1874058 Make base58 python contrib code work with python3 (Evan Klitzke)
bc6fdf2 Change all python files to use Python3 (John Newbery)

Pull request description:

  Following discussion here: https://github.com/bitcoin/bitcoin/pull/11843#issuecomment-351033742

  It's easier for maintainers if all python tools/scripts support only a single version of Python. There are only a few scripts that aren't explicitly python3 at this point, so this PR changes those remaining scripts to explicitly require python3.

Tree-SHA512: 5d38eef6e0fc7d8515e23a1f4c75e8b4160fd0fe23cba52a1f41689b114e54a9e503e0724829e8b41982ef98f2d113df80d9e238213b74f09ceaed0344a19e24
2020-12-15 22:16:02 -06:00
Wladimir J. van der Laan
b67649f760
Merge #12779: Qt: Remove unused method setupAmountWidget(...)
3a0f8d7 Qt: Remove unused method setupAmountWidget(...) (practicalswift)

Pull request description:

  Remove unused method `setupAmountWidget(...)`.

  Last use removed in f193c57a63.

Tree-SHA512: 8f25ed2da13cfbc0f2e042286b3c979ef03de960028d7824110bdc2ed96f5075e3b35a9809a09c83caa5bad2237d2e048ff212b19a0be1d07f79c19691dfcd87
2020-12-15 22:14:16 -06:00
Wladimir J. van der Laan
6d46698979
Merge #12076: qa: Use node.datadir instead of tmpdir in test framework
c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke)

Pull request description:

  Commit c53c9831ee introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir.

  This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`.

Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
2020-12-15 22:06:42 -06:00
Wladimir J. van der Laan
9b47b31bd2
Merge #12704: base58: use map instead of strchr() when decode
bcab47b use base58 map instead of strchr() (Kevin Pan)

Pull request description:

  Use array map instead of find string position.

  Test code snippet:

  ```cpp

  #include <assert.h>
  #include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>

  #include <string>

  int main(int argc, const char * argv[]) {

    static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
    static const int8_t mapBase58[] = {
      -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
      -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
      -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
      -1, 0, 1, 2, 3, 4, 5, 6,  7, 8,-1,-1,-1,-1,-1,-1,
      -1, 9,10,11,12,13,14,15, 16,-1,17,18,19,20,21,-1,
      22,23,24,25,26,27,28,29, 30,31,32,-1,-1,-1,-1,-1,
      -1,33,34,35,36,37,38,39, 40,41,42,43,-1,44,45,46,
      47,48,49,50,51,52,53,54, 55,56,57,-1,-1,-1,-1,-1,
    };

    const std::string b58Str(pszBase58);

    for (size_t i = 0; i < b58Str.length(); i++) {
      const char *ch = strchr(pszBase58, b58Str[i]);
      printf("%d - %d\n", ch - pszBase58, mapBase58[(uint8_t)b58Str[i]]);
      assert(ch - pszBase58 == mapBase58[(uint8_t)b58Str[i]]);
    }

    assert(mapBase58['1'] == 0);
    assert(mapBase58['z'] == 57);

    /** All alphanumeric characters except for "0", "I", "O", and "l" */
    assert(mapBase58['0'] == -1);
    assert(mapBase58['I'] == -1);
    assert(mapBase58['O'] == -1);
    assert(mapBase58['l'] == -1);

    return 0;
  }

  ```

Tree-SHA512: c28376dc8c92cc4a770c3282db4a568ae5f5a08e27f714183eb3d8755421dc7aa11d7b45afa55e70eba46565f378062aac53dc8f150eeeab12ce7b5db5af89c5
2020-12-15 21:50:11 -06:00
MarcoFalke
ff7f5d5dea
Merge #12747: Fix typos
d27327c79a Fix typos (practicalswift)

Pull request description:

  Fix typos.

Tree-SHA512: f0d13d991acdec0d3adc2f091cd00ccbdda6da3c7623dfb4cbf698bac9eb6b3d88c8ad121256a96cb130f8e97bf54892f3616da0e8dc833dcf713ca7949e2801
2020-12-15 21:49:46 -06:00
MarcoFalke
32e61f1257
Merge #12746: tests: Remove unused argument max_invalid from check_estimates(...)
a004eb1dae tests: Remove unused argument max_invalid from check_estimates(...) (practicalswift)

Pull request description:

  Remove unused argument `max_invalid` from `check_estimates(...)`.

  _Note to reviewers:_ Let me know if `check_estimates(...)` is incomplete and should be fixed instead.

Tree-SHA512: 93d250184f63baa18212d13960e35ce31ebec574dbbb1af8c40f8f3aa92264b4d03878cb33b7e4e6341e0ef28fa4c1c61ad78e8f3eb0ebd78b8ced45964f362a
2020-12-15 21:44:23 -06:00
Wladimir J. van der Laan
898423ccad
Merge #12723: Qt5: Warning users about invalid-BIP21 URI bitcoin://
b7fbcc5 Qt: Warn users about invalid-BIP21 URI bitcoin:// (Alexey Ivanov)

Pull request description:

  This change affects only Qt5 users, since Qt4 QUrl don't forces lower case for urls. Also bitcoin-qt builds against Qt4 on linux.

  PR for #11645

Tree-SHA512: 6b8cb18b29dbd2754e190a662ed67274a7f0decc6adb00b7e1af107d5f8ea2845b668cf28d6ccf2f1d15e8ef212f5a76910810634a4c15e7fabd1dd2072e7232
2020-12-15 21:44:00 -06:00
MarcoFalke
4f77eff89c
Merge #12252: Require all tests to follow naming convention
125f4a4909 [tests] Require all tests to follow naming convention (Anthony Towns)

Pull request description:

  Based on top of #11774

Tree-SHA512: 1eb156b5a97b30c203b7b0ad3d2055b391ef825e2e57805c7745b5259a9b1caaa115768ec225452f12f354e550f83e071f9c6fee2c36698b4679191895aab8de
2020-12-15 20:21:00 -06:00
Wladimir J. van der Laan
2564c17330
Merge #12567: util: Print timestamp strings in logs using ISO 8601 formatting
a7324bd79 Format timestamps using ISO 8601 formatting (e.g. "2018-02-28T12:34:56Z") (practicalswift)

Pull request description:

  Print timestamp strings in logs using [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatting (e.g. `2018-02-28T12:34:56Z`):
  * `Z` is the zone designator for the zero [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) offset.
  * `T` is the delimiter used to separate date and time.

  This makes it clear for the end-user that the date/time logged is specified in UTC and not in the local time zone.

  Before this patch:

  ```
  2018-02-28 12:34:56 New outbound peer connected: version: 70015, blocks=1286123, peer=0
  ```

  After this patch:

  ```
  2018-02-28T12:34:56Z New outbound peer connected: version: 70015, blocks=1286123, peer=0
  ```

Tree-SHA512: 52b53c3d3d11ddf4af521a3b5f90a79f6e6539ee5955ec56a5aa2c6a5cf29cecf166d8cb43277c62553c3325a31bcea83691acbb4e86429c523f8aff8d7b210a
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 20:16:10 -06:00
Wladimir J. van der Laan
666f6459cf
Merge #12240: [rpc] Introduced a new fees structure that aggregates all sub-field fee types denominated in BTC
7de1de7 Add new fee structure with all sub-fields denominated in BTC (mryandao)

Pull request description:

  the denomination for `fee` is current in btc while the other such as `decendentFee` and `ancestorFee` are in satoshis.

Tree-SHA512: e428f6dca1d339f89ab73e38ce5903f5465c46b159069d9bcc3f8b1140fe6657fa49a11abe0088e9f7ba9999f64af72a349a4735bf5eaa61b8e4a185b23543f3
2020-12-15 20:16:10 -06:00
PastaPastaPasta
1c6236dcbe
Merge pull request #3870 from PastaPastaPasta/backports-0.17-pr23
Backports 0.17 pr23
2020-12-15 19:05:58 -06:00
pasta
6a83fe3661
drop include univalue, add class UniValue;
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 17:00:05 -06:00
PastaPastaPasta
13ed44dbba
fix potential deadlocks in rpcwallet.cpp
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-15 17:00:05 -06:00
PastaPastaPasta
13d99206a3
bitcoind -> dashd
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-15 17:00:05 -06:00
PastaPastaPasta
462d46109f
Remove P2WSH reference
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-15 17:00:05 -06:00
pasta
063f7655d0
signrawtransactionwithwallet in feature_dip0020_activation.py
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 17:00:05 -06:00
PastaPastaPasta
df138d7346
typo: blockHash -> basBlockHash
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-12-15 17:00:05 -06:00
Wladimir J. van der Laan
a09555c389
Merge #12678: build: Fix a few compilation issues with Clang 7 and -Werror
8ae413235 Remove redundant checks for MSG_* from configure.ac (Vasil Dimov)
71129e026 Do not check for main() in libminiupnpc (Vasil Dimov)
8c632f73c ax_boost_{chrono,unit_test_framework}.m4: take changes from upstream (Vasil Dimov)

Pull request description:

Tree-SHA512: a99ef98c0b94f892eadeda24b3d55c25bedf225b98c6e4178cf6c2d886b44d43e9f75414d0b37db9ac261cec2350666e5e64fab9c104249dd34ff485c51663cb
2020-12-15 17:00:05 -06:00
MarcoFalke
3cfe3f6db1
Merge #12720: qa: Avoiding 'file' function name from python2
0dbb32b2cb Avoiding 'file' function name from python2 with more descriptive variable naming (Jeff Rade)

Pull request description:

  @jnewbery Here is PR from review in [#12437](https://github.com/bitcoin/bitcoin/pull/12437)

Tree-SHA512: c61980f4d3170842627cd970e1f6eebaf303843dc5e95a9dcfe3ded08152be533774cb75f56a83af8452b6bcac17c0172cf20e39edf9acefb4a4c255fe893a3b
2020-12-15 17:00:05 -06:00
Wladimir J. van der Laan
02f65edb71
Merge #12680: Add missing virtual destructor in PeerLogicValidation
2b3ea39 Polish interfaces around PeerLogicValidation (Vasil Dimov)

Pull request description:

  Silence the following compiler warning:

  /usr/include/c++/v1/memory:2285:5: error: delete called on non-final 'PeerLogicValidation' that has
        virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
      delete __ptr;
      ^
  /usr/include/c++/v1/memory:2598:7: note: in instantiation of member function
        'std::__1::default_delete<PeerLogicValidation>::operator()' requested here
        __ptr_.second()(__tmp);
        ^
  init.cpp:201:15: note: in instantiation of member function 'std::__1::unique_ptr<PeerLogicValidation,
        std::__1::default_delete<PeerLogicValidation> >::reset' requested here
      peerLogic.reset();
                ^

Tree-SHA512: 0e5ead0da2da76a5276cd45e28ddfa4b92cc7225fa154a2662aad88e7210acd17b81431c98e90a2c7be08d39f8689f1d9982cdb18297d4bb0b6195ae40c7ec17
2020-12-15 17:00:05 -06:00
MarcoFalke
e723edb4e6
Merge #12681: Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER
33eb9071b9 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky)

Pull request description:

  Failure looks like:

  ```
  Entering test case "ComputeTimeSmart"
  test_bitcoin: sync.cpp💯 void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed.
  unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested)
  wallet/test/wallet_tests.cpp(566): last checkpoint
  ```

  Reproducible with:

  ```
  ./configure --enable-debug
  make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart
  ```

  Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in #11041.

  I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692

Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
2020-12-15 17:00:05 -06:00
xdustinface
e0acd39ce2
rpc|wallet: More of bitcoin#11041 2020-12-15 17:00:05 -06:00
PastaPastaPasta
a1f456c7ff
quorums: Don't shadow islockHash (#3875)
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 15:55:29 -06:00
PastaPastaPasta
2937da2219
Refactor the hardening of DIP 1 (#3874)
* Refactor the hardening of DIP 1

Signed-off-by: pasta <pasta@dashboost.org>

* Update src/validation.cpp

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-15 15:54:51 -06:00
UdjinM6
db5d906765
tests: Rework feature_new_quorum_type_activation.py using -vbparams (#3873) 2020-12-15 14:45:14 -06:00
Wladimir J. van der Laan
0efc03deb0
Merge bitcoin#11041 Add LookupBlockIndex
Contains both the changes done upstream and changes done in Dash codebase

Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:20:19 -06:00
Wladimir J. van der Laan
c7a5be4d6b
Merge #12643: [qa] util: Remove unused sync_chain
fa1436c42 [qa] util: Remove unused sync_chain (MarcoFalke)

Pull request description:

  The util function `sync_blocks` already checks for equal chains, so we can remove the unused `sync_chain`.

  Also cleaned up the errors that are printed in case of timeout:

  ```
  AssertionError: Block sync timed out:
    '72a3a3e9dcfd0a09204c3447af0f481d19641eeadbe6a91b8e680ed614bc7712'
    '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6'
    '5032af4ae22ae7a21afdc9d9f516877309c4dd8ef2ecadb9354be7088439b4a6'
  ```
  and
  ```
  AssertionError: Mempool sync timed out:
    {'c2af943d9b321c36e0f5a153a9d3d8b11bdd46ceb28e38f5fd2c722e3edb3563'}
    set()
    set()
  ```

Tree-SHA512: cb4ad30e3e3773072f59afa2c81cfa27bd8f389a93f02acb919990298627fcfbaa53a3d3944d827cc8a5d009871e42a47ea09e9bb93e85c22e3af6a24a574e5d
2020-12-15 11:06:27 -06:00
Wladimir J. van der Laan
3448da7802
Merge #10694: Remove redundant code in MutateTxSign(CMutableTransaction&, const std::string&)
b1149ee4c Remove redundant code in MutateTxSign(CMutableTransaction&, const std::string&) (practicalswift)

Pull request description:

  Remove redundant code in `MutateTxSign(CMutableTransaction&, const std::string&)`.

Tree-SHA512: 0f0aba4def18b9a4ca73f2bd676881bc05d852d1d34b564416b2b979056263e5471c5d8ce743af44ef6bce11d77b74d18151c983b735cdf47c36f6591ab4b3fb
2020-12-15 11:06:27 -06:00
Wladimir J. van der Laan
28f1a09ee4
Merge #11900: [script] simplify CheckMinimalPush checks, add safety assert
0749808a7 CheckMinimalPush comments are prescriptive (Gregory Sanders)
176db6147 simplify CheckMinimalPush checks, add safety assert (Gregory Sanders)

Pull request description:

  the two conditions could simply never be hit as `true`, as those opcodes have a push payload of size 0 in `data`.

  Added the assert for clarity for future readers(matching the gating in the interpreter) and safety for future use.

  This effects policy only.

Tree-SHA512: f49028a1d5e907ef697b9bf5104c81ba8f6a331dbe5d60d8d8515ac17d2d6bfdc9dcc856a7e3dbd54814871b7d0695584d28da6553e2d9d7715430223f0b3690
2020-12-15 11:06:27 -06:00
Wladimir J. van der Laan
e46ddf7a5f
Merge #11889: Drop extra script variable in ProduceSignature
9360f5032 Drop extra script variable in ProduceSignature (Russell Yanofsky)

Pull request description:

  Was slightly confusing.

Tree-SHA512: 1d18f92c133772ffc8eb71826c8d778988839a14bcefc50f9c591111b0a5f81ebc12bca0f1ab25d5fdd02d3d50c2325c04cbfcbdcd18a7b80ca112d049c2327d
2020-12-15 11:06:26 -06:00
pasta
185e4b128c
Merge #12443: qa: Move common args to bitcoin.conf
face722 qa: Move common args to bitcoin.conf (MarcoFalke)

Pull request description:

  Beside removing duplicates of the same args in the code, this actually helps with debugging after a test failure.

  For example, `bitcoin-qt` has `server` turned off, so you'd have to turn it on every time, if you wanted to debug a temporary test datadir created by the test framework.
  Also, `keypool` would fill up if you forget to specify `-keypool=1`.

Tree-SHA512: 996bec8738dc0fce7297ab1fc5b4fbe3aa31b9b6241f8c4e685db728925363ccaca6145ad1edc6bee2f360e02ac4b9a53fcdff74eb79de90793393742d52b559
2020-12-15 11:06:26 -06:00
MarcoFalke
3eb72d798b
Merge #12503: [RPC] createmultisig no longer takes addresses
e4c924c517 createmultisig no longer takes addresses (Gregory Sanders)

Pull request description:

Tree-SHA512: a6a752ef2282c5c893dd1a6ff5ccab42d3de1989847af627d82d41605ea19abc0aaf68567a62b6478933ba7eea09f911087b410ba7d3a815331ef15ec1ff9df0
2020-12-15 11:06:26 -06:00
MarcoFalke
d72f7c86f9
Merge #12494: Declare CMutableTransaction a struct in rawtransaction.h
eacc5b24f8 Declare CMutableTransaction a struct in rawtransaction.h (Ben Woosley)

Pull request description:

  Because it's a struct.

  Fix for #10579 - this was called out in code review. https://github.com/bitcoin/bitcoin/pull/10579#discussion_r168936821

Tree-SHA512: 10758a667218481de6f50b5ed874e92eb350c621f7a6355fba7da6ab42b09e1764f827e89491c8663e554fcfd23f124b299f968237c6ad1ff7819e211bd7e521
2020-12-15 11:06:25 -06:00
pasta
2bda82bdbe
Fix #10579
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:06:25 -06:00
Pieter Wuille
a2f107424b
Merge #10579: [RPC] Split signrawtransaction into wallet and non-wallet RPC command
d60234885b Add test for signrawtransaction (Andrew Chow)
eefff65a4b scripted-diff: change signrawtransaction to signrawtransactionwithwallet in tests (Andrew Chow)
1e79c055cd Split signrawtransaction into wallet and non-wallet (Andrew Chow)

Pull request description:

  This PR is part of #10570. It also builds on top of #10571.

  This PR splits `signrawtransaction` into two commands, `signrawtransactionwithkey` and `signrawtransactionwithwallet`. `signrawtransactionwithkey` requires private keys to be passed in and does not use the wallet for any signing. `signrawtransactionwithwallet` uses the wallet to sign a raw transaction and does not have any parameters to take private keys.

  The `signrawtransaction` RPC has been marked as deprecated and will call the appropriate RPC command based upon the parameters given. A test was added to check this behavior is still consistent with the original behavior.

  All tests that used `signrawtransaction` have been updated to use one of the two new RPCs. Most uses were changed to `signrawtransactionwithwallet`. These were changed via a scripted diff.

Tree-SHA512: d0adf5b4cd7077639c504ec07bee262a3b94658d34db0a5c86a263b6393f7aa62f45129eafe29a7c861aa58440dd19348ee0c8b685e8a62d6f4adae8ec8f8cb3
2020-12-15 11:06:25 -06:00
pasta
335303ad26
Fix #12436
Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:06:24 -06:00
Wladimir J. van der Laan
6f37eab266
Merge #12436: [rpc] Adds a functional test to validate the transaction version number in the RPC output
09b30db Asserts that the tx version number is a signed 32-bit integer. (251)

Pull request description:

  This PR attempts to resolve #11561 by addressing the feedback from @MarcoFalke; and @gmaxwell in #12430.

  Commit 30e9d24 adds a functional test to `rpc_rawtransaction.py` to assert that the transaction version number in the RPC output is a signed 32-bit integer.

  The functional test uses the raw transaction data from Mainnet transaction `c659729a7fea5071361c2c1a68551ca2bf77679b27086cc415adeeb03852e369`.

Tree-SHA512: d78f3120b9aa04537561ab5584769a838b25e162c5caa6e1543256fb27538aa4c708c939fb5ba93ccb3fa676c2d92ce8eb9cc78869f80ac96be64a7bec7bebd0
2020-12-15 11:06:19 -06:00
UdjinM6
b559a8f904
Backporting Statoshi and bitcoin#16728 (#2515)
* Backport Statoshi

This backports some of https://github.com/jlopp/statoshi.

Missing stuff: README.md and client name changes, segwit and fee estimation stats.

Fix RejectCodeToString

Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/

* Merge #16728: move-only: move coins statistics utils out of RPC

8a3b2eb17572ca2131778d52cc25ec359470a90f move-only: move coins statistics utils out of RPC (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal

  ---

  In the short-term, this move-only commit will help with fuzzing (https://github.com/bitcoin/bitcoin/pull/15606#issuecomment-524482297). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots.

  Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it.

ACKs for top commit:
  MarcoFalke:
    ACK 8a3b2eb17572ca2131778d52cc25ec359470a90f, checked --color-moved=dimmed-zebra

Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74

* Fix 16728

* Modernize StatsdClient

- Reuse some functionality from netbase
- Switch from GetRand to FastRandomContext
- Drop `using namespace std` and add `// namespace statsd`

* Introduce PeriodicStats and make StatsdClient configurable via -stats<smth> (enabled/host/port/ns/period)

* Move/rename tip stats from CheckBlock to ConnectBlock

* Add new false positives to lint-format-strings.py

* Add snprintf in statsd_client to the list of known violations in lint-locale-dependence.sh

* Fix incorrect include guard

* Use bracket syntax includes

* Replace magic numbers with defaults

* Move connection stats calculation into its own function

And bail out early if stats are disabled

* assert in PeriodicStats

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-15 10:22:23 -06:00
UdjinM6
2f27920daa
init: Fix -vbparams parsing (#3872)
Should parse `window:threshold` parts of `-vbparams` when `thresholdmin` and `falloffcoeff` are specified
2020-12-14 20:48:00 -06:00
UdjinM6
0a8664fd33
rpc: Add masternode payments (#3863)
* rpc: Implement `masternode payments`

Returns an array of deterministic masternodes and their payments for a specific block

* tests: Add rpc_masternode.py

* Apply review suggestions

* Add amounts calculated per masternode and per block

* Tweak help string

* Update src/rpc/masternode.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* rpc: Check against vector size instead of decrementing a counter

* rpc: Use `std::vector::begin()` instead of `std::begin(std::vector)`

* Drop set_dash_dip8_activation in rpc_masternode.py

* Apply suggestions from code review

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-14 20:15:09 -06:00
dustinface
0c28bf4ab8
refactor: Use constructors instead of static initialiser in CBLSId (#3869)
* bls: Add CBLSId(const int64_t n) and CBLSId(const uint256& nHash)

* bench|llmq: Refactor instantiations of CBLSId

* bls: Drop CBLSId::{SetInt, SetHash, FromInt, FromHash}

* Drop `CBLSId(int64_t)` ctor

* Partially Revert "Drop `CBLSId(int64_t)` ctor"

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-14 20:13:54 -06:00
dustinface
e90d6ad11c
refactor: Add/Use byte vector constructor for CBLSWrapper (#3868)
* bls: Add CBLSWrapper constructor which accepts a byte vecor

* bls: Bring CBLSWrapper::CBLSWrapper in scope of CBLSId, CBLSSecretKey, CBLSPublicKey

Allow them to access e.g. the new byte vector consructor.

* governance|init|privatesend|test: Refactor some BLS instantiations
2020-12-14 17:26:30 -06:00
dustinface
d0b298d9f2
llmq: Restrict ShouldSimulateError to trigger for LLMQ_TEST only (#3871)
* llmq: Restrict `ShouldSimulateError` to trigger for LLMQ_TEST only

Current `develop` tests fail. This was basically introduced by dashpay#3844 but it didn't come up before dashpay#3853 because the `v17` fork wasn't activated in `feature_llmq_dkgerrors.py`.

After  dashpay#3853 `dip0008` activation takes [200 blocks](b95cf017c3 (diff-4a04bc0b355c780033960e8c261ee9b6d3c452897e1dcd88a15d272512266c76R539)) which was normally activated after [10 blocks](b95cf017c3 (diff-b92fa0fafafa27172736ebc88f9f9b658b1160caca512a318eefb7d93d22bf3cL18)) in `feature_llmq_dkgerrors.py`. Now with the 200 blocks `v17` gets activated during test which then leads to MN1, MN2 banning MN0 because it lies in DKG of `LLMQ_TEST` and `LLMQ_TEST_V17`.

There are other ways to solve it, like enabling `dip0008` earlier or enable `v17` later but IMO its anyway better to restrict `ShouldSimulateError` to only trigger for `LLMQ_TEST`.

* Revert "llmq: Restrict `ShouldSimulateError` to trigger for LLMQ_TEST only"

This reverts commit ec42d86126.

* llmq: Restrict `ShouldSimulateError` to trigger for LLMQ_TEST only (alternative)

Move ShouldSimulateError into CDKGSession

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-14 22:53:18 +03:00
dustinface
ec77d85385
bls: Refactor CBLSWrapper::SetBuf and CBLSWrapper::GetBuf (#3867)
* bls: Add CBLSImplicit, a wrapper around uint256

This makes `CBLSImplicit` compatible (related to methods called by
CBLSWrapper) with the other classes from the
bls-signatures library.

* bls: Use CBLSImplicit instead of uint256 as base type of CBLSId

* bls: Use FromBytes directly instead of indirectly through InternalSetBuf

* bls: Use Serialize directly instead of indirectly through InternalGetBuf

* bls: Drop all occurrences of InternalSetBuf and InternalGetBuf

* bls: Use `CBLSIdImplicit` instead of `uint256` in some more places
2020-12-12 10:45:43 +01:00
UdjinM6
b95cf017c3
tests: Enable InstantSend and ChainLocks by default (#3853)
* tests: Enable ChainLocks by default

* tests: Enable InstantSend (including filtering) by default
2020-12-12 00:57:39 -06:00
UdjinM6
5bc3e6914c
Refactor GetRequiredPaymentsString / masternode winners (#3861)
* rpc: Refactor GetRequiredPaymentsString / `masternode winners`

Move (and refactor) GetRequiredPaymentsString(s) from masternode-payments.{h,cpp} and governance-classes.{cpp,h} into rpc/masternode.cpp. These functions aren't used anywhere else.

* Update src/rpc/masternode.cpp

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-12 01:38:08 +03:00
tomthoros
5a026be52c
Consensus: DIP-0020: Dash opcode updates - OP_CAT and OP_SPLIT. (#3824)
* DIP-0020: Dash opcode updates - enable OP_CAT and OP_SPLIT (renamed from OP_SUBSTR)

* DIP-0020: Dash opcode updates - DEPLOYMENT_V17 activates dip0020 opcodes

* Add/tweak MAX_SCRIPT_ELEMENT_SIZE tests for OP_CAT and OP_SPLIT

* Check nDefaultMaxNumSize in OP_SPLIT tests

* Purify DISABLED_OPCODE tests for OP_CAT and OP_SPLIT, fix DoTest to actually preserve the DIP0020 flag

* Fix `warning: '&' within '|' [-Wbitwise-op-parentheses]`

* Rework/simplify feature_dip0020_activation.py

* DIP-0020: Remove functionally redundant tests.

* Fix file permissions for feature_dip0020_activation.py

* DIP-0020: fix typo

* Update src/test/script_tests.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update test/functional/feature_dip0020_activation.py

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* DIP-0020: improve comments

* DIP-0020: dont use negative booleans

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-12-11 22:17:10 +00:00