Skip to content

Deprecate and remove Context object. #4093

Description

@msgilligan

We have been working towards this goal for years now, but I think we can deprecate Context as part of the 0.18 release.

There are 5 fields in Context:

  1. boolean relaxProofOfWork -- only used in Block.checkProofOfWork() and only used for unit testing.
  2. int eventHorizon -- only used in Wallet.notifyNewBestBlock()
  3. boolean ensureMinRequiredFee -- only used in building SendRequest instances
  4. Coin feePerKb-- only used in building SendRequest instances
  5. TxConfidenceTable txConfidenceTable -- used in Wallet, Peer, PeerGroup (indirectly), and Transaction

This issue is a tracking issue for a stepwise deprecation and removal of Context and its use as a ThreadLocal. The steps should look roughly like.

  1. Eliminating all use of Context within bitcoinj focusing on the 5 fields above. For backwards-compatibility we can probably leave the getters for these five fields and have them provide the instances/data that are now stored elsewhere.
  2. Remove the requirement for and use of Context as a ThreadLocal for normal usage (i.e. everywhere but in the tests)
  3. Remove the the usage of ThreadLocal Context in the tests
  4. Deprecate all public references to Context --- hopefully this can be included in Release 0.18.
  5. Remove the Context class entirely.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ContextRelated to removal of the ThreadLocal Context object

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions