Skip to content

Conversation

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Jun 1, 2017

A C-style cast is equivalent to try casting in the following order:

  1. const_cast(...)
  2. static_cast(...)
  3. const_cast(static_cast(...))
  4. reinterpret_cast(...)
  5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts.

For a more thorough discussion, see "ES.49: If you must use a cast, use a named cast" in the C++ Core Guidelines (Stroustrup & Sutter).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe std::string(NetMsgType::BLOCK) is nicer here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this need a cont_cast? this is const, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benma this isn't const in the constructor:

The type of this in a member function of class X is X* (pointer to X). If the member function is cv-qualified, the type of this is cv X* (pointer to identically cv-qualified X). Since constructors and destructors cannot be cv-qualified, the type of this in them is always X*, even when constructing or destroying a const object. (cppreference.com)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, this is only const if the function is const. My bad.

@benma
Copy link

benma commented Jun 1, 2017

utACK 1a3c1e24cbce60910843f434dc6c489d03eaed1d

@practicalswift practicalswift force-pushed the static_cast branch 2 times, most recently from 296ac8e to 6090e51 Compare June 1, 2017 14:14
@benma
Copy link

benma commented Jun 4, 2017

utACK 6090e51b5d3f8024197a31e6a5a50b812ba10aca

@maflcko
Copy link
Member

maflcko commented Jun 5, 2017

utACK 6090e51b5d3f8024197a31e6a5a50b812ba10aca does not change the binariy on my platform

@practicalswift
Copy link
Contributor Author

Rebased!

@practicalswift
Copy link
Contributor Author

Rebased!

@practicalswift
Copy link
Contributor Author

Rebased! :-)

A C-style cast is equivalent to try casting in the following order:

1. const_cast(...)
2. static_cast(...)
3. const_cast(static_cast(...))
4. reinterpret_cast(...)
5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility
of an unintentional and dangerous reinterpret_cast. Furthermore
static_cast<T>(...) allows for easier grepping of casts.
@practicalswift
Copy link
Contributor Author

Rebased!

@practicalswift
Copy link
Contributor Author

Anyone willing to review? ACK or NACK? :-)

@ghost
Copy link

ghost commented Jan 31, 2018

Why not go the extra mile and also add -Wold-style-cast, otherwise you'll be back fixing it a week later.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 9ad6746

@maflcko
Copy link
Member

maflcko commented Jan 31, 2018

re-reviewed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

re-utACK 9ad6746ccd6dc31141fd0144686b641e31bf626b
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJacgWeAAoJENLqSFDnUoslDH0P/0t30sv4UootDVMUutXKfnsK
mHKRDOKMbWLYQonJ93x89Oll+U+r+B7m7CzlxqxUNI2Zd6DETOprwLAG8F1yKHez
JUjjndpfP/6wgzyv+YEJPehFL2vVSu3Di0j82qk/1vSaYHA94bh6Y+pRnVE65951
YdpuD0scPfXIMuR93swiGpw8ttFEqZVcGtjzWlwgKO23cdJaIlZatmpi1Mw/eQea
pqhol7AgtzZeEnISYDRVcObPxVzUabGDkVXUjafJK14enMLpg6ddjV4tldLCtVfR
J5yEfxGGTcYLm5TYpvYGQS58GWZSdbUm22HPDCcjYZW+NVvXRcvsaIYPE+BZJ/u/
q9jEs3wAP7lhTp0XiFmJ6UFlyrkVBopGmNI1KPWtsxdvjoouAH8XpO3RsB6/pNZq
nLZcvg/QNSbJ5ypMFshcZ2iJjVtgmIuwC/kceAuy3nK0EkK9BFUd9qS3dzdAbYiZ
aYfZjn6fu0PWxItMzEMActleYwAdhQLjc6tX35tSlVE0ZOSJx0FDWi6dIPyzlX6L
jWGKpMCm2m/Xt19av4IS9AHk+xoIGsQrgaWt+7TYc7vssR/dlw8IXsKI2D68AEJE
IXxh6HGNeBu/2cbTQ4bwA4CtAaE5sS44EdbxbduF1mAPhUJEoywP51F9VkNAqaQQ
64GCcFS6tzqUfliIrLGl
=Gwy1
-----END PGP SIGNATURE-----

@practicalswift
Copy link
Contributor Author

practicalswift commented Feb 1, 2018

@kekimusmaximus That would be nice but I think there might be some instances of C-style casts for non-fundamental types in our dependencies, no? :-)

@ryanofsky
Copy link
Contributor

Seems like this could be merged: obvious change, has 3 acks.

@maflcko maflcko merged commit 9ad6746 into bitcoin:master Feb 7, 2018
maflcko pushed a commit that referenced this pull request Feb 12, 2018
f40df29 Fix Windows build errors introduced in #10498 (practicalswift)

Pull request description:

  Fix Windows build errors introduced in #10498

  Fixes #12386

  cc @ken2812221, @Sjors, @MarcoFalke and @floreslorca

Tree-SHA512: a807521fbd4015971e646fa4bab5495a3aaa97337e7b7d80b9161f33778e84ad6725cf4fbd5a35b50bf3a2bd97747cd7a630b51493ff516c2e1ad74acce148be
Willtech pushed a commit to Willtech/bitcoin that referenced this pull request Feb 23, 2018
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Jul 31, 2018
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 5, 2019
Summary:
A C-style cast is equivalent to try casting in the following order:

1. const_cast(...)
2. static_cast(...)
3. const_cast(static_cast(...))
4. reinterpret_cast(...)
5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility
of an unintentional and dangerous reinterpret_cast. Furthermore
static_cast<T>(...) allows for easier grepping of casts.  Please enter the commit message for your changes. Lines starting

Backport of Core PR10498
bitcoin/bitcoin#10498

Completes T555

Test Plan:
make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2765
jonspock pushed a commit to devaultcrypto/devault that referenced this pull request Apr 8, 2019
Summary:
A C-style cast is equivalent to try casting in the following order:

1. const_cast(...)
2. static_cast(...)
3. const_cast(static_cast(...))
4. reinterpret_cast(...)
5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility
of an unintentional and dangerous reinterpret_cast. Furthermore
static_cast<T>(...) allows for easier grepping of casts.  Please enter the commit message for your changes. Lines starting

Backport of Core PR10498
bitcoin/bitcoin#10498

Completes T555

Test Plan:
make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2765
jonspock added a commit to devaultcrypto/devault that referenced this pull request Apr 8, 2019
* Merge #9622: [rpc] listsinceblock should include lost transactions when parameter is a reorg'd block

Summary:
876e92b Testing: listsinceblock should display all transactions that were affected since the given block, including transactions that were removed due to a reorg. (Karl-Johan Alm)
f999c46 listsinceblock: optionally find and list any transactions that were undone due to reorg when requesting a non-main chain block in a new 'removed' array. (Karl-Johan Alm)

Pull request description:

  The following scenario will not notify the caller of the fact `tx0` has been dropped:

  1. User 1 receives BTC in tx0 from utxo1 in block aa1.
  2. User 2 receives BTC in tx1 from utxo1 (same) in block bb1
  3. User 1 sees 2 confirmations at block aa3.
  4. Reorg into bb chain.
  5. User 1 asks `listsinceblock aa3` and does not see that tx0 is now invalidated.

  See `listsinceblock.py` commit for related test.

  The proposed fix is to iterate from the given block down to the fork point, and to check each transaction in the blocks against the wallet, in addition to including all transactions from the fork point to the active chain tip (the current behavior). Any transactions that were present will now also be listed in the `listsinceblock` output in a new `replaced` array. This operation may be a bit heavy but the circumstances (and perceived frequency of occurrence) warrant it, I believe.

  Example output:
  ```Python
  {
    'transactions': [],
    'replaced': [
      {
        'walletconflicts': [],
        'vout': 1,
        'account': '',
        'timereceived': 1485234857,
        'time': 1485234857,
        'amount': '1.00000000',
        'bip125-replaceable': 'unknown',
        'trusted': False,
        'category': 'receive',
        'txid': 'ce673859a30dee1d2ebdb3c05f2eea7b1da54baf68f93bb8bfe37c5f09ed22ff',
        'address': 'miqEt4kWp9zSizwGGuUWLAmxEcTW9bFUnQ',
        'label': '',
        'confirmations': -7
      }
    ],
    'lastblock': '7a388f27d09e3699102a4ebf81597d974fc4c72093eeaa02adffbbf7527f6715'
  }
  ```

  I believe this addresses the comment by @luke-jr in bitcoin/bitcoin#9516 (comment) but I could be wrong..

Tree-SHA512: 607b5dcaeccb9dc0d963d3de138c40490f3e923050b29821e6bd513d26beb587bddc748fbb194503fe618cfe34a6ed65d95e8d9c5764a882b6c5f976520cff35

Backport of Core PR 9622
https://github.com/bitcoin/bitcoin/pull/9622/files
Completes T551

Test Plan:
make check
test_runner.py wallet_listsinceblock

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2689

* Fix unlocked_until in getwalletinfo rpc

Summary: Getwalletinfo returned an uninitialized value for unlocked_until before the first walletpassphrase call, even though the wallet was locked and it should return 0.

Test Plan:
make check
./wallet_encryption.py

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2633

* Remove nonnull warning when calling secp256k1_schnorr_sign with NULL noncefp

Summary: This warning was hidden under normal conditions because SECP256K1_ARG_NONNULL is bypassed when SECP256K1_BUILD is set. A NULL noncefp means the default nonce function is used.

Test Plan: make check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2747

* [Part 2 of 5] Add a CChainState class to clarify internal interfaces

Summary:
Move block writing out of AcceptBlock

Backport of Core PR 10279 commit e104f0f
bitcoin/bitcoin@e104f0f
Depends on D1968
Progress towards T572

Test Plan:
make check
test_runner.py

Reviewers: #bitcoin_abc, schancel, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: jasonbcox, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1969

* [secp256k1] add schnorr verify jni binding

Summary: schnorr jni binding that will allow jvm support

Test Plan:
use the test vector data from
https://github.com/sipa/bips/blob/bip-schnorr/bip-schnorr/test-vectors.csv

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox

Subscribers: jasonbcox, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2745

* Merge #10858: [RPC] Add "warnings" field to getblockchaininfo and unify "warnings" field in get*info RPCs

Summary:
395cef7 Change getmininginfo errors field to warnings (Andrew Chow)
8502b20 Unify help text for GetWarnings output in get*info RPCs (Andrew Chow)
f77f0e4 Add warnings field to getblockchaininfo (Andrew Chow)

Pull request description:

  The `getblockchaininfo` output does not contain the `warnings` field which the `getinfo`, `getmininginfo`, and `getnetworkinfo` RPCs have. It should have it as the errors pertain to the blockchain. This PR adds that field.

  This PR also unifies the help text for the `warnings` field and its output position so that all of the `get*info` commands are consistent.

  `getnetworkinfo`'s `errors` field is named `warnings`. I did not change this even though it is inconsistent since this naming has been in use for a long time.

Tree-SHA512: 385ab6acfee67fc8816f4d51ab2bd7a623264c7973906dfbab0a171f199e9db16fde19093a5bc3dfbdd4ff5f19d2186b646eb6b3bae0a4d7c9add43650a4a9d9

Backport of PR10858
bitcoin/bitcoin@9a8e916?diff=unified#diff-a0c8f511d90e83aa9b5857e819ced344R1165

Completes T567

Test Plan:
make check
test_runner.py
getblockchaininfo should also produce a "warnings" field
getmininginfo should have a "warnings" field in place of its "errors" field during regular use
getmininginfo should behave as previously (i.e. have an "errors" field) when running bitcoind -deprecatedrpc=getmininginfo

Reviewers: deadalnix, jasonbcox, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2730

* remove unused fnoncriticalerrors variable from cwalletdb::findwallettx

Summary:
remove unused fnoncriticalerrors variable from cwalletdb::findwallettx

Backport of Core PR11923
https://github.com/bitcoin/bitcoin/pull/11923/files

Completes T570

Test Plan:
make check
test_runner.py
bitcoin-qt

Reviewers: Fabien, jasonbcox, deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2742

* Fix comment about s in schnorr sigs

Summary: s/order/n/ for consistency.

Test Plan: None

Reviewers: markblundeberg, O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2741

* [Part 3 of 5] Add a CChainState class to clarify internal interfaces

Summary:
Make DisconnectBlock unaware of where undo data resides on disk

Backport of core PR 10279 Commit 93a34cf.

Depends on D1969

Test Plan:
  make VERBOSE=1 check && ./test/functional/test_runner.py

Reviewers: #bitcoin_abc, O1 Bitcoin ABC, jasonbcox

Reviewed By: #bitcoin_abc, O1 Bitcoin ABC, jasonbcox

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1970

* Lint everything

Summary: As per title

Test Plan:
  make check
  ./test/functional/test_runner.py

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2758

* Merge #10275: [rpc] Allow fetching tx directly from specified block in getrawtransaction

Summary:
434526a [test] Add tests for getrawtransaction with block hash. (Karl-Johan Alm)
b167951 [rpc] Allow getrawtransaction to take optional blockhash to fetch transaction from a block directly. (Karl-Johan Alm)
a5f5a2c [rpc] Fix fVerbose parsing (remove excess if cases). (Karl-Johan Alm)

Pull request description:

  [Reviewer hint: use [?w=1](https://github.com/bitcoin/bitcoin/pull/10275/files?w=1) to avoid seeing a bunch of indentation changes.]

  Presuming a user knows the block hash of the block containing a given transaction, this PR allows them to fetch the raw transaction, even without `-txindex`. It also enables support for getting transactions that are in orphaned blocks.

  Note that supplying a block hash will override mempool and txindex support in `GetTransaction`. The rationale behind this is that a transaction may be in multiple places (orphaned blocks) and if the user supplies an explicit block hash it should be adhered to.

  ```Bash
  $ # a41.. is a tx inside an orphan block ..3c6f.. -- first try getting it normally
  $ ./bitcoin-cli getrawtransaction a41e66ee1341aa9fb9475b98cfdc1fe1261faa56c0a49254f33065ec90f7cd79 1
  error code: -5
  error message:
  No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.
  $ # now try with block hash
  $ ./bitcoin-cli getrawtransaction a41e66ee1341aa9fb9475b98cfdc1fe1261faa56c0a49254f33065ec90f7cd79 1 0000000000000000003c6fe479122bfa4a9187493937af1734e1e5cd9f198ec7
  {
    "hex": "01000000014e7e81144e42f6d65550e59b715d470c9301fd7ac189[...]90488ac00000000",
    "inMainChain": false,
    "txid": "a41e66ee1341aa9fb9475b98cfdc1fe1261faa56c0a49254f33065ec90f7cd79",
    "hash": "a41e66ee1341aa9fb9475b98cfdc1fe1261faa56c0a49254f33065ec90f7cd79",
    "size": 225,
  [...]
  }
  $ # another tx 6c66... in block 462000
  $ ./bitcoin-cli getrawtransaction 6c66b98191e9d6cc671f6817142152ebf6c5cab2ef008397b5a71ac13255a735 1 00000000000000000217f2c12922e321f6d4aa933ce88005a9a493c503054a40
  {
    "hex": "0200000004d157[...]88acaf0c0700",
    "inMainChain": true,
    "txid": "6c66b98191e9d6cc671f6817142152ebf6c5cab2ef008397b5a71ac13255a735",
    "hash": "6c66b98191e9d6cc671f6817142152ebf6c5cab2ef008397b5a71ac13255a735",
    "size": 666,
  [...]
  }
  $
  ```

Tree-SHA512: 279be3818141edd3cc194a9ee65929331920afb30297ab2d6da07293a2d7311afee5c8b00c6457477d9f1f86e86786a9b56878ea3ee19fa2629b829d042d0cda

Backport of Core PR 10275
https://github.com/bitcoin/bitcoin/pull/10275/files
Completes T562

Test Plan:
make check
test_runner.py

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2746

* Backport remaining changes from Core PR 10742

Summary:
Partial backport of Core PR 10742
https://github.com/bitcoin/bitcoin/pull/10742/files
Completes T549

Test Plan:
make check
test_runner.py

Reviewers: #bitcoin_abc, deadalnix, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2719

* Use static_cast instead of C-style casts for non-fundamental types

Summary:
A C-style cast is equivalent to try casting in the following order:

1. const_cast(...)
2. static_cast(...)
3. const_cast(static_cast(...))
4. reinterpret_cast(...)
5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility
of an unintentional and dangerous reinterpret_cast. Furthermore
static_cast<T>(...) allows for easier grepping of casts.  Please enter the commit message for your changes. Lines starting

Backport of Core PR10498
bitcoin/bitcoin#10498

Completes T555

Test Plan:
make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2765

* Fix Windows build errors introduced in D2765

Summary:
See core issue #12386:
bitcoin/bitcoin#12386

Backport of core PR12416

Test Plan:
  make check
Build the windows binaries

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2779

* [Target v0.19] Deprecate and add test for signrawtransaction

Summary:
Deprecate signrawtransaction (target is v0.19).

Backport 3/3 of core PR10579 (part of commit d602348 + deprecation from 1e79c05)

Depends on D2763
Completes task T438

Test Plan:
  make check
  ./test/functional/test_runner.py --extended

Reviewers: #bitcoin_abc, jasonbcox, deadalnix

Reviewed By: #bitcoin_abc, jasonbcox, deadalnix

Subscribers: deadalnix, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D2009

* Add schnorr sign benchmark

Summary:
As per title.

Depends on D2747.

Test Plan: ./bench_sign

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien, jasonbcox

Subscribers: jasonbcox, Fabien, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2748

* Add schnorr verify benchmark

Summary:
As per title.

Depends on D2747.

Test Plan: ./bench_verify

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien, jasonbcox

Subscribers: jasonbcox, Fabien, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2749

* Update wallet_listsinceblock.py to use signrawtransactionwithwallet rpc

Summary:
This has been added before D2009 gets landed, it needs to be updated as
`signrawtransaction` is going to get deprecated in favor of
`signrawtransactionwithwallet` and `signrawtransactionwithkey`.

Test Plan:
  ./test/functional/test_runner.py wallet_listsinceblock

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: schancel

Differential Revision: https://reviews.bitcoinabc.org/D2763

* Document method for reviewers to verify chainTxData

Summary:
This commit adds the final block hash of the window to getchaintxstats
and documents how reviewers can verify changes to chainTxData.

Backport of PR12317: bitcoin/bitcoin#12317

Completes T566.

Test Plan:
make check
test_runner.py rpc_blockchain

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2711

* qa: Improve getchaintxstats functional test

Summary:
Completes T561.
Depends on D2711.
Backport of PR12083
https://github.com/bitcoin/bitcoin/pull/12083/files

Test Plan:
make check
test_runner.py

Reviewers: Fabien, deadalnix, O1 Bitcoin ABC, #bitcoin_abc, nakihito

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2702
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2020
…-fundamental types

9ad6746 Use static_cast instead of C-style casts for non-fundamental types (practicalswift)

Pull request description:

  A C-style cast is equivalent to try casting in the following order:

  1. `const_cast(...)`
  2. `static_cast(...)`
  3. `const_cast(static_cast(...))`
  4. `reinterpret_cast(...)`
  5. `const_cast(reinterpret_cast(...))`

  By using `static_cast<T>(...)` explicitly we avoid the possibility of an unintentional and dangerous `reinterpret_cast`. Furthermore `static_cast<T>(...)` allows for easier grepping of casts.

  For a more thorough discussion, see ["ES.49: If you must use a cast, use a named cast"](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast) in the C++ Core Guidelines (Stroustrup & Sutter).

Tree-SHA512: bd6349b7ea157da93a47b8cf238932af5dff84731374ccfd69b9f732fabdad1f9b1cdfca67497040f14eaa85346391404f4c0495e22c467f26ca883cd2de4d3c
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2020
…0498

f40df29 Fix Windows build errors introduced in bitcoin#10498 (practicalswift)

Pull request description:

  Fix Windows build errors introduced in bitcoin#10498

  Fixes bitcoin#12386

  cc @ken2812221, @Sjors, @MarcoFalke and @floreslorca

Tree-SHA512: a807521fbd4015971e646fa4bab5495a3aaa97337e7b7d80b9161f33778e84ad6725cf4fbd5a35b50bf3a2bd97747cd7a630b51493ff516c2e1ad74acce148be
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Feb 13, 2021
…non-fundamental types

ab6f1b6 Fix Windows build errors (practicalswift)
6d1ad2d Use static_cast instead of C-style casts for non-fundamental types A C-style cast is equivalent to try casting in the following order: (practicalswift)

Pull request description:

  Coming straight from bitcoin#10498 with minimum adaptations.

ACKs for top commit:
  random-zebra:
    ACK ab6f1b6
  Fuzzbawls:
    ACK ab6f1b6

Tree-SHA512: ae11572d87c92dc34f2dee2a340403f7c500906a111166d811cc6910158a641ca8abf79d0e97d20ff082221a0851226b4a39428ab8f38a32dd90b42fc5956326
@practicalswift practicalswift deleted the static_cast branch April 10, 2021 19:32
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 5, 2022
…-fundamental types

9ad6746 Use static_cast instead of C-style casts for non-fundamental types (practicalswift)

Pull request description:

  A C-style cast is equivalent to try casting in the following order:

  1. `const_cast(...)`
  2. `static_cast(...)`
  3. `const_cast(static_cast(...))`
  4. `reinterpret_cast(...)`
  5. `const_cast(reinterpret_cast(...))`

  By using `static_cast<T>(...)` explicitly we avoid the possibility of an unintentional and dangerous `reinterpret_cast`. Furthermore `static_cast<T>(...)` allows for easier grepping of casts.

  For a more thorough discussion, see ["ES.49: If you must use a cast, use a named cast"](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast) in the C++ Core Guidelines (Stroustrup & Sutter).

Tree-SHA512: bd6349b7ea157da93a47b8cf238932af5dff84731374ccfd69b9f732fabdad1f9b1cdfca67497040f14eaa85346391404f4c0495e22c467f26ca883cd2de4d3c
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants