OSDN Git Service

fix no table
authorwz <mars@bytom.io>
Fri, 30 Aug 2019 01:48:54 +0000 (09:48 +0800)
committerwz <mars@bytom.io>
Fri, 30 Aug 2019 01:48:54 +0000 (09:48 +0800)
cmd/votereward/main.go
toolbar/vote_reward/synchron/block_keeper.go

index 8695737..275632d 100644 (file)
@@ -54,6 +54,8 @@ func runReward(cmd *cobra.Command, args []string) error {
                log.WithFields(log.Fields{"module": logModule, "error": err}).Fatal("Failded to initialize mysql db.")
        }
 
+       db.LogMode(true)
+
        sync, err := synchron.NewChainKeeper(db, config, rewardEndHeight)
        if err != nil {
                log.WithFields(log.Fields{"module": logModule, "error": err}).Fatal("Failded to initialize NewChainKeeper.")
index 9903480..c63242a 100644 (file)
@@ -135,7 +135,7 @@ func (c *ChainKeeper) DetachBlock(db *gorm.DB, chainStatus *orm.ChainStatus, blo
                return err
        }
 
-       if err := db.Where(&orm.Utxo{VetoHeight: block.Height}).Update("veto_height", 0).Error; err != nil {
+       if err := db.Model(&orm.Utxo{}).Where(&orm.Utxo{VetoHeight: block.Height}).Update("veto_height", 0).Error; err != nil {
                return err
        }