From 59cf1b38fd9ebbf1f37a12e68c763be3bdd5cdc4 Mon Sep 17 00:00:00 2001 From: KimiWu Date: Thu, 18 Apr 2024 18:07:11 +0800 Subject: [PATCH] fix: missed return from setKeyValue() --- geth-utils/gethutil/mpt/witness/leaf.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/geth-utils/gethutil/mpt/witness/leaf.go b/geth-utils/gethutil/mpt/witness/leaf.go index 67dccb577b..ae92523c76 100644 --- a/geth-utils/gethutil/mpt/witness/leaf.go +++ b/geth-utils/gethutil/mpt/witness/leaf.go @@ -483,7 +483,7 @@ func prepareStorageLeafPlaceholderNode(storage_key common.Hash, key []byte, keyI return prepareStorageLeafNode(leaf, leaf, nil, storage_key, key, false, true, true, false, false) } -func setKeyValue(row, keyRlp []byte, keyLen, offset byte, valueIsZero, isPlaceholder bool) ([]byte, []byte) { +func setKeyValue(row, keyRlp []byte, keyLen, offset byte, valueIsZero, isPlaceholder bool) ([]byte, []byte, []byte) { var valueRlp []byte value := make([]byte, valueLen) @@ -507,15 +507,13 @@ func setKeyValue(row, keyRlp []byte, keyLen, offset byte, valueIsZero, isPlaceho } } - return keyRlp, valueRlp + return value, keyRlp, valueRlp } func prepareTxLeafInfo(row []byte, valueIsZero, isPlaceholder bool) ([]byte, []byte, []byte, []byte) { var keyRlp []byte - var valueRlp []byte var keyRlpLen byte key := make([]byte, valueLen) - value := make([]byte, valueLen) keyLen := byte(0) offset := byte(1) @@ -528,17 +526,15 @@ func prepareTxLeafInfo(row []byte, valueIsZero, isPlaceholder bool) ([]byte, []b keyLen = byte(2) offset = byte(0) - keyRlp, valueRlp = setKeyValue(row, keyRlp, keyLen, offset, valueIsZero, isPlaceholder) + value, keyRlp, valueRlp := setKeyValue(row, keyRlp, keyLen, offset, valueIsZero, isPlaceholder) return key, value, keyRlp, valueRlp } func prepareStorageLeafInfo(row []byte, valueIsZero, isPlaceholder bool) ([]byte, []byte, []byte, []byte) { var keyRlp []byte - var valueRlp []byte var keyRlpLen byte key := make([]byte, valueLen) - value := make([]byte, valueLen) keyLen := byte(0) offset := byte(1) @@ -591,7 +587,7 @@ func prepareStorageLeafInfo(row []byte, valueIsZero, isPlaceholder bool) ([]byte } } - keyRlp, valueRlp = setKeyValue(row, keyRlp, keyLen, offset, valueIsZero, isPlaceholder) + value, keyRlp, valueRlp := setKeyValue(row, keyRlp, keyLen, offset, valueIsZero, isPlaceholder) return key, value, keyRlp, valueRlp }