mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +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:
20
common/l2tx_test.go
Normal file
20
common/l2tx_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewL2Tx(t *testing.T) {
|
||||
l2Tx := &L2Tx{
|
||||
FromIdx: 87654,
|
||||
ToIdx: 300,
|
||||
Amount: big.NewInt(4),
|
||||
Nonce: 144,
|
||||
}
|
||||
l2Tx, err := NewL2Tx(l2Tx)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "0x020000000156660000000090", l2Tx.TxID.String())
|
||||
}
|
||||
Reference in New Issue
Block a user