@@ -115,39 +115,40 @@ 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);
124
+ const auto fundingStreams = consensus.GetActiveFundingStreams (nHeight);
126
125
127
126
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 {
127
+ for (const auto & [fsinfo, fs] : fundingStreams) {
128
+ const auto amount = fsinfo.Value (block_subsidy);
129
+ miner_reward -= amount;
130
+
131
+ examine (fs.Recipient (consensus, nHeight), match {
131
132
[&](const libzcash::SaplingPaymentAddress& pa) {
132
- LogPrint (" pow" , " %s: Adding Sapling funding stream output of value %d" , __func__, fselem. second );
133
+ LogPrint (" pow" , " %s: Adding Sapling funding stream output of value %d" , __func__, amount );
133
134
saplingBuilder.add_recipient (
134
135
{},
135
136
pa.GetRawBytes (),
136
- fselem. second ,
137
+ amount ,
137
138
libzcash::Memo::ToBytes (std::nullopt));
138
139
},
139
140
[&](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);
141
+ LogPrint (" pow" , " %s: Adding transparent funding stream output of value %d" , __func__, amount );
142
+ mtx.vout .emplace_back (amount , scriptPubKey);
142
143
},
143
144
[&](const Consensus::Lockbox& lockbox) {
144
- LogPrint (" pow" , " %s: Noting lockbox output of value %d" , __func__, fselem. second );
145
+ LogPrint (" pow" , " %s: Noting lockbox output of value %d" , __func__, amount );
145
146
}
146
147
});
147
148
}
148
149
} else if (nHeight <= chainparams.GetConsensus ().GetLastFoundersRewardBlockHeight (nHeight)) {
149
150
// Founders reward is 20% of the block subsidy
150
- auto vFoundersReward = miner_reward / 5 ;
151
+ const auto vFoundersReward = miner_reward / 5 ;
151
152
// Take some reward away from us
152
153
miner_reward -= vFoundersReward;
153
154
// And give it to the founders
0 commit comments