Golang implemented sidechain for Bytom
リビジョン | 545407d960070ec2edbd95efbcb985d4b3b10cf6 (tree) |
---|---|
日時 | 2020-03-25 23:37:18 |
作者 | paladz <453256728@qq.c...> |
コミッター | paladz |
add for fix
@@ -68,6 +68,7 @@ func (e *Engine) addMatchTxFeeOutput(txData *types.TxData, fees []*bc.AssetAmoun | ||
68 | 68 | } |
69 | 69 | |
70 | 70 | refoundAmount := map[bc.AssetID]uint64{} |
71 | + assetIDs := []bc.AssetID{} | |
71 | 72 | refoundScript := [][]byte{} |
72 | 73 | for _, input := range txData.Inputs { |
73 | 74 | refoundAmount[input.AssetID()] += input.Amount() |
@@ -76,6 +77,7 @@ func (e *Engine) addMatchTxFeeOutput(txData *types.TxData, fees []*bc.AssetAmoun | ||
76 | 77 | return err |
77 | 78 | } |
78 | 79 | |
80 | + assetIDs = append(assetIDs, input.AssetID()) | |
79 | 81 | refoundScript = append(refoundScript, contractArgs.SellerProgram) |
80 | 82 | } |
81 | 83 |
@@ -85,7 +87,8 @@ func (e *Engine) addMatchTxFeeOutput(txData *types.TxData, fees []*bc.AssetAmoun | ||
85 | 87 | } |
86 | 88 | |
87 | 89 | refoundCount := len(refoundScript) |
88 | - for assetID, amount := range refoundAmount { | |
90 | + for _, assetID := range assetIDs { | |
91 | + amount := refoundAmount[assetID] | |
89 | 92 | averageAmount := amount / uint64(refoundCount) |
90 | 93 | if averageAmount == 0 { |
91 | 94 | averageAmount = 1 |