diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-05-13 15:38:10 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-05-20 12:25:27 -0400 |
commit | b6c1f9478f52b01f0858c402b3e73761f83e4fc6 (patch) | |
tree | 3c873282948414ee212ed084af56eb386ad03605 /src/net_processing.cpp | |
parent | 86031083c71e257778e95e21e81532b310472358 (diff) | |
download | bitcoin-b6c1f9478f52b01f0858c402b3e73761f83e4fc6.tar.xz |
Disallow extended encoding for non-witness transactions (take 3)
Github-Pull: #16021
Rebased-From: fa2b52af32f6a4b9c22c270f36e92960c29ef364
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 550be5f7ca..ab30104c47 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3096,23 +3096,22 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter if (m_enable_bip61) { connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message"))); } - if (strstr(e.what(), "end of data")) - { + if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } - else if (strstr(e.what(), "size too large")) - { + } else if (strstr(e.what(), "size too large")) { // Allow exceptions from over-long size LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } - else if (strstr(e.what(), "non-canonical ReadCompactSize()")) - { + } else if (strstr(e.what(), "non-canonical ReadCompactSize()")) { // Allow exceptions from non-canonical encoding LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } - else - { + } else if (strstr(e.what(), "Superfluous witness record")) { + // Allow exceptions from illegal witness encoding + LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); + } else if (strstr(e.what(), "Unknown transaction optional data")) { + // Allow exceptions from unknown witness encoding + LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); + } else { PrintExceptionContinue(&e, "ProcessMessages()"); } } |