From 16c31bb0d54f95e8c03f8706c1c7ec9c23232f27 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Wed, 22 Jan 2025 08:50:35 -0800 Subject: [PATCH] refactor: reduce Context dependencies and replace with DashSystem (#264) * refactor: move components from Context to DashSystem * tests: simplify tests * refactor: update BuildCheckpoints to use DashSystem * chore: add TODO comment to SimplifiedMasternodeList.p * refactor: update WalletTool to use DashSystem * refactor: add default ctor for DownloadProgressTracker * refactor: move components from Context to DashSystem * refactor: update BuildCheckpoints to use DashSystem * chore: add TODO comment to SimplifiedMasternodeList.p * refactor: update WalletTool to use DashSystem * refactor: add default ctor for DownloadProgressTracker * chore: update run configurations * feat: add getters to RecoveredSignature * feat: add lock time to Transaction Report * fix: account for 0 diff transactions when emitting events * fix: compile issue on checkCommitment --- .run/WalletTool CJ Create.run.xml | 2 +- .run/WalletTool CJ Dump.run.xml | 2 +- .run/WalletTool CJ Sync.run.xml | 2 +- .../java/org/bitcoinj/coinjoin/CoinJoin.java | 13 +- .../coinjoin/CoinJoinBroadcastTx.java | 6 +- .../coinjoin/CoinJoinClientManager.java | 39 +- .../coinjoin/CoinJoinClientQueueManager.java | 35 +- .../coinjoin/CoinJoinClientSession.java | 79 ++-- .../coinjoin/utils/CoinJoinManager.java | 53 ++- .../coinjoin/utils/MasternodeGroup.java | 36 +- .../coinjoin/utils/TransactionBuilder.java | 16 +- .../org/bitcoinj/core/AbstractBlockChain.java | 1 - .../main/java/org/bitcoinj/core/Context.java | 322 +------------ .../org/bitcoinj/core/MasternodePayments.java | 2 +- .../org/bitcoinj/core/MasternodeSync.java | 52 ++- .../src/main/java/org/bitcoinj/core/Peer.java | 172 ++----- .../java/org/bitcoinj/core/PeerGroup.java | 39 +- .../java/org/bitcoinj/core/SporkManager.java | 62 ++- .../listeners/DownloadProgressTracker.java | 9 +- .../evolution/AbstractQuorumState.java | 30 +- .../evolution/MasternodeListManager.java | 24 + .../evolution/QuorumRotationState.java | 30 +- .../org/bitcoinj/evolution/QuorumState.java | 16 +- .../evolution/SimplifiedMasternodeList.java | 4 +- .../SimplifiedMasternodeListManager.java | 60 ++- .../governance/GovernanceManager.java | 147 ++++-- .../bitcoinj/governance/GovernanceObject.java | 37 +- .../governance/GovernanceTriggerManager.java | 21 +- .../bitcoinj/governance/GovernanceVote.java | 15 +- .../org/bitcoinj/governance/Superblock.java | 8 +- .../governance/SuperblockManager.java | 46 +- .../bitcoinj/kits/FullPrunedWalletAppKit.java | 26 +- .../java/org/bitcoinj/kits/WalletAppKit.java | 50 +- .../java/org/bitcoinj/manager/DashSystem.java | 430 ++++++++++++++++++ .../masternode/owner/MasternodeControl.java | 37 +- .../bitcoinj/quorums/ChainLocksHandler.java | 70 ++- .../org/bitcoinj/quorums/FinalCommitment.java | 18 +- .../bitcoinj/quorums/InstantSendManager.java | 139 +++++- .../quorums/LLMQBackgroundThread.java | 33 +- .../java/org/bitcoinj/quorums/LLMQUtils.java | 13 +- .../bitcoinj/quorums/RecoveredSignature.java | 20 + .../org/bitcoinj/quorums/SigningManager.java | 23 +- .../quorums/SimplifiedQuorumList.java | 19 +- .../signers/CoinJoinTransactionSigner.java | 8 +- .../main/java/org/bitcoinj/wallet/Wallet.java | 7 - .../org/bitcoinj/coinjoin/CoinJoinServer.java | 15 +- .../coinjoin/CoinJoinSessionTest.java | 69 ++- .../coinjoin/CoinJoinSignedInputsTest.java | 6 +- .../coinjoin/TestWithMasternodeGroup.java | 11 +- .../utils/CoinJoinTransactionTypeTest.java | 2 +- .../org/bitcoinj/core/BlockChainTest.java | 2 +- .../core/ChainLockBlockChainTest.java | 17 +- .../org/bitcoinj/core/ChainSplitTest.java | 1 - ...ilteredBlockAndPartialMerkleTreeTests.java | 2 +- .../org/bitcoinj/core/SporkMessageTest.java | 5 - .../evolution/LoadBootstrapFilesTest.java | 9 +- .../QuorumStateValidateQuorumsTest.java | 13 +- .../evolution/SimplifiedMasternodesTest.java | 13 +- .../quorums/ChainLocksHandlerTest.java | 16 +- .../quorums/QuorumRotationStateTest.java | 37 +- ...uorumRotationStateValidateQuorumsTest.java | 12 +- .../testing/TestWithNetworkConnections.java | 2 +- .../org/bitcoinj/testing/TestWithWallet.java | 3 +- .../bitcoinj/wallet/CoinJoinWalletTest.java | 11 +- .../bitcoinj/examples/CoinJoinMonitor.java | 4 +- .../ConvertBootStrapToManagerFile.java | 17 +- .../bitcoinj/examples/ForwardingService.java | 4 +- .../examples/FullPrunedForwardingService.java | 2 +- .../examples/debug/TransactionReport.java | 22 +- .../org/bitcoinj/tools/BuildCheckpoints.java | 6 +- .../java/org/bitcoinj/tools/WalletTool.java | 45 +- 71 files changed, 1640 insertions(+), 979 deletions(-) create mode 100644 core/src/main/java/org/bitcoinj/evolution/MasternodeListManager.java create mode 100644 core/src/main/java/org/bitcoinj/manager/DashSystem.java diff --git a/.run/WalletTool CJ Create.run.xml b/.run/WalletTool CJ Create.run.xml index de02784d62..001aa641e9 100644 --- a/.run/WalletTool CJ Create.run.xml +++ b/.run/WalletTool CJ Create.run.xml @@ -1,7 +1,7 @@