mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-08 11:56:46 +01:00
Add PoolL2Tx.Info about the status of the tx
PoolL2Tx.Info contains information about the status & State of the transaction. As for example, if the Tx has not been selected in the last batch due not enough Balance at the Sender account, this reason would appear at this parameter. This will help the client (wallet, batchexplorer, etc) to reason why a L2Tx is not selected in the forged batches.
This commit is contained in:
@@ -162,6 +162,30 @@ func TestAddTxTest(t *testing.T) {
|
||||
assert.Equal(t, 0, offset)
|
||||
}
|
||||
}
|
||||
func TestUpdateTxsInfo(t *testing.T) {
|
||||
err := prepareHistoryDB(historyDB)
|
||||
if err != nil {
|
||||
log.Error("Error prepare historyDB", err)
|
||||
}
|
||||
poolL2Txs, err := generatePoolL2Txs()
|
||||
assert.NoError(t, err)
|
||||
for i := range poolL2Txs {
|
||||
err := l2DB.AddTxTest(&poolL2Txs[i])
|
||||
require.NoError(t, err)
|
||||
|
||||
// once added, change the Info parameter
|
||||
poolL2Txs[i].Info = "test"
|
||||
}
|
||||
// update the txs
|
||||
err = l2DB.UpdateTxsInfo(poolL2Txs)
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := range poolL2Txs {
|
||||
fetchedTx, err := l2DB.GetTx(poolL2Txs[i].TxID)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "test", fetchedTx.Info)
|
||||
}
|
||||
}
|
||||
|
||||
func assertTx(t *testing.T, expected, actual *common.PoolL2Tx) {
|
||||
// Check that timestamp has been set within the last 3 seconds
|
||||
|
||||
Reference in New Issue
Block a user