From 1c4d1e9a62b50a8a12739f76d32269736f7a97e5 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 9 Dec 2011 13:16:29 +0000 Subject: [PATCH] * LeaseSet: Fix size calculations --- core/java/src/net/i2p/data/LeaseSet.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/java/src/net/i2p/data/LeaseSet.java b/core/java/src/net/i2p/data/LeaseSet.java index a1ba569cc9..e372f401cd 100644 --- a/core/java/src/net/i2p/data/LeaseSet.java +++ b/core/java/src/net/i2p/data/LeaseSet.java @@ -229,7 +229,7 @@ public class LeaseSet extends DatabaseEntry { return null; int len = PublicKey.KEYSIZE_BYTES // dest + SigningPublicKey.KEYSIZE_BYTES // dest - + 4 // cert + + 3 // cert minimum, could be more, only used to size the BAOS + PublicKey.KEYSIZE_BYTES // encryptionKey + SigningPublicKey.KEYSIZE_BYTES // signingKey + 1 @@ -295,13 +295,16 @@ public class LeaseSet extends DatabaseEntry { _signature.writeBytes(out); } + /** + * Number of bytes, NOT including signature + */ public int size() { return PublicKey.KEYSIZE_BYTES //destination.pubKey + SigningPublicKey.KEYSIZE_BYTES // destination.signPubKey - + 2 // destination.certificate + + _destination.getCertificate().size() // destination.certificate, usually 3 + PublicKey.KEYSIZE_BYTES // encryptionKey + SigningPublicKey.KEYSIZE_BYTES // signingKey - + 1 + + 1 // number of leases + _leases.size() * (Hash.HASH_LENGTH + 4 + 8); } -- GitLab