Skip to content

Commit

Permalink
consensus: Simplify V2FileContractTax
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Dec 2, 2024
1 parent 2cae9aa commit d35aec5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,7 @@ func (s State) FileContractTax(fc types.FileContract) types.Currency {

// V2FileContractTax computes the tax levied on a given v2 contract.
func (s State) V2FileContractTax(fc types.V2FileContract) types.Currency {
sum := fc.RenterOutput.Value.Add(fc.HostOutput.Value)
tax := sum.Div64(25) // 4%
// round down to nearest multiple of SiafundCount
_, r := bits.Div64(0, tax.Hi, s.SiafundCount())
_, r = bits.Div64(r, tax.Lo, s.SiafundCount())
return tax.Sub(types.NewCurrency64(r))
return fc.RenterOutput.Value.Add(fc.HostOutput.Value).Div64(25) // 4%
}

// StorageProofLeafIndex returns the leaf index used when computing or
Expand Down

0 comments on commit d35aec5

Please sign in to comment.