aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-03-01 15:33:52 -0500
committerMarcoFalke <falke.marco@gmail.com>2020-03-01 15:34:05 -0500
commit54a7ef612a3b69984d521432f8a694a682c76090 (patch)
tree13004adb153060fe957b54a0f18f3e03c2228a00 /src/util
parent715dbbe9e8b64fd4b556a0b0720b44d68c3b5e32 (diff)
parent10efc0487c442bccb0e4a9ac29452af1592a3cf2 (diff)
downloadbitcoin-54a7ef612a3b69984d521432f8a694a682c76090.tar.xz
Merge #17399: validation: Templatize ValidationState instead of subclassing
10efc0487c442bccb0e4a9ac29452af1592a3cf2 Templatize ValidationState instead of subclassing (Jeffrey Czyz) 10e85d4adc9b7dbbda63e00195e0a962f51e4d2c Remove ValidationState's constructor (Jeffrey Czyz) 0aed17ef2892478c28cd660e53223c6dd1dc0187 Refactor FormatStateMessage into ValidationState (Jeffrey Czyz) Pull request description: This removes boilerplate code in the subclasses which otherwise only differ by the result type. The subclassing was introduced in a27a295. ACKs for top commit: MarcoFalke: ACK 10efc0487c442bccb0e4a9ac29452af1592a3cf2 🐱 ajtowns: ACK 10efc0487c442bccb0e4a9ac29452af1592a3cf2 -- looks good to me jonatack: ACK 10efc048 code review, build/tests green, nice cleanup Tree-SHA512: 765dd52dde7d49b9a5c6d99d97c96f4492673e2aed0b0604faa88db0308fa4500a26bf755cca0b896be283874096c215932e1110a2d01dc012cd36a5fce58a42
Diffstat (limited to 'src/util')
-rw-r--r--src/util/validation.cpp23
-rw-r--r--src/util/validation.h16
2 files changed, 0 insertions, 39 deletions
diff --git a/src/util/validation.cpp b/src/util/validation.cpp
deleted file mode 100644
index ffbee21aeb..0000000000
--- a/src/util/validation.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2020 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include <util/validation.h>
-
-#include <consensus/validation.h>
-#include <tinyformat.h>
-
-std::string FormatStateMessage(const ValidationState &state)
-{
- if (state.IsValid()) {
- return "Valid";
- }
-
- const std::string debug_message = state.GetDebugMessage();
- if (!debug_message.empty()) {
- return strprintf("%s, %s", state.GetRejectReason(), debug_message);
- }
-
- return state.GetRejectReason();
-}
diff --git a/src/util/validation.h b/src/util/validation.h
deleted file mode 100644
index 5ee260a055..0000000000
--- a/src/util/validation.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2019 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_UTIL_VALIDATION_H
-#define BITCOIN_UTIL_VALIDATION_H
-
-#include <string>
-
-class ValidationState;
-
-/** Convert ValidationState to a human-readable message for logging */
-std::string FormatStateMessage(const ValidationState &state);
-
-#endif // BITCOIN_UTIL_VALIDATION_H