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) {
|
||||
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));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user