mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-08 11:56:46 +01:00
Add TxID calculation & New{Layer}Tx Type
Add TxID calculation & New{Layer}Tx Type
New{Layer}Tx methods that compute the `TxID` & `TxType` values from the
transaction values:
- NewL1Tx
- NewL2Tx
- NewPoolL2Tx
Add TxID Scanner & Valuer for database/sql
HistoryDB & L2DB & API packages tests will need to be addapted to the
TestTransaction generation once is done.
This commit is contained in:
@@ -319,16 +319,19 @@ func (s *StateDB) processL2Tx(exitTree *merkletree.MerkleTree, tx *common.PoolL2
|
||||
// case ToEthAddr!=0 && ToBJJ=0
|
||||
idx, err = s.GetIdxByEthAddr(tx.ToEthAddr)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return nil, nil, false, ErrToIdxNotFound
|
||||
}
|
||||
} else if !bytes.Equal(tx.ToEthAddr.Bytes(), common.EmptyAddr.Bytes()) && tx.ToBJJ != nil {
|
||||
// case ToEthAddr!=0 && ToBJJ!=0
|
||||
idx, err = s.GetIdxByEthAddrBJJ(tx.ToEthAddr, tx.ToBJJ)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return nil, nil, false, ErrToIdxNotFound
|
||||
}
|
||||
} else {
|
||||
// rest of cases (included case ToEthAddr==0) are not possible
|
||||
log.Error(err)
|
||||
return nil, nil, false, ErrToIdxNotFound
|
||||
}
|
||||
s.zki.AuxToIdx[s.i] = idx.BigInt()
|
||||
|
||||
Reference in New Issue
Block a user