mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
p2p/enr: reduce allocation in Record.encode (#24034)
This commit is contained in:
parent
721c5723c0
commit
8fbe0b9b68
1 changed files with 1 additions and 1 deletions
|
|
@ -304,7 +304,7 @@ func (r *Record) AppendElements(list []interface{}) []interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Record) encode(sig []byte) (raw []byte, err error) {
|
func (r *Record) encode(sig []byte) (raw []byte, err error) {
|
||||||
list := make([]interface{}, 1, 2*len(r.pairs)+1)
|
list := make([]interface{}, 1, 2*len(r.pairs)+2)
|
||||||
list[0] = sig
|
list[0] = sig
|
||||||
list = r.AppendElements(list)
|
list = r.AppendElements(list)
|
||||||
if raw, err = rlp.EncodeToBytes(list); err != nil {
|
if raw, err = rlp.EncodeToBytes(list); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue