• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision79a36839421a3a5ace7162470f503a701e965813 (tree)
Time2019-06-20 17:40:49
Authormars <mars@byto...>
Commitermars

Log Message

fix review

Change Summary

Incremental Difference

--- a/blockchain/txbuilder/finalize.go
+++ b/blockchain/txbuilder/finalize.go
@@ -153,15 +153,14 @@ func CalculateTxFee(tx *types.Tx) (fee uint64) {
153153 }
154154
155155 func checkGasInputIDs(tx *types.Tx) error {
156- crossChainInputNum := 0
157156 for _, inp := range tx.Inputs {
158157 switch inp.InputType() {
159158 case types.CrossChainInputType:
160- crossChainInputNum++
159+ return nil
161160 }
162161 }
163162
164- if crossChainInputNum != len(tx.Inputs) && len(tx.GasInputIDs) == 0 {
163+ if len(tx.GasInputIDs) == 0 {
165164 return ErrNoGasInput
166165 }
167166 return nil
--- a/protocol/txpool.go
+++ b/protocol/txpool.go
@@ -193,19 +193,16 @@ func (tp *TxPool) HaveTransaction(txHash *bc.Hash) bool {
193193 }
194194
195195 func isTransactionNoBtmInput(tx *types.Tx) bool {
196- crossChainInputNum := 0
197196 for _, input := range tx.TxData.Inputs {
198- if input.AssetID() == *consensus.BTMAssetID {
199- return false
200- }
201197 switch input.InputType() {
202198 case types.CrossChainInputType:
203- crossChainInputNum++
199+ return false
200+ }
201+ if input.AssetID() == *consensus.BTMAssetID {
202+ return false
204203 }
205204 }
206- if crossChainInputNum == len(tx.TxData.Inputs) {
207- return false
208- }
205+
209206 return true
210207 }
211208
Show on old repository browser