mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
feat(sync)!: remove compatibility with v2.29
This commit is contained in:
parent
970119af78
commit
31538e7665
@ -62,10 +62,6 @@ func NewConnectionParams(netIPs []net.IP, port int, publicKey *ecdsa.PublicKey,
|
|||||||
// NOTE:
|
// NOTE:
|
||||||
// - append(accrete) parameters instead of changing(breaking) existing parameters. Appending should **never** break, modifying existing parameters will break. Watch this before making changes: https://www.youtube.com/watch?v=oyLBGkS5ICk
|
// - append(accrete) parameters instead of changing(breaking) existing parameters. Appending should **never** break, modifying existing parameters will break. Watch this before making changes: https://www.youtube.com/watch?v=oyLBGkS5ICk
|
||||||
// - never strictly check version, unless you really want to break
|
// - never strictly check version, unless you really want to break
|
||||||
|
|
||||||
// This flag is used to keep compatibility with 2.29. It will output a 5 parameters connection string with version 3.
|
|
||||||
var keep229Compatibility bool = true
|
|
||||||
|
|
||||||
func (cp *ConnectionParams) ToString() string {
|
func (cp *ConnectionParams) ToString() string {
|
||||||
v := base58.Encode(new(big.Int).SetInt64(int64(cp.version)).Bytes())
|
v := base58.Encode(new(big.Int).SetInt64(int64(cp.version)).Bytes())
|
||||||
ips := base58.Encode(SerializeNetIps(cp.netIPs))
|
ips := base58.Encode(SerializeNetIps(cp.netIPs))
|
||||||
@ -73,18 +69,12 @@ func (cp *ConnectionParams) ToString() string {
|
|||||||
k := base58.Encode(elliptic.MarshalCompressed(cp.publicKey.Curve, cp.publicKey.X, cp.publicKey.Y))
|
k := base58.Encode(elliptic.MarshalCompressed(cp.publicKey.Curve, cp.publicKey.X, cp.publicKey.Y))
|
||||||
ek := base58.Encode(cp.aesKey)
|
ek := base58.Encode(cp.aesKey)
|
||||||
|
|
||||||
if keep229Compatibility {
|
|
||||||
return fmt.Sprintf("%s%s:%s:%s:%s:%s", connectionStringID, v, ips, p, k, ek)
|
|
||||||
}
|
|
||||||
|
|
||||||
var i string
|
var i string
|
||||||
if cp.installationID != "" {
|
if cp.installationID != "" {
|
||||||
|
|
||||||
u, err := uuid.Parse(cp.installationID)
|
u, err := uuid.Parse(cp.installationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to parse UUID: %v", err)
|
log.Fatalf("Failed to parse UUID: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Convert UUID to byte slice
|
// Convert UUID to byte slice
|
||||||
byteSlice := u[:]
|
byteSlice := u[:]
|
||||||
i = base58.Encode(byteSlice)
|
i = base58.Encode(byteSlice)
|
||||||
@ -94,7 +84,6 @@ func (cp *ConnectionParams) ToString() string {
|
|||||||
var kuid string
|
var kuid string
|
||||||
if cp.keyUID != "" {
|
if cp.keyUID != "" {
|
||||||
kuid = base58.Encode([]byte(cp.keyUID))
|
kuid = base58.Encode([]byte(cp.keyUID))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s%s:%s:%s:%s:%s:%s:%s", connectionStringID, v, ips, p, k, ek, i, kuid)
|
return fmt.Sprintf("%s%s:%s:%s:%s:%s:%s:%s", connectionStringID, v, ips, p, k, ek, i, kuid)
|
||||||
|
@ -65,7 +65,6 @@ func (s *ConnectionParamsSuite) SetupSuite() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ConnectionParamsSuite) TestConnectionParams_ToString() {
|
func (s *ConnectionParamsSuite) TestConnectionParams_ToString() {
|
||||||
keep229Compatibility = false
|
|
||||||
cp, err := s.server.MakeConnectionParams()
|
cp, err := s.server.MakeConnectionParams()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user