Merge pull request #405 from hermeznetwork/fix/api-nonce

Fix API nonces
This commit is contained in:
Eduard S
2020-12-22 17:43:24 +01:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ func (a *API) getAccount(c *gin.Context) {
} }
apiAccount.Balance = apitypes.NewBigIntStr(account.Balance) apiAccount.Balance = apitypes.NewBigIntStr(account.Balance)
apiAccount.Nonce = account.Nonce
c.JSON(http.StatusOK, apiAccount) c.JSON(http.StatusOK, apiAccount)
} }
@@ -67,6 +68,7 @@ func (a *API) getAccounts(c *gin.Context) {
return return
} }
apiAccounts[x].Balance = apitypes.NewBigIntStr(account.Balance) apiAccounts[x].Balance = apitypes.NewBigIntStr(account.Balance)
apiAccounts[x].Nonce = account.Nonce
} }
// Build succesfull response // Build succesfull response

View File

@@ -330,7 +330,10 @@ func TestMain(m *testing.M) {
commonL1Txs = append(commonL1Txs, block.Rollup.L1UserTxs...) commonL1Txs = append(commonL1Txs, block.Rollup.L1UserTxs...)
for _, batch := range block.Rollup.Batches { for _, batch := range block.Rollup.Batches {
commonL2Txs = append(commonL2Txs, batch.L2Txs...) commonL2Txs = append(commonL2Txs, batch.L2Txs...)
commonAccounts = append(commonAccounts, batch.CreatedAccounts...) for i := range batch.CreatedAccounts {
batch.CreatedAccounts[i].Nonce = common.Nonce(i)
commonAccounts = append(commonAccounts, batch.CreatedAccounts[i])
}
commonBatches = append(commonBatches, batch.Batch) commonBatches = append(commonBatches, batch.Batch)
commonExitTree = append(commonExitTree, batch.ExitTree...) commonExitTree = append(commonExitTree, batch.ExitTree...)
commonL1Txs = append(commonL1Txs, batch.L1CoordinatorTxs...) commonL1Txs = append(commonL1Txs, batch.L1CoordinatorTxs...)