P2Pool miner version changes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2023-09-13 14:33:05 +02:00
parent 93b7fa6a49
commit 3c4e0016b8
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
2 changed files with 14 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import (
"git.gammaspectra.live/P2Pool/p2pool-observer/p2pool/sidechain"
types2 "git.gammaspectra.live/P2Pool/p2pool-observer/p2pool/types"
"git.gammaspectra.live/P2Pool/p2pool-observer/types"
"strings"
"time"
)
@ -30,6 +31,17 @@ type VersionInfo struct {
CheckedTimestamp int64 `json:"-"`
}
func (v VersionInfo) ShortVersion() types2.SemanticVersion {
parts := strings.Split(v.Version, ".")
for len(parts) < 2 {
parts = append(parts, "0")
}
for len(parts) > 2 {
parts = parts[:len(parts)-1]
}
return types2.SemanticVersionFromString(strings.Join(parts, "."))
}
type ReleaseDataJson struct {
TagName string `json:"tag_name"`
TargetCommitish string `json:"target_commitish"`

View file

@ -108,7 +108,7 @@ type MinerPage struct {
</div>
<hr/>
{% elseif p.LastPoolBlock != nil && p.LastPoolBlock.ShareVersion() > sidechain.ShareVersion_V1 && p.LastPoolBlock.Side.ExtraBuffer.SoftwareId == p2pooltypes.SoftwareIdP2Pool && p.LastPoolBlock.Side.ExtraBuffer.SoftwareVersion.String() != p.Context().Pool.Versions.P2Pool.Version %}
{% elseif p.LastPoolBlock != nil && p.LastPoolBlock.ShareVersion() > sidechain.ShareVersion_V1 && p.LastPoolBlock.Side.ExtraBuffer.SoftwareId == p2pooltypes.SoftwareIdP2Pool && p.LastPoolBlock.Side.ExtraBuffer.SoftwareVersion.String() != p.Context().Pool.Versions.P2Pool.ShortVersion().String() %}
<div style="border: #d1d1d1 1px dashed;">
<h3 style="color:#FF4433">Recent shares indicate you are running an older version of P2Pool</h3>
@ -295,4 +295,4 @@ type MinerPage struct {
</form>
</div>
{% endif %}
{% endfunc %}
{% endfunc %}