Skip to content

Commit 816e15e

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus
9d0379c consensus: use <cstdint> over <stdint.h> in amount.h (fanquake) 863e52f consensus: make COIN & MAX_MONEY constexpr (fanquake) d09071d [MOVEONLY] consensus: move amount.h into consensus (fanquake) Pull request description: A first step (of a few) towards some source code reorganization, as well as making libbitcoinconsensus slightly more self contained. Related to #15732. ACKs for top commit: MarcoFalke: concept ACK 9d0379c 🏝 Tree-SHA512: 97fc79262dcb8c00996852a288fee69ddf8398ae2c95700bba5b326f1f38ffcfaf8fa66e29d0cb446d9b3f4e608a96525fae0c2ad9cd531ad98ad2a4a687cd6a
2 parents 9e530c6 + 9d0379c commit 816e15e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+74
-54
lines changed

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ crypto_libbitcoin_crypto_shani_a_SOURCES = crypto/sha256_shani.cpp
499499
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
500500
libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
501501
libbitcoin_consensus_a_SOURCES = \
502-
amount.h \
503502
arith_uint256.cpp \
504503
arith_uint256.h \
504+
consensus/amount.h \
505505
consensus/merkle.cpp \
506506
consensus/merkle.h \
507507
consensus/params.h \

src/bitcoin-tx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <clientversion.h>
1010
#include <coins.h>
11+
#include <consensus/amount.h>
1112
#include <consensus/consensus.h>
1213
#include <core_io.h>
1314
#include <key_io.h>

src/amount.h renamed to src/consensus/amount.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#ifndef BITCOIN_AMOUNT_H
7-
#define BITCOIN_AMOUNT_H
6+
#ifndef BITCOIN_CONSENSUS_AMOUNT_H
7+
#define BITCOIN_CONSENSUS_AMOUNT_H
88

9-
#include <stdint.h>
9+
#include <cstdint>
1010

1111
/** Amount in satoshis (Can be negative) */
1212
typedef int64_t CAmount;
1313

14-
static const CAmount COIN = 100000000;
14+
static constexpr CAmount COIN = 100000000;
1515

1616
/** No amount larger than this (in satoshi) is valid.
1717
*
@@ -22,7 +22,7 @@ static const CAmount COIN = 100000000;
2222
* critical; in unusual circumstances like a(nother) overflow bug that allowed
2323
* for the creation of coins out of thin air modification could lead to a fork.
2424
* */
25-
static const CAmount MAX_MONEY = 21000000 * COIN;
25+
static constexpr CAmount MAX_MONEY = 21000000 * COIN;
2626
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
2727

28-
#endif // BITCOIN_AMOUNT_H
28+
#endif // BITCOIN_CONSENSUS_AMOUNT_H

src/consensus/tx_check.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <consensus/tx_check.h>
66

7+
#include <consensus/amount.h>
78
#include <primitives/transaction.h>
89
#include <consensus/validation.h>
910

src/consensus/tx_verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <consensus/tx_verify.h>
66

7+
#include <consensus/amount.h>
78
#include <consensus/consensus.h>
89
#include <primitives/transaction.h>
910
#include <script/interpreter.h>

src/consensus/tx_verify.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef BITCOIN_CONSENSUS_TX_VERIFY_H
66
#define BITCOIN_CONSENSUS_TX_VERIFY_H
77

8-
#include <amount.h>
8+
#include <consensus/amount.h>
99

1010
#include <stdint.h>
1111
#include <vector>

src/core_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef BITCOIN_CORE_IO_H
66
#define BITCOIN_CORE_IO_H
77

8-
#include <amount.h>
8+
#include <consensus/amount.h>
99
#include <attributes.h>
1010

1111
#include <string>

src/core_write.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <core_io.h>
66

7+
#include <consensus/amount.h>
78
#include <consensus/consensus.h>
89
#include <consensus/validation.h>
910
#include <key_io.h>

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
#include <init.h>
1111

1212
#include <addrman.h>
13-
#include <amount.h>
1413
#include <banman.h>
1514
#include <blockfilter.h>
1615
#include <chain.h>
1716
#include <chainparams.h>
1817
#include <compat/sanity.h>
18+
#include <consensus/amount.h>
1919
#include <deploymentstatus.h>
2020
#include <fs.h>
2121
#include <hash.h>

src/interfaces/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef BITCOIN_INTERFACES_NODE_H
66
#define BITCOIN_INTERFACES_NODE_H
77

8-
#include <amount.h> // For CAmount
8+
#include <consensus/amount.h>
99
#include <external_signer.h>
1010
#include <net.h> // For NodeId
1111
#include <net_types.h> // For banmap_t

0 commit comments

Comments
 (0)