make build records smaller

pull/320/head
Jeff Becker 5 years ago
parent 41bb83aaba
commit 591f3c92a9
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -39,6 +39,16 @@ namespace llarp
return *this;
}
void
Resize(size_t sz)
{
if(sz <= EncryptedFrameSize)
{
_sz = sz;
UpdateBuffer();
}
}
bool
DecryptInPlace(const SecretKey& seckey, llarp::Crypto* crypto);

@ -89,17 +89,18 @@ namespace llarp
record.nextHop = hop.upstream;
record.commkey = seckey_topublic(hop.commkey);
auto buf = frame.Buffer();
buf->cur = buf->base + EncryptedFrameOverheadSize;
llarp_buffer_t buf(frame.data(), frame.size());
buf.cur = buf.base + EncryptedFrameOverheadSize;
// encode record
if(!record.BEncode(buf))
if(!record.BEncode(&buf))
{
// failed to encode?
LogError("Failed to generate Commit Record");
DumpBuffer(*buf);
DumpBuffer(buf);
delete ctx;
return;
}
frame.Resize(buf.cur - buf.base);
// use ephemeral keypair for frame
SecretKey framekey;
ctx->crypto->encryption_keygen(framekey);

Loading…
Cancel
Save