changeset 23699:7969db348bf5

autocorrect excessive blocks < 1000 into megabytes, allow at least 1MB message sizes regardless of excessive block setting
author Andrew Stone <g.andrew.stone@gmail.com>
date Tue, 23 Feb 2016 20:16:25 -0500
parents ed2e3e7ad715
children 35573c2205d7
files src/net.cpp src/qt/unlimiteddialog.cpp src/qt/unlimitedmodel.cpp
diffstat 3 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/net.cpp	Tue Feb 23 16:05:14 2016 -0500
+++ b/src/net.cpp	Tue Feb 23 20:16:25 2016 -0500
@@ -679,7 +679,7 @@
         // BU: only reject the message if it is some multiple of the excessive 
         // block size.  Since traffic shaping will keep the bandwidth in check
         // this basically eliminates nodes that are deliberately trying to screw us up. 
-        if (maxMessageSizeMultiplier && msg.in_data && msg.hdr.nMessageSize > (maxMessageSizeMultiplier*excessiveBlockSize)) {
+        if (maxMessageSizeMultiplier && msg.in_data && (msg.hdr.nMessageSize > BLOCKSTREAM_CORE_MAX_BLOCK_SIZE) && (msg.hdr.nMessageSize > (maxMessageSizeMultiplier*excessiveBlockSize))) {
             LogPrint("net", "Oversized message from peer=%i, disconnecting\n", GetId());
             //BU: TODO warn if too many nodes are doing this
             return false;
--- a/src/qt/unlimiteddialog.cpp	Tue Feb 23 16:05:14 2016 -0500
+++ b/src/qt/unlimiteddialog.cpp	Tue Feb 23 20:16:25 2016 -0500
@@ -52,11 +52,6 @@
 
   connect(ui.okButton, SIGNAL(clicked(bool)), this, SLOT(on_okButton_clicked()));
 
-  //ui.miningMaxBlock->setText(QString(boost::lexical_cast<std::string>(model->getMaxGeneratedBlock).c_str()));
-  //ui.miningMaxBlock->setText(QString::number(model->getMaxGeneratedBlock()));
-  //ui.excessiveBlockSize->setText(QString::number(excessiveBlockSize));
-  //ui.excessiveAcceptDepth->setText(QString::number(excessiveAcceptDepth));
-
     int64_t max, ave;
     sendShaper.get(&max, &ave);
     int64_t longMax = LONG_LONG_MAX;
--- a/src/qt/unlimitedmodel.cpp	Tue Feb 23 16:05:14 2016 -0500
+++ b/src/qt/unlimitedmodel.cpp	Tue Feb 23 20:16:25 2016 -0500
@@ -158,6 +158,7 @@
           break;
         case ExcessiveBlockSize:
           excessiveBlockSize = value.toUInt();
+          if (excessiveBlockSize < 1000) excessiveBlockSize *= 1000000;  // If the user put in a size in MB then just auto fix
           settingsToUserAgentString();
           settings.setValue("excessiveBlockSize", excessiveBlockSize);
           break;