OSDN Git Service

fix save external asset bug. (#1218)
authormuscle_boy <shenao.78@163.com>
Fri, 3 Aug 2018 07:09:22 +0000 (15:09 +0800)
committerPaladz <yzhu101@uottawa.ca>
Fri, 3 Aug 2018 07:09:22 +0000 (15:09 +0800)
* the transaction output amout prohibit set zero

* add network access control api

* format import code style

* refactor

* code refactor

* bug fix

* the struct node_info add json field

* estimate gas support multi-sign

* add testcase of estimate gas

* add testcase

* bug fix

* add test case

* test case refactor

* list-tx,list-address,list-utxo support partition

* list-addresses list-tx list-utxo support pagging

* refactor pagging

* fix save asset

* fix save external assets

* remove blank

api/accounts.go
api/query.go
asset/asset.go

index 3d8c84a..cc01c0a 100644 (file)
@@ -98,8 +98,8 @@ func (a SortByIndex) Less(i, j int) bool { return a[i].KeyIndex < a[j].KeyIndex
 func (a *API) listAddresses(ctx context.Context, ins struct {
        AccountID    string `json:"account_id"`
        AccountAlias string `json:"account_alias"`
-       From         uint    `json:"from"`
-       Count        uint    `json:"count"`
+       From         uint   `json:"from"`
+       Count        uint   `json:"count"`
 }) Response {
        accountID := ins.AccountID
        var target *account.Account
index 2b37a1e..50889ce 100644 (file)
@@ -96,8 +96,8 @@ func (a *API) listTransactions(ctx context.Context, filter struct {
        AccountID   string `json:"account_id"`
        Detail      bool   `json:"detail"`
        Unconfirmed bool   `json:"unconfirmed"`
-       From        uint    `json:"from"`
-       Count       uint    `json:"count"`
+       From        uint   `json:"from"`
+       Count       uint   `json:"count"`
 }) Response {
        transactions := []*query.AnnotatedTx{}
        var err error
@@ -245,8 +245,8 @@ func (a *API) listUnspentOutputs(ctx context.Context, filter struct {
        ID            string `json:"id"`
        Unconfirmed   bool   `json:"unconfirmed"`
        SmartContract bool   `json:"smart_contract"`
-       From          uint    `json:"from"`
-       Count         uint    `json:"count"`
+       From          uint   `json:"from"`
+       Count         uint   `json:"count"`
 }) Response {
        accountUTXOs := a.wallet.GetAccountUtxos(filter.ID, filter.Unconfirmed, filter.SmartContract)
 
index c97a36b..491d924 100644 (file)
@@ -290,9 +290,12 @@ func (reg *Registry) GetAsset(id string) (*Asset, error) {
        }
 
        if extAsset := reg.db.Get(ExtAssetKey(&assetID)); extAsset != nil {
-               if err := json.Unmarshal(extAsset, asset); err != nil {
+               definitionMap := make(map[string]interface{})
+               if err := json.Unmarshal(extAsset, &definitionMap); err != nil {
                        return nil, err
                }
+               asset.AssetID = assetID
+               asset.DefinitionMap = definitionMap
                return asset, nil
        }