Skip to content

Commit 288369a

Browse files
committed
[#266] nns: Reuse storeRecord for storing SOA record
Less code repeating. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
1 parent 9d34e45 commit 288369a

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

nns/nns_contract.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -596,22 +596,14 @@ func storeRecord(ctx storage.Context, tokenId []byte, name string, typ RecordTyp
596596

597597
// putSoaRecord stores soa domain record.
598598
func putSoaRecord(ctx storage.Context, name, email string, refresh, retry, expire, ttl int) {
599-
var id byte
600599
tokenId := []byte(tokenIDFromName(name))
601-
recordKey := getIdRecordKey(tokenId, name, SOA, id)
602-
rs := RecordState{
603-
Name: name,
604-
Type: SOA,
605-
ID: id,
606-
Data: name + " " + email + " " +
607-
std.Itoa(runtime.GetTime(), 10) + " " +
608-
std.Itoa(refresh, 10) + " " +
609-
std.Itoa(retry, 10) + " " +
610-
std.Itoa(expire, 10) + " " +
611-
std.Itoa(ttl, 10),
612-
}
613-
recBytes := std.Serialize(rs)
614-
storage.Put(ctx, recordKey, recBytes)
600+
data := name + " " + email + " " +
601+
std.Itoa(runtime.GetTime(), 10) + " " +
602+
std.Itoa(refresh, 10) + " " +
603+
std.Itoa(retry, 10) + " " +
604+
std.Itoa(expire, 10) + " " +
605+
std.Itoa(ttl, 10)
606+
storeRecord(ctx, tokenId, name, SOA, 0, data)
615607
}
616608

617609
// updateSoaSerial stores soa domain record.

0 commit comments

Comments
 (0)