arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
Fix API nonces
Arnau B arnaubennassar5@gmail.com
Sat, 19 Dec 2020 21:17:03 +0100
commit

a7394cdb2a5f330292cd09aa28a3d5f7e4e96624

parent

8a2df8de0d9d9e0b58ae7c811e41d51045e931c9

2 files changed, 6 insertions(+), 1 deletions(-)

jump to
M api/account.go → api/account.go

@@ -29,6 +29,7 @@ return

} apiAccount.Balance = apitypes.NewBigIntStr(account.Balance) + apiAccount.Nonce = account.Nonce c.JSON(http.StatusOK, apiAccount) }

@@ -67,6 +68,7 @@ retSQLErr(err, c)

return } apiAccounts[x].Balance = apitypes.NewBigIntStr(account.Balance) + apiAccounts[x].Nonce = account.Nonce } // Build succesfull response
M api/api_test.go → api/api_test.go

@@ -330,7 +330,10 @@ // Set USD value for tokens in DB

commonL1Txs = append(commonL1Txs, block.Rollup.L1UserTxs...) for _, batch := range block.Rollup.Batches { 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) commonExitTree = append(commonExitTree, batch.ExitTree...) commonL1Txs = append(commonL1Txs, batch.L1CoordinatorTxs...)