<p><b>@sqrrm</b> commented on this pull request.</p>

<p>Seems like it's a bit risky, but not a bad idea. Need a bit more time to think on it.</p><hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/2939#discussion_r301065669">common/src/main/proto/pb.proto</a>:</p>
<pre style='color:#555'>> @@ -66,13 +66,19 @@ message NetworkEnvelope {
         NewBlindVoteStateHashMessage new_blind_vote_state_hash_message = 40;
         GetBlindVoteStateHashesRequest get_blind_vote_state_hashes_request = 41;
         GetBlindVoteStateHashesResponse get_blind_vote_state_hashes_response = 42;
+
</pre>
⬇️ Suggested change
<pre style="color: #555">-
</pre>


<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/2939#discussion_r301081127">p2p/src/main/java/bisq/network/p2p/network/Connection.java</a>:</p>
<pre style='color:#555'>> +                    long elapsed = now - lastSendTimeStamp;
+                    if (elapsed < sendMsgThrottleTrigger) {
+                        log.debug("We got 2 sendMessage requests in less than {} ms. We set the thread to sleep " +
+                                        "for {} ms to avoid flooding our peer. lastSendTimeStamp={}, now={}, elapsed={}, networkEnvelope={}",
+                                sendMsgThrottleTrigger, sendMsgThrottleSleep, lastSendTimeStamp, now, elapsed,
+                                networkEnvelope.getClass().getSimpleName());
+
+                        // check if BundleOfEnvelopes is supported
+                        if(getCapabilities().containsAll(new Capabilities(Capability.ENVELOPE_OF_ENVELOPES))) {
+                            synchronized (lock) {
+                                // check if current envelope fits size
+                                // - no? create new envelope
+                                if(queueOfBundles.isEmpty() || queueOfBundles.element().toProtoNetworkEnvelope().getSerializedSize() + networkEnvelope.toProtoNetworkEnvelope().getSerializedSize() > MAX_PERMITTED_MESSAGE_SIZE * 0.9) {
+                                    // - no? create a bucket
+                                    queueOfBundles.add(new BundleOfEnvelopes());
+                                    System.err.println("added fresh container");
</pre>
<p>Why print?  Debug cruft?</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/2939#discussion_r301082752">p2p/src/main/java/bisq/network/p2p/network/Connection.java</a>:</p>
<pre style='color:#555'>> +                                        "for {} ms to avoid flooding our peer. lastSendTimeStamp={}, now={}, elapsed={}, networkEnvelope={}",
+                                sendMsgThrottleTrigger, sendMsgThrottleSleep, lastSendTimeStamp, now, elapsed,
+                                networkEnvelope.getClass().getSimpleName());
+
+                        // check if BundleOfEnvelopes is supported
+                        if(getCapabilities().containsAll(new Capabilities(Capability.ENVELOPE_OF_ENVELOPES))) {
+                            synchronized (lock) {
+                                // check if current envelope fits size
+                                // - no? create new envelope
+                                if(queueOfBundles.isEmpty() || queueOfBundles.element().toProtoNetworkEnvelope().getSerializedSize() + networkEnvelope.toProtoNetworkEnvelope().getSerializedSize() > MAX_PERMITTED_MESSAGE_SIZE * 0.9) {
+                                    // - no? create a bucket
+                                    queueOfBundles.add(new BundleOfEnvelopes());
+                                    System.err.println("added fresh container");
+
+                                    // - and schedule it for sending
+                                    lastSendTimeStamp += sendMsgThrottleSleep;
</pre>
<p>This will distort the lastSendTimeStamp by setting it to the future. Won't this add cumulatively more time to lastSendTimeStamp if there are multiple messages that need to be sent in a short times pan?</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/2939#discussion_r301085845">p2p/src/main/java/bisq/network/p2p/network/Connection.java</a>:</p>
<pre style='color:#555'>> @@ -393,7 +432,13 @@ private boolean violatesThrottleLimit(NetworkEnvelope networkEnvelope) {
     @Override
     public void onMessage(NetworkEnvelope networkEnvelope, Connection connection) {
         checkArgument(connection.equals(this));
-        UserThread.execute(() -> messageListeners.forEach(e -> e.onMessage(networkEnvelope, connection)));
+
+        if(networkEnvelope instanceof BundleOfEnvelopes)
</pre>
<p>Style is off (missing space). Best to use some tool that handles that automatically.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/2939?email_source=notifications&email_token=AJFFTNW57GMZ5DFEFEGNFMTP6M5ETA5CNFSM4H6TK222YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5XABXA#pullrequestreview-258867420">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVPEMVVAQNB4M3RW5TP6M5ETANCNFSM4H6TK22Q">mute the thread</a>.<img src="https://github.com/notifications/beacon/AJFFTNQB4ZJ6VTTBDRHR5LLP6M5ETA5CNFSM4H6TK222YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5XABXA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/2939?email_source=notifications\u0026email_token=AJFFTNW57GMZ5DFEFEGNFMTP6M5ETA5CNFSM4H6TK222YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5XABXA#pullrequestreview-258867420",
"url": "https://github.com/bisq-network/bisq/pull/2939?email_source=notifications\u0026email_token=AJFFTNW57GMZ5DFEFEGNFMTP6M5ETA5CNFSM4H6TK222YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5XABXA#pullrequestreview-258867420",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>