From 3a87233a9cbf3b4eae8afcb8389ef42b4b04d5b5 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 14 Nov 2022 15:29:31 -0800 Subject: [PATCH] Change functions of Key from pointer to value reference --- core/blockstm/mvhashmap.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/blockstm/mvhashmap.go b/core/blockstm/mvhashmap.go index a04fbfd6f0..2a517bcc84 100644 --- a/core/blockstm/mvhashmap.go +++ b/core/blockstm/mvhashmap.go @@ -20,27 +20,27 @@ const KeyLength = common.AddressLength + common.HashLength + 2 type Key [KeyLength]byte -func (k *Key) IsAddress() bool { +func (k Key) IsAddress() bool { return k[KeyLength-1] == addressType } -func (k *Key) IsState() bool { +func (k Key) IsState() bool { return k[KeyLength-1] == stateType } -func (k *Key) IsSubpath() bool { +func (k Key) IsSubpath() bool { return k[KeyLength-1] == subpathType } -func (k *Key) GetAddress() common.Address { +func (k Key) GetAddress() common.Address { return common.BytesToAddress(k[:common.AddressLength]) } -func (k *Key) GetStateKey() common.Hash { +func (k Key) GetStateKey() common.Hash { return common.BytesToHash(k[common.AddressLength : KeyLength-2]) } -func (k *Key) GetSubpath() byte { +func (k Key) GetSubpath() byte { return k[KeyLength-2] }