Permalink
Commits on Jul 23, 2017
  1. Add missing lock in CScheduler::AreThreadsServicingQueue()

    Not an actual bug as this is only used in asserts right now, but
    nice to not have a missing lock.
    TheBlueMatt committed Jul 23, 2017
Commits on Jul 18, 2017
  1. Do not allow users to get keys from keypool without reserving them

    fundrawtransaction allows users to add a change output and then
    not have it removed from keypool. While it would be nice to have
    users follow the normal CreateTransaction/CommitTransaction process
    we use internally, there isnt much benefit in exposing this option,
    especially with HD wallets, while there is ample room for users to
    misunderstand or misuse this option.
    
    This could be particularly nasty in some use-cases (especially
    pre-HD-split) - eg a user might fundrawtransaction, then call
    getnewaddress, hand out the address for someone to pay them, then
    sendrawtransaction. This may result in the user thinking they have
    received payment, even though it was really just their own change!
    
    This could obviously result in needless key-reuse.
    TheBlueMatt committed Jul 10, 2017
Commits on Jul 17, 2017
  1. Prevent user from specifying conflicting parameters to fundrawtx

    estimate_mode/conf_target both are overridden by feeRate, so should
    not be specified together with feeRate.
    TheBlueMatt committed Jul 12, 2017
  2. No longer ever reuse keypool indexes

    This fixes an issue where you could reserve a keypool entry, then
    top up the keypool, writing out a new key at the given index, then
    return they key from the pool. This isnt likely to cause issues,
    but given there is no reason to ever re-use keypool indexes
    (they're 64 bits...), best to avoid it alltogether.
    TheBlueMatt committed Jul 11, 2017
Commits on Jul 15, 2017
  1. Track keypool entries as internal vs external in memory

    This resolves a super minor performance regressions in several
    keypool-handling functions
    TheBlueMatt committed Apr 19, 2017
  2. Explicitly initialize prevector::_union to avoid new warning

    Warning from gcc 7.1 is ./prevector.h:450:25: warning:
    '*((void*)(&<anonymous>)+8).prevector<28, unsigned char>::_union.prevector<28, unsigned char>::direct_or_indirect::<anonymous>.prevector<28, unsigned char>::direct_or_indirect::<unnamed struct>::indirect'
    may be used uninitialized in this function [-Wmaybe-uninitialized]
    TheBlueMatt committed Jul 12, 2017
Commits on Jul 12, 2017
Commits on Jul 11, 2017
Commits on Jul 7, 2017
  1. Flush CValidationInterface callbacks prior to destruction

    Note that the CScheduler thread cant be running at this point,
    it has already been stopped with the rest of the init threadgroup.
    Thus, just calling any remaining loose callbacks during Shutdown()
    is sane.
    TheBlueMatt committed Jun 27, 2017
  2. Support more than one CScheduler thread for serial clients

    This will be used by CValidationInterface soon.
    
    This requires a bit of work as we need to ensure that most of our
    callbacks happen in-order (to avoid synchronization issues in
    wallet) - we keep our own internal queue and push things onto it,
    scheduling a queue-draining function immediately upon new
    callbacks.
    TheBlueMatt committed Apr 10, 2017
  3. Give CMainSignals a reference to the global scheduler

    ...so that it can run some signals in the background later
    TheBlueMatt committed Jan 19, 2017
  4. Fix multi_rpc test for hosts that dont default to utf8

    Otherwise the utf8 written to bitcoin.conf throws an exception when
    read from get_auth_cookie
    TheBlueMatt committed Jul 7, 2017
Commits on Jul 5, 2017
  1. Use "replaceable" instead of "rbfoptin" in bitcoin-tx.

    To be consistent with RPC naming
    TheBlueMatt committed Jun 28, 2017
  2. Use "replaceable" instead of "optIntoRbf" in fundrawtransaction.

    To be consistent with other RPCs
    TheBlueMatt committed Jun 28, 2017
  3. Use "replaceable" instead of "optintorbf" in createrawtransaction.

    To be consistent with other places (and add the missing named
    args entry for it).
    TheBlueMatt committed Jun 28, 2017
Commits on Jul 4, 2017
  1. Make ValidationInterface signals-type-agnostic

    (by hiding boost::signals stuff in the .cpp)
    
    This allows us to give it a bit more intelligence as we move
    forward, including routing some signals through CScheduler. While
    the introduction of a "internals" pointer in the class is pretty
    ugly, the fact that we no longer need to include boost/signals
    directly from validationinterface.h is very much worth the loss.
    TheBlueMatt committed Jan 19, 2017
Commits on Jun 27, 2017
  1. Clarify CCoinsViewMemPool documentation.

    Thanks to @sdaftuar for correcting my misunderstanding.
    TheBlueMatt committed Jun 27, 2017
Commits on Jun 26, 2017
  1. Dont create pcoinsTip until after ReplayBlocks.

    This requires that we not access pcoinsTip in InitBlockIndex's
    FlushStateToDisk (so we just skip it until later in AppInitMain)
    and the LoadChainTip in LoadBlockIndex (which there is already one
    later in AppinitMain, after ReplayBlocks, so skipping it there is
    fine).
    
    Includes some simplifications by Suhas Daftuar and Pieter Wuille.
    TheBlueMatt committed with sipa Apr 17, 2017
Commits on Jun 22, 2017
  1. Add CheckInputs wrapper CCoinsViewMemPool -> non-consensus-critical

    This wraps CheckInputs in ATMP's cache-inputs call to check that
    each scriptPubKey the CCoinsViewCache provides is the one which
    was committed to by the input's transaction hash.
    TheBlueMatt committed Jun 6, 2017
Commits on Jun 9, 2017
  1. Be much more agressive in AccessCoin docs.

    While the current implementation is pretty free, there is a lot
    of possibility for this to blow up in our face with future changes,
    especially as the backing map gets tweaked.
    TheBlueMatt committed Jun 6, 2017
  2. Restore some assert semantics in sigop cost calculations

    There are some similar asserts which are left removed in policy
    and ATMP (policy code being broken isn't a huge deal, but if we
    fail to verify some consensus rules, we should most definitely
    crash).
    TheBlueMatt committed Jun 6, 2017
  3. Return a bool in SpendCoin to restore pre-per-utxo assert semantics

    Since its free to do so, assert that Spends succeeded when we expect
    them to.
    TheBlueMatt committed Jun 5, 2017
Commits on Jun 7, 2017
  1. Cache full script execution results in addition to signatures

    This adds a new CuckooCache in validation, caching whether all of a
    transaction's scripts were valid with a given set of script flags.
    
    Unlike previous attempts at caching an entire transaction's
    validity, which have nearly universally introduced consensus
    failures, this only caches the validity of a transaction's
    scriptSigs. As these are pure functions of the transaction and
    data it commits to, this should be much safer.
    
    This is somewhat duplicative with the sigcache, as entries in the
    new cache will also have several entries in the sigcache. However,
    the sigcache is kept both as ATMP relies on it and because it
    prevents malleability-based DoS attacks on the new higher-level
    cache. Instead, the -sigcachesize option is re-used - cutting the
    sigcache size in half and using the newly freed memory for the
    script execution cache.
    
    Transactions which match the script execution cache never even have
    entries in the script check thread's workqueue created.
    
    Note that the cache is indexed only on the script execution flags
    and the transaction's witness hash. While this is sufficient to
    make the CScriptCheck() calls pure functions, this introduces
    dependancies on the mempool calculating things such as the
    PrecomputedTransactionData object, filling the CCoinsViewCache, etc
    in the exact same way as ConnectBlock. I belive this is a reasonable
    assumption, but should be noted carefully.
    
    In a rather naive benchmark (reindex-chainstate up to block 284k
    with cuckoocache always returning true for contains(),
    -assumevalid=0 and a very large dbcache), this connected blocks
    ~1.7x faster.
    TheBlueMatt committed Apr 11, 2017
Commits on Jun 6, 2017
  1. Remove references to priority that snuck back in in 870824e.

    The "priority" field should be appropriately marked as a "dummy"
    value and noted that it is deprecated and will likely be removed.
    TheBlueMatt committed Jun 6, 2017
  2. Remove useless mapNextTx lookup in CTxMemPool::TrimToSize.

    Prior to per-utxo CCoins, we checked that no other in-mempool tx
    spent any of the given transaction's outputs, as we don't want to
    uncache that entire tx in such a case. However, we now are checking
    only that there exists no other mempool spends of the same output,
    which should clearly be impossible after we removed the transaction
    which was spending said output (barring massive mempool
    inconsistency).
    
    Thanks to @sdaftuar for the suggestion.
    TheBlueMatt committed Jun 5, 2017
Commits on Jun 1, 2017
  1. Only pass things committed to by tx's witness hash to CScriptCheck

    This clarifies a bit more the ways in which the new script execution
    cache could break consensus in the future if additional data from
    the CCoins object were to be used as a part of script execution.
    
    After this change, any such consensus breaks should be very visible
    to reviewers, hopefully ensuring no such changes can be made.
    TheBlueMatt committed with sipa Apr 27, 2017