*: Reformat code
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
a2c2791146
commit
2e54d10bc3
2 changed files with 20 additions and 11 deletions
|
@ -41,8 +41,8 @@ const (
|
||||||
// prefixRecord contains map from (token key + hash160(token name) + record type)
|
// prefixRecord contains map from (token key + hash160(token name) + record type)
|
||||||
// to record.
|
// to record.
|
||||||
prefixRecord byte = 0x22
|
prefixRecord byte = 0x22
|
||||||
//prefixGlobalDomain contains a flag indicating that this domain was created using GlobalDomain.
|
// prefixGlobalDomain contains a flag indicating that this domain was created using GlobalDomain.
|
||||||
//This is necessary to distinguish it from regular CNAME records.
|
// This is necessary to distinguish it from regular CNAME records.
|
||||||
prefixGlobalDomain byte = 0x23
|
prefixGlobalDomain byte = 0x23
|
||||||
// prefixCountSubDomains contains information about the number of domains in the zone.
|
// prefixCountSubDomains contains information about the number of domains in the zone.
|
||||||
// If it is nil, it will definitely be calculated on the first removal.
|
// If it is nil, it will definitely be calculated on the first removal.
|
||||||
|
@ -79,7 +79,7 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Cnametgt is a special TXT record ensuring all created subdomains point to the global domain - the value of this variable.
|
// Cnametgt is a special TXT record ensuring all created subdomains point to the global domain - the value of this variable.
|
||||||
//It is guaranteed that two domains cannot point to the same global domain.
|
// It is guaranteed that two domains cannot point to the same global domain.
|
||||||
Cnametgt = "cnametgt"
|
Cnametgt = "cnametgt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -177,8 +177,10 @@ func TestNNSRegister(t *testing.T) {
|
||||||
|
|
||||||
cAcc := c.WithSigners(acc)
|
cAcc := c.WithSigners(acc)
|
||||||
|
|
||||||
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")),
|
expected = stackitem.NewArray([]stackitem.Item{
|
||||||
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))})
|
stackitem.NewByteArray([]byte("testdomain.com")),
|
||||||
|
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))),
|
||||||
|
})
|
||||||
tx = cAcc.Invoke(t, stackitem.Null{}, "addRecord",
|
tx = cAcc.Invoke(t, stackitem.Null{}, "addRecord",
|
||||||
"testdomain.com", int64(nns.TXT), "first TXT record")
|
"testdomain.com", int64(nns.TXT), "first TXT record")
|
||||||
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected})
|
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected})
|
||||||
|
@ -194,8 +196,10 @@ func TestNNSRegister(t *testing.T) {
|
||||||
})
|
})
|
||||||
c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT))
|
c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT))
|
||||||
|
|
||||||
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")),
|
expected = stackitem.NewArray([]stackitem.Item{
|
||||||
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))})
|
stackitem.NewByteArray([]byte("testdomain.com")),
|
||||||
|
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))),
|
||||||
|
})
|
||||||
tx = cAcc.Invoke(t, stackitem.Null{}, "setRecord",
|
tx = cAcc.Invoke(t, stackitem.Null{}, "setRecord",
|
||||||
"testdomain.com", int64(nns.TXT), int64(0), "replaced first")
|
"testdomain.com", int64(nns.TXT), int64(0), "replaced first")
|
||||||
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected})
|
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected})
|
||||||
|
@ -207,8 +211,10 @@ func TestNNSRegister(t *testing.T) {
|
||||||
c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT))
|
c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT))
|
||||||
|
|
||||||
tx = cAcc.Invoke(t, stackitem.Null{}, "deleteRecords", "testdomain.com", int64(nns.TXT))
|
tx = cAcc.Invoke(t, stackitem.Null{}, "deleteRecords", "testdomain.com", int64(nns.TXT))
|
||||||
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")),
|
expected = stackitem.NewArray([]stackitem.Item{
|
||||||
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))})
|
stackitem.NewByteArray([]byte("testdomain.com")),
|
||||||
|
stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))),
|
||||||
|
})
|
||||||
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected})
|
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected})
|
||||||
|
|
||||||
c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT))
|
c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT))
|
||||||
|
@ -255,8 +261,10 @@ func TestNNSRegister(t *testing.T) {
|
||||||
c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT))
|
c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT))
|
||||||
|
|
||||||
tx = cAcc.Invoke(t, stackitem.Null{}, "deleteDomain", "testdomain.com")
|
tx = cAcc.Invoke(t, stackitem.Null{}, "deleteDomain", "testdomain.com")
|
||||||
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")),
|
expected = stackitem.NewArray([]stackitem.Item{
|
||||||
stackitem.NewBigInteger(big.NewInt(int64(nns.CNAME)))})
|
stackitem.NewByteArray([]byte("testdomain.com")),
|
||||||
|
stackitem.NewBigInteger(big.NewInt(int64(nns.CNAME))),
|
||||||
|
})
|
||||||
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected})
|
c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected})
|
||||||
|
|
||||||
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com"))})
|
expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com"))})
|
||||||
|
@ -371,6 +379,7 @@ func TestGlobalDomain(t *testing.T) {
|
||||||
|
|
||||||
c.InvokeFail(t, "global domain is already taken", "isAvailable", "dom.testdomain.com")
|
c.InvokeFail(t, "global domain is already taken", "isAvailable", "dom.testdomain.com")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTLDRecord(t *testing.T) {
|
func TestTLDRecord(t *testing.T) {
|
||||||
c := newNNSInvoker(t, true)
|
c := newNNSInvoker(t, true)
|
||||||
c.Invoke(t, stackitem.Null{}, "addRecord",
|
c.Invoke(t, stackitem.Null{}, "addRecord",
|
||||||
|
|
Loading…
Reference in a new issue