OSDN Git Service

Hulk did something
[bytom/vapor.git] / account / utxo_keeper.go
index e9e486f..2e169cf 100644 (file)
@@ -9,8 +9,8 @@ import (
        "time"
 
        log "github.com/sirupsen/logrus"
-       dbm "github.com/tendermint/tmlibs/db"
 
+       dbm "github.com/vapor/database/leveldb"
        "github.com/vapor/errors"
        "github.com/vapor/protocol/bc"
 )
@@ -184,10 +184,13 @@ func (uk *utxoKeeper) cancel(rid uint64) {
 
 func (uk *utxoKeeper) expireWorker() {
        ticker := time.NewTicker(1000 * time.Millisecond)
+       defer ticker.Stop()
+
        for now := range ticker.C {
                uk.expireReservation(now)
        }
 }
+
 func (uk *utxoKeeper) expireReservation(t time.Time) {
        uk.mtx.Lock()
        defer uk.mtx.Unlock()
@@ -219,7 +222,7 @@ func (uk *utxoKeeper) findUtxos(accountID string, assetID *bc.AssetID, useUnconf
        for utxoIter.Next() {
                u := &UTXO{}
                if err := json.Unmarshal(utxoIter.Value(), u); err != nil {
-                       log.WithField("err", err).Error("utxoKeeper findUtxos fail on unmarshal utxo")
+                       log.WithFields(log.Fields{"module": logModule, "err": err}).Error("utxoKeeper findUtxos fail on unmarshal utxo")
                        continue
                }
                appendUtxo(u)