@@ -17,7 +17,7 @@ func TestBadgerBlockBufferMetadataOptimization(t *testing.T) {
1717 defer buffer .Close ()
1818
1919 chainId := big .NewInt (1 )
20-
20+
2121 // Add blocks
2222 blocks := []common.BlockData {
2323 {
@@ -49,7 +49,7 @@ func TestBadgerBlockBufferMetadataOptimization(t *testing.T) {
4949 start := time .Now ()
5050 maxBlock := buffer .GetMaxBlockNumber (chainId )
5151 elapsed := time .Since (start )
52-
52+
5353 assert .NotNil (t , maxBlock )
5454 assert .Equal (t , big .NewInt (101 ), maxBlock )
5555 assert .Less (t , elapsed , time .Millisecond , "GetMaxBlockNumber should be O(1) and very fast" )
@@ -58,7 +58,7 @@ func TestBadgerBlockBufferMetadataOptimization(t *testing.T) {
5858 start = time .Now ()
5959 stats := buffer .Stats ()
6060 elapsed = time .Since (start )
61-
61+
6262 assert .Equal (t , 3 , stats .BlockCount )
6363 assert .Equal (t , 1 , stats .ChainCount )
6464 chainStats := stats .ChainStats [1 ]
@@ -71,7 +71,7 @@ func TestBadgerBlockBufferMetadataOptimization(t *testing.T) {
7171 buffer .Flush ()
7272 maxBlock = buffer .GetMaxBlockNumber (chainId )
7373 assert .Nil (t , maxBlock )
74-
74+
7575 // Add new blocks and verify metadata is rebuilt
7676 newBlocks := []common.BlockData {
7777 {
@@ -83,7 +83,7 @@ func TestBadgerBlockBufferMetadataOptimization(t *testing.T) {
8383 },
8484 }
8585 buffer .Add (newBlocks )
86-
86+
8787 maxBlock = buffer .GetMaxBlockNumber (chainId )
8888 assert .NotNil (t , maxBlock )
8989 assert .Equal (t , big .NewInt (200 ), maxBlock )
@@ -95,7 +95,7 @@ func BenchmarkBadgerBlockBufferGetMaxBlockNumber(b *testing.B) {
9595 defer buffer .Close ()
9696
9797 chainId := big .NewInt (1 )
98-
98+
9999 // Add many blocks
100100 for i := 0 ; i < 1000 ; i ++ {
101101 blocks := []common.BlockData {
@@ -141,4 +141,4 @@ func BenchmarkBadgerBlockBufferStats(b *testing.B) {
141141 for i := 0 ; i < b .N ; i ++ {
142142 _ = buffer .Stats ()
143143 }
144- }
144+ }
0 commit comments