peer: improve sendcmpct handling.
This commit is contained in:
parent
d3da8bbfb8
commit
39a4df7b02
@ -2124,7 +2124,9 @@ Peer.prototype._handleUnknown = function _handleUnknown(packet) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Peer.prototype._handleSendCmpct = function _handleSendCmpct(packet) {
|
Peer.prototype._handleSendCmpct = function _handleSendCmpct(packet) {
|
||||||
if (packet.version > 2) {
|
var max = this.options.witness ? 2 : 1;
|
||||||
|
|
||||||
|
if (packet.version > max) {
|
||||||
// Ignore
|
// Ignore
|
||||||
this.logger.info('Peer request compact blocks version %d (%s).',
|
this.logger.info('Peer request compact blocks version %d (%s).',
|
||||||
packet.version, this.hostname);
|
packet.version, this.hostname);
|
||||||
@ -2137,6 +2139,13 @@ Peer.prototype._handleSendCmpct = function _handleSendCmpct(packet) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Core witness nodes send this twice
|
||||||
|
// with both version 1 and 2 (why
|
||||||
|
// would you even _want_ non-witness
|
||||||
|
// blocks if you use segwit??).
|
||||||
|
if (this.compactMode)
|
||||||
|
return;
|
||||||
|
|
||||||
this.logger.info('Peer initialized compact blocks (%s).', this.hostname);
|
this.logger.info('Peer initialized compact blocks (%s).', this.hostname);
|
||||||
|
|
||||||
this.compactMode = packet;
|
this.compactMode = packet;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user