mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Add ProcessTxs send fees to Coordinator accounts
This commit is contained in:
@@ -60,7 +60,7 @@ func NewL1Tx(l1Tx *L1Tx) (*L1Tx, error) {
|
||||
if l1Tx.ToIdx == Idx(0) {
|
||||
txType = TxTypeDeposit
|
||||
} else if l1Tx.ToIdx == Idx(1) {
|
||||
txType = TxTypeExit
|
||||
txType = TxTypeForceExit
|
||||
} else if l1Tx.ToIdx >= IdxUserThreshold {
|
||||
if l1Tx.LoadAmount.Int64() == int64(0) {
|
||||
txType = TxTypeForceTransfer
|
||||
|
||||
@@ -250,6 +250,7 @@ func (tx PoolL2Tx) Tx() Tx {
|
||||
FromIdx: tx.FromIdx,
|
||||
ToIdx: tx.ToIdx,
|
||||
Amount: tx.Amount,
|
||||
TokenID: tx.TokenID,
|
||||
Nonce: &tx.Nonce,
|
||||
Fee: &tx.Fee,
|
||||
Type: tx.Type,
|
||||
|
||||
28
common/tx.go
28
common/tx.go
@@ -1,6 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"database/sql/driver"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
@@ -145,6 +146,33 @@ type Tx struct {
|
||||
Nonce *Nonce `meddler:"nonce"`
|
||||
}
|
||||
|
||||
func (tx *Tx) String() string {
|
||||
buf := bytes.NewBufferString("")
|
||||
fmt.Fprintf(buf, "Type: %s, ", tx.Type)
|
||||
fmt.Fprintf(buf, "FromIdx: %s, ", tx.FromIdx)
|
||||
if tx.Type == TxTypeTransfer ||
|
||||
tx.Type == TxTypeDepositTransfer ||
|
||||
tx.Type == TxTypeCreateAccountDepositTransfer {
|
||||
fmt.Fprintf(buf, "ToIdx: %s, ", tx.ToIdx)
|
||||
}
|
||||
if tx.Type == TxTypeDeposit ||
|
||||
tx.Type == TxTypeDepositTransfer ||
|
||||
tx.Type == TxTypeCreateAccountDepositTransfer {
|
||||
fmt.Fprintf(buf, "LoadAmount: %d, ", tx.LoadAmount)
|
||||
}
|
||||
if tx.Type != TxTypeDeposit {
|
||||
fmt.Fprintf(buf, "Amount: %s, ", tx.Amount)
|
||||
}
|
||||
if tx.Type == TxTypeTransfer ||
|
||||
tx.Type == TxTypeDepositTransfer ||
|
||||
tx.Type == TxTypeCreateAccountDepositTransfer {
|
||||
fmt.Fprintf(buf, "Fee: %d, ", tx.Fee)
|
||||
}
|
||||
fmt.Fprintf(buf, "TokenID: %d\n", tx.TokenID)
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// L1Tx returns a *L1Tx from the Tx
|
||||
func (tx *Tx) L1Tx() (*L1Tx, error) {
|
||||
return &L1Tx{
|
||||
|
||||
Reference in New Issue
Block a user