mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Add Last db view in kvdb and statedb
Last db view is an opened pebble db which always contains a checkpoint from the last batch. Methods to access this last batch are thread safe so that views of the last checkpoint can be made anywhere and with a consistent view of the state.
This commit is contained in:
@@ -66,6 +66,9 @@ func TestDebugAPI(t *testing.T) {
|
||||
_, err = sdb.CreateAccount(account.Idx, account)
|
||||
require.Nil(t, err)
|
||||
}
|
||||
// Make a checkpoint (batchNum 2) to make the accounts available in Last
|
||||
err = sdb.MakeCheckpoint()
|
||||
require.Nil(t, err)
|
||||
|
||||
url := fmt.Sprintf("http://%v/debug/", addr)
|
||||
|
||||
@@ -73,7 +76,7 @@ func TestDebugAPI(t *testing.T) {
|
||||
req, err := sling.New().Get(url).Path("sdb/batchnum").ReceiveSuccess(&batchNum)
|
||||
require.Equal(t, http.StatusOK, req.StatusCode)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, common.BatchNum(1), batchNum)
|
||||
assert.Equal(t, common.BatchNum(2), batchNum)
|
||||
|
||||
var mtroot *big.Int
|
||||
req, err = sling.New().Get(url).Path("sdb/mtroot").ReceiveSuccess(&mtroot)
|
||||
|
||||
Reference in New Issue
Block a user