mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Add methods for ZKInputs IntermStates generation
- Add L1Tx TxCompressedData method - Add PoolL2Tx TxCompressedDataV2 method - Update ProcessTxs logic - Add ZKInputs Intermediate States & Fee parameters calculation
This commit is contained in:
@@ -160,3 +160,19 @@ func BJJCompressedTo256BigInts(pkComp babyjub.PublicKeyComp) [256]*big.Int {
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// formatAccumulatedFees returns an array of [nFeeAccounts]*big.Int containing
|
||||
// the balance of each FeeAccount, taken from the 'collectedFees' map, in the
|
||||
// order of the 'orderTokenIDs'
|
||||
func formatAccumulatedFees(collectedFees map[common.TokenID]*big.Int, orderTokenIDs []*big.Int) []*big.Int {
|
||||
accFeeOut := make([]*big.Int, len(orderTokenIDs))
|
||||
for i := 0; i < len(orderTokenIDs); i++ {
|
||||
tokenID := common.TokenIDFromBigInt(orderTokenIDs[i])
|
||||
if _, ok := collectedFees[tokenID]; ok {
|
||||
accFeeOut[i] = collectedFees[tokenID]
|
||||
} else {
|
||||
accFeeOut[i] = big.NewInt(0)
|
||||
}
|
||||
}
|
||||
return accFeeOut
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user