mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Add ProcessTxs send fees to Coordinator accounts
This commit is contained in:
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