dev-api-aliases-v2 #6
@ -346,17 +346,13 @@ func (das *DevAccountService) saveAlias(ctx context.Context, alias map[string]st
|
|||||||
if das.db == nil {
|
if das.db == nil {
|
||||||
return fmt.Errorf("Db cannot be nil")
|
return fmt.Errorf("Db cannot be nil")
|
||||||
}
|
}
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unresolved session id")
|
|
||||||
}
|
|
||||||
for k, v := range alias {
|
for k, v := range alias {
|
||||||
k_ := das.prefixKeyFor("alias", k)
|
k_ := das.prefixKeyFor("alias", k)
|
||||||
v_, err := json.Marshal(v)
|
v_, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
das.db.SetSession(sessionId)
|
das.db.SetSession("")
|
||||||
lash marked this conversation as resolved
|
|||||||
das.db.SetPrefix(db.DATATYPE_USERDATA)
|
das.db.SetPrefix(db.DATATYPE_USERDATA)
|
||||||
return das.db.Put(ctx, []byte(k_), v_)
|
return das.db.Put(ctx, []byte(k_), v_)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
Please explain this change?
When the alias is saved,it will need to be retrieved by any other session id during Send.So when resolving the alias address,we don't really yet know the exact session id the alias belongs to beforehand.It made sense to me to keep this as an independent record that would be resolved in a similar way that we check if a certain public key is in the list of created accounts.