peer: fix checksum optimization for spv serving.
This commit is contained in:
parent
061548f2ac
commit
1096cd0bd9
@ -746,14 +746,18 @@ Peer.prototype.write = function write(data) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Peer.prototype.send = function send(packet) {
|
Peer.prototype.send = function send(packet) {
|
||||||
var checksum;
|
var tx, checksum;
|
||||||
|
|
||||||
// Used cached hashes as the
|
// Used cached hashes as the
|
||||||
// packet checksum for speed.
|
// packet checksum for speed.
|
||||||
if (packet.type === packetTypes.TX) {
|
if (packet.type === packetTypes.TX) {
|
||||||
checksum = packet.witness
|
tx = packet.tx;
|
||||||
? packet.tx.witnessHash()
|
if (packet.witness) {
|
||||||
: packet.tx.hash();
|
if (!tx.isCoinbase())
|
||||||
|
checksum = tx.witnessHash()
|
||||||
|
} else {
|
||||||
|
checksum = tx.hash();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.write(this.framer.packet(packet.cmd, packet.toRaw(), checksum));
|
this.write(this.framer.packet(packet.cmd, packet.toRaw(), checksum));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user