Proper message sequence implementation for Response and Pong messages. Record round-trip time at connection level! Reply timeout. Close #13 #5

Fixes.
This commit is contained in:
Kleissner
2021-04-19 05:18:07 +02:00
parent 00db57aed8
commit b2db81143e
10 changed files with 166 additions and 37 deletions

View File

@@ -99,7 +99,7 @@ func PacketEncrypt(senderPrivateKey *btcec.PrivateKey, receiverPublicKey *btcec.
raw[4] = packet.Protocol
raw[5] = packet.Command
binary.LittleEndian.PutUint16(raw[6:10], uint16(packet.Sequence))
binary.LittleEndian.PutUint32(raw[6:10], uint32(packet.Sequence))
binary.LittleEndian.PutUint16(raw[10:12], uint16(len(packet.Payload)))
copy(raw[12:], packet.Payload)
copy(raw[12+len(packet.Payload):12+len(packet.Payload)+len(garbage)], garbage)