为什么app.sdb.load('Account',senderId)`返回一个对象?

时间:2018-08-06 15:54:49

标签: asch-development asch

在我将app.sdb.load('Account', senderId)设置为有效地址的情况下调用senderId时,结果是(意外)一个包含帐户信息的对象,如下所示:

{  
   "address":"AEc252iX7f75DzEYybe5EtfjwX8GEBsdxB",
   "name":null,
   "xas":100000000000,
   "publicKey":null,
   "secondPublicKey":null,
   "isLocked":0,
   "isAgent":0,
   "isDelegate":0,
   "role":0,
   "lockHeight":0,
   "agent":null,
   "weight":0,
   "agentWeight":0,
   "_version_":1
}

根据https://github.com/AschPlatform/asch-docs/blob/master/sdk_api/en.md#11-aync-appsdbloadmodel-fields-indices上的文档:

The operation has no return value, it throws an Exception when an error occurs Load the data for the specified model into memory and index the table which can further improve the efficiency of the query When a data model needs frequent updates and inquiries, it is recommended to use this interface, such as the system's built-in account balance, the increment ID uses this operation

从1.4版开始,它发生了变化吗?

1 个答案:

答案 0 :(得分:1)

只有在Accounts区块链数据库表中创建了地址条目,对{{1}}的函数调用才能找到地址。

如果将XAS发送到此特定地址,则会创建一个条目。因为可能有数亿个可能的地址,所以我们不希望它们从一开始就在区块链数据库中。那只会使数据库the肿,并且没有实际用途。