mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
11f4978ed4
Following our previous discussion on erigon's discord, this PR requests to upstream all Otterscan modifications to erigon's repo. That decision comes after getting feedback from lots of users at events this year, and although it may introduce some friction for development, it will make integrators life easier by having all our modifications available out of box, e.g., dappnode users will get our RPCs since their official packages are built from erigon repo. I'm submitting the source-code as-is, please let me know if you think there is a better code organization. The current set of modifications comprises only new RPCs. There are some proposals for extra-stages that would add new tables, but they are still WIP and will be submitted separately in future after more testing.
32 lines
684 B
Go
32 lines
684 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/RoaringBitmap/roaring/roaring64"
|
|
)
|
|
|
|
func createBitmap(t *testing.T, blocks []uint64) []byte {
|
|
bm := roaring64.NewBitmap()
|
|
bm.AddMany(blocks)
|
|
|
|
chunk, err := bm.ToBytes()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return chunk
|
|
}
|
|
|
|
func checkNext(t *testing.T, blockProvider BlockProvider, expectedBlock uint64, expectedHasNext bool) {
|
|
bl, hasNext, err := blockProvider()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if bl != expectedBlock {
|
|
t.Fatalf("Expected block %d, received %d", expectedBlock, bl)
|
|
}
|
|
if expectedHasNext != hasNext {
|
|
t.Fatalf("Expected hasNext=%t, received=%t; at block=%d", expectedHasNext, hasNext, expectedBlock)
|
|
}
|
|
}
|