Add TokenID to L2Tx

L2Tx.TokenID is not on the data obtained by the Synchronizer from the
blockchain, but is set by the TxProcessor when processing the
transactions in the StateDB.
This commit is contained in:
arnaucube
2021-01-27 12:40:09 +01:00
parent f3678e8cb8
commit a899f43914
5 changed files with 25 additions and 13 deletions

View File

@@ -906,6 +906,7 @@ func (hdb *HistoryDB) addL2Txs(d meddler.DB, l2txs []common.L2Tx) error {
FromIdx: &l2txs[i].FromIdx,
EffectiveFromIdx: &l2txs[i].FromIdx,
ToIdx: l2txs[i].ToIdx,
TokenID: l2txs[i].TokenID,
Amount: l2txs[i].Amount,
AmountFloat: amountFloat,
BatchNum: &l2txs[i].BatchNum,
@@ -1278,8 +1279,8 @@ func (hdb *HistoryDB) GetAllL2Txs() ([]common.L2Tx, error) {
err := meddler.QueryAll(
hdb.db, &txs,
`SELECT tx.id, tx.batch_num, tx.position,
tx.from_idx, tx.to_idx, tx.amount, tx.fee, tx.nonce,
tx.type, tx.eth_block_num
tx.from_idx, tx.to_idx, tx.amount, tx.token_id,
tx.fee, tx.nonce, tx.type, tx.eth_block_num
FROM tx WHERE is_l1 = FALSE ORDER BY item_id;`,
)
return db.SlicePtrsToSlice(txs).([]common.L2Tx), tracerr.Wrap(err)