Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master - community balances in account change #1235

Merged
merged 1 commit into from
May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2049,10 +2049,12 @@ Res ApplyGeneralCoinbaseTx(CCustomCSView & mnview, CTransaction const & tx, int
if ((height < consensus.FortCanningHeight && kv.first == CommunityAccountType::Loan) ||
kv.first == CommunityAccountType::Options)
{
LogPrint(BCLog::ACCOUNTCHANGE, "AccountChange: txid=%s community=%s change=%s\n", tx.GetHash().ToString(), GetCommunityAccountName(CommunityAccountType::Unallocated), (CBalances{{{{0}, subsidy}}}.ToString()));
res = mnview.AddCommunityBalance(CommunityAccountType::Unallocated, subsidy);
}
else
{
LogPrint(BCLog::ACCOUNTCHANGE, "AccountChange: txid=%s community=%s change=%s\n", tx.GetHash().ToString(), GetCommunityAccountName(kv.first), (CBalances{{{{0}, subsidy}}}.ToString()));
res = mnview.AddCommunityBalance(kv.first, subsidy);
}

Expand All @@ -2068,6 +2070,7 @@ Res ApplyGeneralCoinbaseTx(CCustomCSView & mnview, CTransaction const & tx, int
{
for (const auto& kv : consensus.nonUtxoBlockSubsidies) {
CAmount subsidy = blockReward * kv.second / COIN;
LogPrint(BCLog::ACCOUNTCHANGE, "AccountChange: txid=%s community=%s change=%s\n", tx.GetHash().ToString(), GetCommunityAccountName(kv.first), (CBalances{{{{0}, subsidy}}}.ToString()));
Res res = mnview.AddCommunityBalance(kv.first, subsidy);
if (!res.ok) {
return Res::ErrDbg("bad-cb-community-rewards", "can't take non-UTXO community share from coinbase");
Expand Down