Add -logtxpeer option #1376

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:LogTxPeer changing 4 files +81 −24
  1. rebroad commented at 10:56 AM on May 22, 2012: contributor

    This pull request is a subset of pull #1311. This change adds the command line option "-logtxpeer", which when chosen, will cause the peer to be reported for every transaction received, including invalid transactions.

    As this is useful only for debugging, and not needed for general use of bitcoin, the option is not displayed in the syntax output, but only found when browsing the code.

  2. Add -logtxpeer option f1861999d8
  3. in src/main.cpp:None in 4143c8d579 outdated
     640 | @@ -595,9 +641,9 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
     641 |      if (ptxOld)
     642 |          EraseFromWallets(ptxOld->GetHash());
     643 |  
     644 | -    printf("CTxMemPool::accept() : accepted %s (poolsz %u)\n",
     645 | -           hash.ToString().substr(0,10).c_str(),
     646 | -           mapTx.size());
     647 | +    printf("mempool %lu: ", mapTx.size());
     648 | +    printf("tx %s accepted ", hash.ToString().substr(0,10).c_str());
    


    luke-jr commented at 3:02 AM on May 26, 2012:

    No need for two abbreviated lines instead of one :(


    rebroad commented at 8:40 AM on May 29, 2012:

    fixed.

  4. in src/main.cpp:None in 4143c8d579 outdated
     580 | @@ -543,8 +581,12 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
     581 |          unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
     582 |  
     583 |          // Don't accept it if it can't get into a block
     584 | -        if (nFees < tx.GetMinFee(1000, true, GMF_RELAY))
     585 | -            return error("CTxMemPool::accept() : not enough fees");
    


    luke-jr commented at 3:04 AM on May 26, 2012:

    Don't assume error() is simply printf && return false


    rebroad commented at 8:37 AM on May 29, 2012:

    Fair point. Fixed. Using error() now.

  5. jgarzik commented at 4:34 PM on August 1, 2012: contributor

    Consensus similar to #1375: "txnode" global is not worth it, and is not MT friendly.

    The concept seems agreeable -- at times, various IRC denizens have expressed an interest in logging the IP associated with a particular behavior.

    It might be easier to approach this from another angle: maybe in the ProcessMessage() loop, with ready, locked access to "pfrom", some useful logging may be obtained.

  6. jgarzik closed this on Aug 1, 2012

  7. suprnurd referenced this in commit 85d152bac0 on Dec 5, 2017
  8. lateminer referenced this in commit 8eaa079002 on Jan 22, 2019
  9. lateminer referenced this in commit ac4ab94dd8 on May 6, 2020
  10. DrahtBot locked this on Sep 8, 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-22 18:16 UTC

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