aboutsummaryrefslogtreecommitdiff
path: root/src/primitives
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-07-25 12:13:56 +0200
committerMacroFake <falke.marco@gmail.com>2022-07-25 12:16:54 +0200
commitfa2247a9f9754d90ea60f254f6c0ed881c55772b (patch)
tree89d03db0a16a80748c432c746eaaae05e1ef9468 /src/primitives
parentf27d5f6305b6074186aafcb80f9b249cbd523196 (diff)
refactor: Make CTransaction constructor explicit
It involves calculating two hashes, so the performance impact should be made explicit. Also, add the module to iwyu.
Diffstat (limited to 'src/primitives')
-rw-r--r--src/primitives/transaction.cpp7
-rw-r--r--src/primitives/transaction.h14
2 files changed, 17 insertions, 4 deletions
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp
index f7f6ae4480..ec48194ee9 100644
--- a/src/primitives/transaction.cpp
+++ b/src/primitives/transaction.cpp
@@ -7,10 +7,15 @@
#include <consensus/amount.h>
#include <hash.h>
+#include <script/script.h>
+#include <serialize.h>
#include <tinyformat.h>
+#include <uint256.h>
#include <util/strencodings.h>
+#include <version.h>
-#include <assert.h>
+#include <cassert>
+#include <stdexcept>
std::string COutPoint::ToString() const
{
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h
index fb98fb6868..f496ea022e 100644
--- a/src/primitives/transaction.h
+++ b/src/primitives/transaction.h
@@ -6,13 +6,21 @@
#ifndef BITCOIN_PRIMITIVES_TRANSACTION_H
#define BITCOIN_PRIMITIVES_TRANSACTION_H
-#include <stdint.h>
#include <consensus/amount.h>
+#include <prevector.h>
#include <script/script.h>
#include <serialize.h>
#include <uint256.h>
+#include <cstddef>
+#include <cstdint>
+#include <ios>
+#include <limits>
+#include <memory>
+#include <string>
#include <tuple>
+#include <utility>
+#include <vector>
/**
* A flag that is ORed into the protocol version to designate that a transaction
@@ -303,7 +311,7 @@ private:
public:
/** Convert a CMutableTransaction into a CTransaction. */
explicit CTransaction(const CMutableTransaction& tx);
- CTransaction(CMutableTransaction&& tx);
+ explicit CTransaction(CMutableTransaction&& tx);
template <typename Stream>
inline void Serialize(Stream& s) const {
@@ -368,7 +376,7 @@ struct CMutableTransaction
int32_t nVersion;
uint32_t nLockTime;
- CMutableTransaction();
+ explicit CMutableTransaction();
explicit CMutableTransaction(const CTransaction& tx);
template <typename Stream>