Skip to content

Commit

Permalink
Format CPP
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Oct 18, 2023
1 parent cc88c45 commit 508846e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
17 changes: 11 additions & 6 deletions src/dfi/consensus/accounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,21 @@ Res CAccountsConsensus::operator()(const CAccountToAccountMessage &obj) const {
return res;
}

if (txn == 999)
if (txn == 999) {
std::cout << "CAccountToAccountMessage: from: " << obj.from.GetHex() << std::endl;
for (const auto& [dest, balance] : obj.to) {
if (txn == 999)
std::cout << "CAccountToAccountMessage: to: " << dest.GetHex() << " amounts: " << balance.ToString() << std::endl;
}
for (const auto &[dest, balance] : obj.to) {
if (txn == 999) {
std::cout << "CAccountToAccountMessage: to: " << dest.GetHex() << " amounts: " << balance.ToString()
<< std::endl;
}
}

// transfer
if (auto res = SubBalanceDelShares(obj.from, SumAllTransfers(obj.to)); !res) {
if (txn == 999)
if (txn == 999) {
std::cout << "CAccountToAccountMessage: SubBalanceDelShares failure" << std::endl;
}
return res;
}

Expand All @@ -92,8 +96,9 @@ Res CAccountsConsensus::operator()(const CAccountToAccountMessage &obj) const {
std::cout << "CAccountToAccountMessage: AddBalancesSetShares failure" << std::endl;
}

if (txn == 999)
if (txn == 999) {
std::cout << "CAccountToAccountMessage: success" << std::endl;
}

return res;
}
Expand Down
12 changes: 8 additions & 4 deletions src/dfi/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@ Res ApplyCustomTx(CCustomCSView &mnview, BlockContext &blockCtx, const Transacti
const auto metadataValidation = height >= static_cast<uint32_t>(consensus.DF11FortCanningHeight);
const auto txType = GuessCustomTxType(tx, metadata, metadataValidation);

if (txn == 999)
if (txn == 999) {
std::cout << "ApplyCustomTx TxType: " << ToString(txType) << std::endl;
}

auto attributes = mnview.GetAttributes();
assert(attributes);
Expand Down Expand Up @@ -561,17 +562,19 @@ Res ApplyCustomTx(CCustomCSView &mnview, BlockContext &blockCtx, const Transacti
auto txMessage = customTypeToMessage(txType);
CAccountsHistoryWriter view(mnview, height, txn, tx.GetHash(), uint8_t(txType));
if ((res = CustomMetadataParse(height, consensus, metadata, txMessage))) {
if (txn == 999)
if (txn == 999) {
std::cout << "ApplyCustomTx: CustomMetadataParse success" << std::endl;
}
if (mnview.GetHistoryWriters().GetVaultView()) {
PopulateVaultHistoryData(mnview.GetHistoryWriters(), view, txMessage, txType, txCtx);
}

res = CustomTxVisit(view, txMessage, blockCtx, txCtx);

if (res) {
if (txn == 999)
if (txn == 999) {
std::cout << "ApplyCustomTx: CustomTxVisit success" << std::endl;
}
if (canSpend && txType == CustomTxType::UpdateMasternode) {
auto obj = std::get<CUpdateMasterNodeMessage>(txMessage);
for (const auto &item : obj.updates) {
Expand Down Expand Up @@ -610,8 +613,9 @@ Res ApplyCustomTx(CCustomCSView &mnview, BlockContext &blockCtx, const Transacti
}
// list of transactions which aren't allowed to fail:
if (!res) {
if (txn == 999)
if (txn == 999) {
std::cout << "ApplyCustomTx: " << res.msg << std::endl;
}
res.msg = strprintf("%sTx: %s", ToString(txType), res.msg);

if (IsBelowDakotaMintTokenOrAccountToUtxos(txType, height)) {
Expand Down

0 comments on commit 508846e

Please sign in to comment.