Add ProcessTxs send fees to Coordinator accounts

This commit is contained in:
arnaucube
2020-10-26 17:35:23 +01:00
parent 382bcfeee1
commit 8f24aa93c9
17 changed files with 195 additions and 65 deletions

View File

@@ -2,6 +2,7 @@ package statedb
import (
"bytes"
"fmt"
"math/big"
ethCommon "github.com/ethereum/go-ethereum/common"
@@ -108,6 +109,18 @@ func (s *StateDB) GetIdxByEthAddrBJJ(addr ethCommon.Address, pk *babyjub.PublicK
return common.Idx(0), ErrToIdxNotFound
}
func (s *StateDB) getTokenIDsFromIdxs(idxs []common.Idx) (map[common.TokenID]common.Idx, error) {
m := make(map[common.TokenID]common.Idx)
for i := 0; i < len(idxs); i++ {
a, err := s.GetAccount(idxs[i])
if err != nil {
return nil, fmt.Errorf("getTokenIDsFromIdxs error on GetAccount with Idx==%d: %s", idxs[i], err.Error())
}
m[a.TokenID] = idxs[i]
}
return m, nil
}
func siblingsToZKInputFormat(s []*merkletree.Hash) []*big.Int {
b := make([]*big.Int, len(s))
for i := 0; i < len(s); i++ {