OSDN Git Service

opt
authorHAOYUatHZ <haoyu@protonmail.com>
Tue, 18 Jun 2019 09:11:30 +0000 (17:11 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Tue, 18 Jun 2019 09:11:30 +0000 (17:11 +0800)
federation/synchron/sidechain_keeper.go

index 214c95c..8179b82 100644 (file)
@@ -210,13 +210,8 @@ func (s *sidechainKeeper) processWithdrawalTx(chain *orm.Chain, block *types.Blo
                return err
        }
 
-       for _, output := range crossChainOutputs {
-               if err := s.db.Create(output).Error; err != nil {
-                       return errors.Wrap(err, fmt.Sprintf("create WithdrawalFromSidechain output: txid(%s), pos(%d)", tx.ID.String(), output.SourcePos))
-               }
-       }
-
-       return nil
+       // batch insert
+       return s.db.Create(crossChainOutputs).Error
 }
 
 func (s *sidechainKeeper) getCrossChainReqs(crossTransactionID uint64, tx *types.Tx, statusFail bool) ([]*orm.CrossTransactionReq, error) {