Add StateDB set & get Idx by EthAddr & BJJ methods

This commit is contained in:
arnaucube
2020-09-17 12:42:06 +02:00
parent 05b273cc00
commit 934b6120ae
6 changed files with 190 additions and 32 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/binary"
"fmt"
"math/big"
"strconv"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/iden3/go-iden3-crypto/babyjub"
@@ -34,6 +35,11 @@ const (
// Idx represents the account Index in the MerkleTree
type Idx uint32
// String returns a string representation of the Idx
func (idx Idx) String() string {
return strconv.Itoa(int(idx))
}
// Bytes returns a byte array representing the Idx
func (idx Idx) Bytes() []byte {
var b [4]byte