Skip to content

Commit ae4e03f

Browse files
committed
Fix Songbird and Coston bootstrap issues
1 parent 6eb13c2 commit ae4e03f

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

avalanchego/network/peer/peer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ func (p *peer) writeMessages() {
541541

542542
myVersion := p.VersionCompatibility.Version()
543543
legacyApplication := &version.Application{
544-
Name: version.LegacyAppName,
544+
Name: version.GetApplicationPrefix(),
545545
Major: myVersion.Major,
546546
Minor: myVersion.Minor,
547547
Patch: myVersion.Patch,

avalanchego/version/application.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"sync"
1010
)
1111

12-
const LegacyAppName = "avalanche"
13-
1412
var (
1513
errDifferentMajor = errors.New("different major version")
1614

avalanchego/version/application_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestNewDefaultApplication(t *testing.T) {
1414
require := require.New(t)
1515

1616
v := &Application{
17-
Name: LegacyAppName,
17+
Name: GetApplicationPrefix(),
1818
Major: 1,
1919
Minor: 2,
2020
Patch: 3,

avalanchego/version/compatibility_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestCompatibility(t *testing.T) {
4747
}{
4848
{
4949
peer: &Application{
50-
Name: LegacyAppName,
50+
Name: GetApplicationPrefix(),
5151
Major: 1,
5252
Minor: 5,
5353
Patch: 0,

avalanchego/version/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Parse(s string) (*Semantic, error) {
3636

3737
// TODO: Remove after v1.11.x is activated
3838
func ParseLegacyApplication(s string) (*Application, error) {
39-
prefix := LegacyAppName + "/"
39+
prefix := GetApplicationPrefix() + "/"
4040
if !strings.HasPrefix(s, prefix) {
4141
return nil, fmt.Errorf("%w: %q", errMissingApplicationPrefix, s)
4242
}

avalanchego/vms/platformvm/txs/executor/staker_tx_verification_helpers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ func GetNextStakerChangeTime(state state.Chain) (time.Time, error) {
115115
case hasPendingStaker:
116116
return pendingStakerIterator.Value().NextTime, nil
117117
default:
118+
// Due to no initial stakers in genesis for Songbird networks
119+
if state.GetNetworkID() == constants.SongbirdID || state.GetNetworkID() == constants.CostonID || state.GetNetworkID() == constants.LocalID {
120+
return songbirdLatestStakingTime, nil
121+
}
118122
return time.Time{}, database.ErrNotFound
119123
}
120124
}

avalanchego/vms/proposervm/vm.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,12 @@ func (vm *VM) getForkHeight() (uint64, error) {
760760
switch vm.ctx.NetworkID {
761761
case constants.MainnetID:
762762
return 805732, nil // https://subnets.avax.network/p-chain/block/805732
763-
default:
764-
return 1, nil // Flare and Songbird started after Apricot Phase 4
763+
case constants.SongbirdID:
764+
return 9, nil
765+
case constants.CostonID:
766+
return 6, nil
767+
case constants.FlareID, constants.CostwoID:
768+
return 1, nil
765769
}
766770
case mainnetXChainID:
767771
return 1, nil // https://subnets.avax.network/x-chain/block/1

0 commit comments

Comments
 (0)