refactor: switch StringBuilder capacity to size_hint
- Replace the StringBuilder(capacity=...) argument with size_hint=... in base32, base64, hex, SAM quoting/parsing. - Drop trailing commas after the last field in I2NP, NTCP2 and tunnel fragment enum variants (formatter cleanup). - No behavior change; encoded output and parsed fields are unchanged.
This commit is contained in:
1 parent
cadb8cd898
commit
274bb319ab
7 files changed
+12
-12
No files matched your search
+4
-4
@@ -158,7 +158,7 @@ pub(all) enum I2npPayload {
|
||||
reply_token~ : UInt32,
|
||||
reply_tunnel_id~ : UInt32,
|
||||
reply_gateway~ : @common.Hash?,
|
||||
data~ : Bytes,
|
||||
data~ : Bytes
|
||||
)
|
||||
/// Type 2: DatabaseLookup (queries NetDB for a key).
|
||||
DatabaseLookup(
|
||||
@@ -166,13 +166,13 @@ pub(all) enum I2npPayload {
|
||||
from~ : @common.Hash,
|
||||
flags~ : Byte,
|
||||
reply_tunnel_id~ : UInt32?,
|
||||
excluded_peers~ : Array[@common.Hash],
|
||||
excluded_peers~ : Array[@common.Hash]
|
||||
)
|
||||
/// Type 3: DatabaseSearchReply (floodfill returns closest router hashes).
|
||||
DatabaseSearchReply(
|
||||
key~ : @common.Hash,
|
||||
peer_hashes~ : Array[@common.Hash],
|
||||
from~ : @common.Hash,
|
||||
from~ : @common.Hash
|
||||
)
|
||||
/// Type 10: DeliveryStatus (confirms delivery of a message or tunnel test).
|
||||
DeliveryStatus(msg_id~ : UInt32, timestamp_ms~ : UInt64)
|
||||
@@ -219,7 +219,7 @@ pub fn I2npPayload::encode_body(self : I2npPayload) -> Bytes raise I2npError {
|
||||
reply_token~,
|
||||
reply_tunnel_id~,
|
||||
reply_gateway~,
|
||||
data~,
|
||||
data~
|
||||
) => {
|
||||
key.encode(w)
|
||||
w.write_u8(store_type)
|
||||
|
||||
Reference in new issue
Block a user