|
5 | 5 | package insight |
6 | 6 |
|
7 | 7 | import ( |
8 | | - "github.com/decred/dcrd/blockchain" |
| 8 | + "github.com/decred/dcrd/blockchain/standalone" |
9 | 9 | "github.com/decred/dcrd/dcrutil/v2" |
10 | 10 | chainjson "github.com/decred/dcrd/rpc/jsonrpc/types" |
11 | 11 | apitypes "github.com/decred/dcrdata/api/types/v4" |
@@ -146,12 +146,11 @@ func (iapi *InsightApi) DcrToInsightTxns(txs []*chainjson.TxRawResult, noAsm, no |
146 | 146 |
|
147 | 147 | // DcrToInsightBlock converts a chainjson.GetBlockVerboseResult to Insight block. |
148 | 148 | func (iapi *InsightApi) DcrToInsightBlock(inBlocks []*chainjson.GetBlockVerboseResult) ([]*apitypes.InsightBlockResult, error) { |
149 | | - params := txhelpers.ParamsV2ToV1(iapi.params) |
150 | 149 | RewardAtBlock := func(blocknum int64, voters uint16) float64 { |
151 | | - subsidyCache := blockchain.NewSubsidyCache(0, params) |
152 | | - work := blockchain.CalcBlockWorkSubsidy(subsidyCache, blocknum, voters, params) |
153 | | - stake := blockchain.CalcStakeVoteSubsidy(subsidyCache, blocknum, params) * int64(voters) |
154 | | - tax := blockchain.CalcBlockTaxSubsidy(subsidyCache, blocknum, voters, params) |
| 150 | + subsidyCache := standalone.NewSubsidyCache(iapi.params) |
| 151 | + work := subsidyCache.CalcWorkSubsidy(blocknum, voters) |
| 152 | + stake := subsidyCache.CalcStakeVoteSubsidy(blocknum) * int64(voters) |
| 153 | + tax := subsidyCache.CalcTreasurySubsidy(blocknum, voters) |
155 | 154 | return dcrutil.Amount(work + stake + tax).ToCoin() |
156 | 155 | } |
157 | 156 |
|
|
0 commit comments