Line data Source code
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 : 12 : /** Convert CValidationState to a human-readable message for logging */ 13 48726 : std::string FormatStateMessage(const CValidationState& state) 14 : { 15 48726 : if (state.IsValid()) { 16 38083 : return "Valid"; 17 : } 18 : 19 59369 : const std::string& debug_message = state.GetDebugMessage(); 20 10643 : if (!debug_message.empty()) { 21 198 : return strprintf("%s, %s", state.GetRejectReason(), debug_message); 22 : } 23 : 24 21220 : return state.GetRejectReason(); 25 : } 26 : 27 : const std::string strMessageMagic = "DarkNet Signed Message:\n";