mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
)
|
|
||||||
|
|
||||||
const NULL_BLOCK_NUMBER uint32 = 0xffffffff
|
shipclient "github.com/eosswedenorg-go/antelope-ship-client"
|
||||||
|
)
|
||||||
|
|
||||||
type RedisConfig struct {
|
type RedisConfig struct {
|
||||||
Addr string `json:"addr"`
|
Addr string `json:"addr"`
|
||||||
|
|
@ -37,8 +37,8 @@ type Config struct {
|
||||||
|
|
||||||
func Parse(data []byte) (*Config, error) {
|
func Parse(data []byte) (*Config, error) {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
StartBlockNum: NULL_BLOCK_NUMBER,
|
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
EndBlockNum: NULL_BLOCK_NUMBER,
|
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
MaxMessagesInFlight: 10,
|
MaxMessagesInFlight: 10,
|
||||||
IrreversibleOnly: false,
|
IrreversibleOnly: false,
|
||||||
Redis: RedisConfig{
|
Redis: RedisConfig{
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
shipclient "github.com/eosswedenorg-go/antelope-ship-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParse_Default(t *testing.T) {
|
func TestParse_Default(t *testing.T) {
|
||||||
expected := Config{
|
expected := Config{
|
||||||
StartBlockNum: NULL_BLOCK_NUMBER,
|
StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
EndBlockNum: NULL_BLOCK_NUMBER,
|
EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
|
||||||
MaxMessagesInFlight: 10,
|
MaxMessagesInFlight: 10,
|
||||||
IrreversibleOnly: false,
|
IrreversibleOnly: false,
|
||||||
Redis: RedisConfig{
|
Redis: RedisConfig{
|
||||||
|
|
|
||||||
2
main.go
2
main.go
|
|
@ -205,7 +205,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.StartBlockNum == config.NULL_BLOCK_NUMBER {
|
if conf.StartBlockNum == shipclient.NULL_BLOCK_NUMBER {
|
||||||
if conf.IrreversibleOnly {
|
if conf.IrreversibleOnly {
|
||||||
conf.StartBlockNum = uint32(chainInfo.LastIrreversibleBlockNum)
|
conf.StartBlockNum = uint32(chainInfo.LastIrreversibleBlockNum)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue