Replace incorrectly named comment with func #15979

pull Bushstar wants to merge 1 commits into bitcoin:master from Bushstar:replace-with-func changing 1 files +1 −1
  1. Bushstar commented at 7:28 AM on May 8, 2019: contributor

    This code was previously part of ConnectBlock() hence the log string, at some point it was moved to WriteUndoDataForBlock(). It seems sensible to me to use the magic constant func.

    I'd also like to update several other places where func has been used intermittently. It's helpful to make logging code more dynamic, but also remove logging code from grep results when searching on function name. I was actually grepping ConnectBlock() and saw this misplaced result, ConnectBlock() itself has several logging lines that both use and do not use func, it's somewhat piecemeal.

    I'm not entirely sure whether use of func falls under the category of style but the change in this pull request changes a incorrectly labelled log entry.

  2. Replace incorrectly named comment with func ad3677477a
  3. fanquake added the label Validation on May 8, 2019
  4. practicalswift commented at 7:39 AM on May 8, 2019: contributor

    utACK ad3677477aadf5813bbe685333c757e8a4fbd493

    FWIW, these could be candidates for the same __func__ treatment:

    $ git grep 'LogPrint.*("[A-Z][A-Za-z:]*: ' -- "*.cpp" "*.h" | egrep -v '"(WARNING|Warning|HTTP|Error|Prune|UPnP|GUI|LOCKCONTENTION|Locker|ERROR|Keys): '
    src/netbase.cpp:        LogPrintf("ConnectSocketDirectly: Setting socket to non-blocking failed, error %s\n", NetworkErrorString(WSAGetLastError()));
    src/txmempool.cpp:    LogPrintf("PrioritiseTransaction: %s feerate += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
    src/validation.cpp:            LogPrintf("RewindBlockIndex: unable to flush state to disk (%s)\n", FormatStateMessage(state));
    src/validation.cpp:            LogPrintf("RewindBlockIndex: unable to flush state to disk (%s)\n", FormatStateMessage(state));
    src/wallet/db.cpp:        LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret));
    src/wallet/db.cpp:    LogPrintf("BerkeleyEnvironment::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
    src/wallet/db.cpp:        LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret));
    src/wallet/db.cpp:            LogPrintf("BerkeleyEnvironment::Open: Error %d closing failed database environment: %s\n", ret2, DbEnv::strerror(ret2));
    src/wallet/db.cpp:        LogPrintf("BerkeleyEnvironment::Salvage: Database salvage found errors, all data may not be recoverable.\n");
    src/wallet/db.cpp:            LogPrintf("BerkeleyEnvironment::Salvage: Rerun with aggressive mode to ignore errors and continue.\n");
    src/wallet/db.cpp:        LogPrintf("BerkeleyEnvironment::Salvage: Database salvage failed with result %d.\n", result);
    src/wallet/db.cpp:                LogPrintf("BerkeleyEnvironment::Salvage: WARNING: Number of keys in data does not match number of values.\n");
    src/wallet/db.cpp:        LogPrintf("BerkeleyEnvironment::Salvage: WARNING: Unexpected end of file while reading salvage output.\n");
    src/wallet/db.cpp:                LogPrintf("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
    src/wallet/db.cpp:                        LogPrintf("BerkeleyBatch::Rewrite: Can't create database file %s\n", strFileRes);
    src/wallet/db.cpp:                    LogPrintf("BerkeleyBatch::Rewrite: Failed to rewrite database file %s\n", strFileRes);
    src/wallet/wallet.cpp:            pwallet->WalletLogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n"
    
  5. Bushstar commented at 8:47 AM on May 8, 2019: contributor

    @practicalswift I agree. There are also cases that apply without LogPrint when error() is returned with a log message. I'll work through the ones you listed above and any additional ones related to error and create a new pull request including the change here. I expect changing all these entries will generate a few pull request conflicts.

  6. fanquake removed the label Validation on May 8, 2019
  7. fanquake added the label Refactoring on May 8, 2019
  8. fanquake commented at 12:20 PM on May 8, 2019: member

    Going to close this in favour of #15981. If these are going to be changed, might as well do them all at once.

  9. fanquake closed this on May 8, 2019

  10. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me