OSDN Git Service

fix coinbase fee bug (#1642)
authorChengcheng Zhang <943420582@qq.com>
Tue, 19 Mar 2019 09:43:34 +0000 (17:43 +0800)
committerPaladz <yzhu101@uottawa.ca>
Tue, 19 Mar 2019 09:43:34 +0000 (17:43 +0800)
* fix coinbase fee bug

* update

* update

blockchain/txbuilder/finalize.go

index 1f777fc..f2c36af 100644 (file)
@@ -136,7 +136,10 @@ func CalculateTxFee(tx *types.Tx) (fee uint64) {
        totalOutputBTM := uint64(0)
 
        for _, input := range tx.Inputs {
-               if input.InputType() != types.CoinbaseInputType && input.AssetID() == *consensus.BTMAssetID {
+               if input.InputType() == types.CoinbaseInputType {
+                       return 0
+               }
+               if input.AssetID() == *consensus.BTMAssetID {
                        totalInputBTM += input.Amount()
                }
        }