@@ -115,39 +115,38 @@ class AddOutputsToCoinbaseTxAndSign
115
115
}
116
116
117
117
CAmount SetFoundersRewardAndGetMinerValue (sapling::Builder& saplingBuilder) const {
118
- auto block_subsidy = chainparams.GetConsensus ().GetBlockSubsidy (nHeight);
118
+ const auto & consensus = chainparams.GetConsensus ();
119
+ const auto block_subsidy = consensus.GetBlockSubsidy (nHeight);
119
120
auto miner_reward = block_subsidy; // founders' reward or funding stream amounts will be subtracted below
120
121
121
122
if (nHeight > 0 ) {
122
123
if (chainparams.GetConsensus ().NetworkUpgradeActive (nHeight, Consensus::UPGRADE_CANOPY)) {
123
- auto fundingStreamElements = chainparams.GetConsensus ().GetActiveFundingStreamElements (
124
- nHeight,
125
- block_subsidy);
126
-
127
124
LogPrint (" pow" , " %s: Constructing funding stream outputs for height %d" , __func__, nHeight);
128
- for (Consensus::FundingStreamElement fselem : fundingStreamElements) {
129
- miner_reward -= fselem.second ;
130
- examine (fselem.first , match {
125
+ for (const auto & [fsinfo, fs] : consensus.GetActiveFundingStreams (nHeight)) {
126
+ const auto amount = fsinfo.Value (block_subsidy);
127
+ miner_reward -= amount;
128
+
129
+ examine (fs.Recipient (consensus, nHeight), match {
131
130
[&](const libzcash::SaplingPaymentAddress& pa) {
132
- LogPrint (" pow" , " %s: Adding Sapling funding stream output of value %d" , __func__, fselem. second );
131
+ LogPrint (" pow" , " %s: Adding Sapling funding stream output of value %d" , __func__, amount );
133
132
saplingBuilder.add_recipient (
134
133
{},
135
134
pa.GetRawBytes (),
136
- fselem. second ,
135
+ amount ,
137
136
libzcash::Memo::ToBytes (std::nullopt));
138
137
},
139
138
[&](const CScript& scriptPubKey) {
140
- LogPrint (" pow" , " %s: Adding transparent funding stream output of value %d" , __func__, fselem. second );
141
- mtx.vout .emplace_back (fselem. second , scriptPubKey);
139
+ LogPrint (" pow" , " %s: Adding transparent funding stream output of value %d" , __func__, amount );
140
+ mtx.vout .emplace_back (amount , scriptPubKey);
142
141
},
143
142
[&](const Consensus::Lockbox& lockbox) {
144
- LogPrint (" pow" , " %s: Noting lockbox output of value %d" , __func__, fselem. second );
143
+ LogPrint (" pow" , " %s: Noting lockbox output of value %d" , __func__, amount );
145
144
}
146
145
});
147
146
}
148
147
} else if (nHeight <= chainparams.GetConsensus ().GetLastFoundersRewardBlockHeight (nHeight)) {
149
148
// Founders reward is 20% of the block subsidy
150
- auto vFoundersReward = miner_reward / 5 ;
149
+ const auto vFoundersReward = miner_reward / 5 ;
151
150
// Take some reward away from us
152
151
miner_reward -= vFoundersReward;
153
152
// And give it to the founders
0 commit comments