PIVX Core  5.6.99
P2P Digital Currency
validation.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2019 The Bitcoin Core developers
3 // Copyright (c) 2021 The PIVX Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #include "util/validation.h"
8 
9 #include "consensus/validation.h"
10 #include "tinyformat.h"
11 
13 std::string FormatStateMessage(const CValidationState& state)
14 {
15  if (state.IsValid()) {
16  return "Valid";
17  }
18 
19  const std::string& debug_message = state.GetDebugMessage();
20  if (!debug_message.empty()) {
21  return strprintf("%s, %s", state.GetRejectReason(), debug_message);
22  }
23 
24  return state.GetRejectReason();
25 }
26 
27 const std::string strMessageMagic = "DarkNet Signed Message:\n";
Capture information about block/transaction validation.
Definition: validation.h:24
bool IsValid() const
Definition: validation.h:69
std::string GetRejectReason() const
Definition: validation.h:94
std::string GetDebugMessage() const
Definition: validation.h:95
#define strprintf
Definition: tinyformat.h:1056
const std::string strMessageMagic
Definition: validation.cpp:27
std::string FormatStateMessage(const CValidationState &state)
Convert CValidationState to a human-readable message for logging.
Definition: validation.cpp:13