Update SQL schemas

This commit is contained in:
a_bennassar
2020-08-13 12:53:42 +02:00
committed by arnaucube
parent bf1a648091
commit cb1b820256
12 changed files with 418 additions and 108 deletions

View File

@@ -88,7 +88,7 @@ func (bb *BatchBuilder) BuildBatch(configBatch ConfigBatch, l1usertxs, l1coordin
case common.TxTypeTransfer:
// go to the MT account of sender and receiver, and update
// balance & nonce
err := bb.applyTransfer(tx.Tx)
err := bb.applyTransfer(tx.Tx())
if err != nil {
return nil, err
}
@@ -106,7 +106,7 @@ func (bb *BatchBuilder) processL1Tx(tx common.L1Tx) error {
case common.TxTypeForceTransfer, common.TxTypeTransfer:
// go to the MT account of sender and receiver, and update balance
// & nonce
err := bb.applyTransfer(tx.Tx)
err := bb.applyTransfer(tx.Tx())
if err != nil {
return err
}
@@ -136,7 +136,7 @@ func (bb *BatchBuilder) processL1Tx(tx common.L1Tx) error {
if err != nil {
return err
}
err = bb.applyTransfer(tx.Tx)
err = bb.applyTransfer(tx.Tx())
if err != nil {
return err
}
@@ -186,9 +186,9 @@ func (bb *BatchBuilder) applyDeposit(tx common.L1Tx, transfer bool) error {
return err
}
// substract amount to the sender
accSender.Balance = new(big.Int).Sub(accSender.Balance, tx.Tx.Amount)
accSender.Balance = new(big.Int).Sub(accSender.Balance, tx.Amount)
// add amount to the receiver
accReceiver.Balance = new(big.Int).Add(accReceiver.Balance, tx.Tx.Amount)
accReceiver.Balance = new(big.Int).Add(accReceiver.Balance, tx.Amount)
// update receiver account in localStateDB
err = bb.localStateDB.UpdateAccount(tx.ToIdx, accReceiver)
if err != nil {