diff --git a/lib/net/peer.js b/lib/net/peer.js index 795ec471..1b6a4254 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -746,14 +746,18 @@ Peer.prototype.write = function write(data) { */ Peer.prototype.send = function send(packet) { - var checksum; + var tx, checksum; // Used cached hashes as the // packet checksum for speed. if (packet.type === packetTypes.TX) { - checksum = packet.witness - ? packet.tx.witnessHash() - : packet.tx.hash(); + tx = packet.tx; + if (packet.witness) { + if (!tx.isCoinbase()) + checksum = tx.witnessHash() + } else { + checksum = tx.hash(); + } } this.write(this.framer.packet(packet.cmd, packet.toRaw(), checksum));