-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathopi_compare_test.go
39 lines (36 loc) · 1.13 KB
/
opi_compare_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"log"
"testing"
"time"
"github.com/RiemaLabs/modular-indexer-committee/ord"
"github.com/RiemaLabs/modular-indexer-committee/ord/stateless"
)
func Test_OPI(t *testing.T) {
var latestHeight uint = stateless.BRC20StartHeight + ord.BitcoinConfirmations
records, err := stateless.LoadOPIRecords("./data/785000-ordi.csv")
if err != nil {
log.Fatalf(fmt.Sprintf("error happened: %v", err))
}
ordGetterTest, arguments := loadMain(782000)
queue, err := CatchupStage(ordGetterTest, &arguments, stateless.BRC20StartHeight-1, latestHeight)
if err != nil {
log.Fatalf(fmt.Sprintf("error happened: %v", err))
}
ordGetterTest.SetLatestBlockHeight(latestHeight)
go ServiceStage(ordGetterTest, &arguments, queue, 10*time.Millisecond)
for {
curHeight, _ := ordGetterTest.GetLatestBlockHeight()
if curHeight == queue.LatestHeight() {
queue.Header.VerifyState(&records)
log.Printf("Block: %d is verified!\n", curHeight)
ordGetterTest.SetLatestBlockHeight(curHeight + 1)
}
newHeight, _ := ordGetterTest.GetLatestBlockHeight()
if newHeight >= 780000 {
break
}
time.Sleep(10 * time.Millisecond)
}
}