From 9f7615962f01d0d79b38e993791d5b4f159fae4b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 10 Aug 2023 17:23:31 +0300 Subject: [PATCH] *: Use `AppendUint64` for byte slice appending Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/process_update.go | 7 +------ pkg/local_object_storage/pilorama/boltdb.go | 7 ++----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index b180b4bbfe..59a73378f4 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -112,12 +112,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) { } // 4. Update NeoFS contract in the mainnet. - epoch := gp.epochState.EpochCounter() - - buf := make([]byte, 8) - binary.LittleEndian.PutUint64(buf, epoch) - - id := append([]byte(alphabetUpdateIDPrefix), buf...) + id := binary.LittleEndian.AppendUint64([]byte(alphabetUpdateIDPrefix), gp.epochState.EpochCounter()) prm := neofscontract.AlphabetUpdatePrm{} diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 70b2602b9f..88c6b37431 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -927,11 +927,8 @@ func internalKey(key []byte, k, v string, parent, node Node) []byte { key = append(key, byte(l), byte(l>>8)) key = append(key, v...) - var raw [8]byte - binary.LittleEndian.PutUint64(raw[:], parent) - key = append(key, raw[:]...) + key = binary.LittleEndian.AppendUint64(key, parent) + key = binary.LittleEndian.AppendUint64(key, node) - binary.LittleEndian.PutUint64(raw[:], node) - key = append(key, raw[:]...) return key }