-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate Duplicate Server appConfig and Config Structure #391
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside FromConfig
, LGTM, thanks for the contribution 🙏
cc @altafan
3f8b261
to
e3809b8
Compare
Please merge master in your branch, @bordalix should have been addressed already |
e3809b8
to
a922e41
Compare
} | ||
} | ||
|
||
if c.UnilateralExitDelay.Type == common.LocktimeTypeBlock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry guys, but I must insist on this.
If you look at code, and you pass to config a UnilateralExitDelay of 666, from func DetermineLocktimeType()
the c.UnilateralExitDelay.Type
will be common.LocktimeTypeBlock
so Validate()
will always throw here.
This means we will never be able to pass a value >= 512 to UnilateralExitDelay.
Am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no if you pass 666, it will be read as common.LocktimeTypeSecond
.
That's the expected behaviour. We don't have a flag to signal what type of lockime we want to use, so we are using the value itself:
- if
< 512
= we admit it's a "block number" locktime - if
> 512
= we admit it's a "second" locktime
) | ||
} | ||
|
||
if c.BoardingExitDelay.Type == common.LocktimeTypeBlock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, but with BoardingExitDelay
server/internal/config/config.go
Outdated
@@ -216,3 +272,343 @@ func getNetwork() (common.Network, error) { | |||
return common.Network{}, fmt.Errorf("unknown network %s", viper.GetString(Network)) | |||
} | |||
} | |||
|
|||
func DetermineLocktimeType(locktime int64) common.Locktime { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func DetermineLocktimeType(locktime int64) common.Locktime { | |
func determineLocktimeType(locktime int64) common.Locktime { |
no need to be exported, right ? cc @altafan
a922e41
to
644a654
Compare
644a654
to
4657e95
Compare
Objective
A duplicate configuration struct in the Server directory complicates coordination. By consolidating it into a single Config structure, the configuration flow becomes more streamlined and efficient.
Scope
Non-critical, as it only affects Config parsing and usage.
closes #390