mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
config/config.go: use shipclient.NULL_BLOCK_NUMBER instead of defining our own.
This commit is contained in:
parent
bd5037b044
commit
acdf827223
3 changed files with 9 additions and 7 deletions
|
|
@ -3,9 +3,9 @@ package config
|
|||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const NULL_BLOCK_NUMBER uint32 = 0xffffffff
|
||||
shipclient "github.com/eosswedenorg-go/antelope-ship-client"
|
||||
)
|
||||
|
||||
type RedisConfig struct {
|
||||
Addr string `json:"addr"`
|
||||
|
|
@ -37,8 +37,8 @@ type Config struct {
|
|||
|
||||
func Parse(data []byte) (*Config, error) {
|
||||
cfg := Config{
|
||||
StartBlockNum: NULL_BLOCK_NUMBER,
|
||||
EndBlockNum: NULL_BLOCK_NUMBER,
|
||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
MaxMessagesInFlight: 10,
|
||||
IrreversibleOnly: false,
|
||||
Redis: RedisConfig{
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
shipclient "github.com/eosswedenorg-go/antelope-ship-client"
|
||||
)
|
||||
|
||||
func TestParse_Default(t *testing.T) {
|
||||
expected := Config{
|
||||
StartBlockNum: NULL_BLOCK_NUMBER,
|
||||
EndBlockNum: NULL_BLOCK_NUMBER,
|
||||
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||
MaxMessagesInFlight: 10,
|
||||
IrreversibleOnly: false,
|
||||
Redis: RedisConfig{
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -205,7 +205,7 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
if conf.StartBlockNum == config.NULL_BLOCK_NUMBER {
|
||||
if conf.StartBlockNum == shipclient.NULL_BLOCK_NUMBER {
|
||||
if conf.IrreversibleOnly {
|
||||
conf.StartBlockNum = uint32(chainInfo.LastIrreversibleBlockNum)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue