-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Config Refresh #4049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MicahMaphet
wants to merge
21
commits into
bitpay:master
Choose a base branch
from
MicahMaphet:config-refresh
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Config Refresh #4049
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a5eb24b
added config reload function
MicahMaphet 4dc58b0
fixed build import and other compile errors
MicahMaphet 4344e93
added reloadRefresh script
MicahMaphet 6ccf30e
finished config refresh mechanism and create shell script to start co…
MicahMaphet b858f14
reloadConfig.sh features: reload many workers, reload all workers, li…
MicahMaphet 8e4d17a
fixed no args error
MicahMaphet 01bbf5a
show the change in the config and restart server on a new port on con…
MicahMaphet 4f4dc51
add node connections when added to config (does not remove nodes
MicahMaphet 903cb21
finished reloading+adding+removing peer connections on config refresh
MicahMaphet 66894c5
show worker pid and name in output for reload script
MicahMaphet 5bb2f09
disable and enable peers on config refresh
MicahMaphet 44e8381
merge master into config-refresh
MicahMaphet 2e19c59
Merge branch 'master' into config-refresh
MicahMaphet dc1eb4f
fix some merge errors
MicahMaphet f3e5486
copilot review: import paths and pid file logic
MicahMaphet 58c11b6
removed refresh listener on p2p manager
MicahMaphet 587ba75
Merge branch 'master' into config-refresh
MicahMaphet 4f47823
Merge branch 'master' into config-refresh
MicahMaphet ed4deac
fixed master merge
MicahMaphet 37e0f27
save config changes from last reload
MicahMaphet 6467ea7
re did config reload functionality to just reload modules and disable…
MicahMaphet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| [1mdiff --git a/packages/bitcore-cli/package.json b/packages/bitcore-cli/package.json[m | ||
| [1mindex e291ea3ba..875c2d210 100644[m | ||
| [1m--- a/packages/bitcore-cli/package.json[m | ||
| [1m+++ b/packages/bitcore-cli/package.json[m | ||
| [36m@@ -30,8 +30,7 @@[m | ||
| },[m | ||
| [m | ||
| "scripts": {[m | ||
| [31m- "test": "npm run compile && mocha 'build/test/**/*.js'",[m | ||
| [31m- "coverage": "npm run compile && nyc mocha 'build/test/**/*.js'",[m | ||
| [32m+[m[32m "test": "npm run compile && nyc mocha 'build/test/**/*.js' --timeout 5000",[m | ||
| "build": "tsc",[m | ||
| "postbuild": "node createBin -v",[m | ||
| "clean": "rm -rf ./build",[m | ||
| [1mdiff --git a/packages/bitcore-client/package.json b/packages/bitcore-client/package.json[m | ||
| [1mindex ffe3e25eb..12e2e6ff4 100644[m | ||
| [1m--- a/packages/bitcore-client/package.json[m | ||
| [1m+++ b/packages/bitcore-client/package.json[m | ||
| [36m@@ -23,8 +23,7 @@[m | ||
| "watch": "tsc --watch",[m | ||
| "precompile": "cd ../bitcore-node && npm run clean && npm run build:prod",[m | ||
| "compile": "npm run clean && npm run build",[m | ||
| [31m- "test": "npm run compile && mocha -r tsx --exit 'test/**/*.test.ts'",[m | ||
| [31m- "coverage": "npm run compile && nyc mocha -r tsx --exit 'test/**/*.test.ts'",[m | ||
| [32m+[m[32m "test": "npm run compile && nyc mocha --exit 'ts_build/test/**/*.test.js'",[m | ||
| "precommit": "npm run lint",[m | ||
| "lint": "eslint .",[m | ||
| "fix:errors": "eslint --fix --quiet .",[m | ||
| [1mdiff --git a/packages/bitcore-client/test/unit/wallet.test.ts b/packages/bitcore-client/test/unit/wallet.test.ts[m | ||
| [1mindex a9947ce4e..a75d02ed4 100644[m | ||
| [1m--- a/packages/bitcore-client/test/unit/wallet.test.ts[m | ||
| [1m+++ b/packages/bitcore-client/test/unit/wallet.test.ts[m | ||
| [36m@@ -1,10 +1,10 @@[m | ||
| import * as chai from 'chai';[m | ||
| import * as CWC from '@bitpay-labs/crypto-wallet-core';[m | ||
| import { AddressTypes, Wallet } from '../../src/wallet';[m | ||
| [31m-import { Api as bcnApi } from '../../../bitcore-node/build/src/services/api';[m | ||
| [31m-import { Storage as bcnStorage } from '../../../bitcore-node/build/src/services/storage';[m | ||
| [32m+[m[32mimport { Api as bcnApi } from '../../../bitcore-node/src/services/api';[m | ||
| [32m+[m[32mimport { Storage as bcnStorage } from '../../../bitcore-node/src/services/storage';[m | ||
| import crypto from 'crypto';[m | ||
| [31m-import { Modules } from '../../../bitcore-node/build/src/modules';[m | ||
| [32m+[m[32mimport { Modules } from '../../../bitcore-node/src/modules';[m | ||
| import request from 'request-promise-native';[m | ||
| import requestStream from 'request';[m | ||
| import { Server } from 'http';[m | ||
| [36m@@ -136,7 +136,7 @@[m [mdescribe('Wallet', function() {[m | ||
| expect(err.message).to.equal('Must provide changeIdx for UTXO chains');[m | ||
| }[m | ||
| });[m | ||
| [31m- [m | ||
| [32m+[m | ||
| it('should throw an error if neither rawTx nor txid is provided', async () => {[m | ||
| try {[m | ||
| await wallet.bumpTxFee({ changeIdx: 0 });[m | ||
| [36m@@ -171,12 +171,12 @@[m [mdescribe('Wallet', function() {[m | ||
| sandbox.stub(wallet, 'getTransactionByTxid').resolves({ '_id': '65982807d85e75f781a0d56f', 'txid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'network': 'regtest', 'chain': 'BTC', 'blockHeight': -1, 'blockHash': '', 'blockTime': '2024-01-05T16:02:15.678Z', 'blockTimeNormalized': '2024-01-05T16:02:15.678Z', 'coinbase': false, 'locktime': -1, 'inputCount': 5, 'outputCount': 1, 'size': 780, 'fee': 2409, 'value': 950891, 'confirmations': 0, 'coins': { 'inputs': [{ '_id': '659825bed85e75f781a01812', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 1, 'spentTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintTxid': '330716a75c23512202e45ffee478bdce7a33f298edf7eef30a42dbde06746c48', 'mintHeight': 154, 'spentHeight': -1, 'address': 'n2vpyzbBPBEni9FgkeQSnXvAQAfnRmKxFZ', 'script': '76a914eade85745090388e64a9341a82d8f94371430d1a88ac', 'value': 244000, 'confirmations': -1, 'sequenceNumber': 4294967293 }, { '_id': '65982587d85e75f781a0046f', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 1, 'spentTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintTxid': '7b83f82a22f94fc3e615743a5e6fb2345ed79aad8a2b564af2ace49da1e27ebb', 'mintHeight': 152, 'spentHeight': -1, 'address': 'muEU9KaNEw5doymy59ScrgEE3Eq4CQ45U9', 'script': '76a91496739b4ef4e793c05a78624da38d96f2c4059c6b88ac', 'value': 239400, 'confirmations': -1, 'sequenceNumber': 4294967293 }, { '_id': '65982511d85e75f7819fdd40', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 0, 'spentTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintTxid': 'fb4d8039024c80a655fea29e01faf202f30e936af5738e31c5841a84215ca4d6', 'mintHeight': 149, 'spentHeight': -1, 'address': 'muEU9KaNEw5doymy59ScrgEE3Eq4CQ45U9', 'script': '76a91496739b4ef4e793c05a78624da38d96f2c4059c6b88ac', 'value': 239400, 'confirmations': -1, 'sequenceNumber': 4294967293 }, { '_id': '659824d7d85e75f7819fc75d', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 0, 'spentTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintTxid': '8221ed6891f6ba82ab72bb8298a661e21b47b04408861b0c3268c4a04a0435b3', 'mintHeight': 145, 'spentHeight': -1, 'address': 'miEzS8fSvtDjwkEjY14FEuWumFKg8nTPV9', 'script': '76a9141de381fc20d34d20e11a5543f536a4b74f495a9888ac', 'value': 228000, 'confirmations': -1, 'sequenceNumber': 4294967293 }, { '_id': '65982389d85e75f7819f57ff', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 0, 'spentTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintTxid': '95f713c2d7e09ab57ec3016bb767b26e6ee849cf487e86d8ed6126ae1b893e0f', 'mintHeight': 143, 'spentHeight': -1, 'address': 'msnM9VB5usfBahZNo57ZUq9uzwRxQXksUz', 'script': '76a914868ad3308906626182d1c6cd703cc7ce78b3a28d88ac', 'value': 2500, 'confirmations': -1, 'sequenceNumber': 4294967293 }], 'outputs': [{ '_id': '65982807d85e75f781a0d55d', 'chain': 'BTC', 'network': 'regtest', 'coinbase': false, 'mintIndex': 0, 'spentTxid': '', 'mintTxid': '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5', 'mintHeight': -1, 'spentHeight': -2, 'address': 'mwwrGzk9q8xugY97C8BiNbcgqXNyjH4kp8', 'script': '76a914b4376347e4cffb1e9a475b2661bbe74de3c1f86a88ac', 'value': 950891, 'confirmations': -1 }] } });[m | ||
| sandbox.stub(wallet.client, 'importAddresses').resolves();[m | ||
| sandbox.spy(CWC.BitcoreLib.Transaction.prototype, 'feePerByte');[m | ||
| [31m- [m | ||
| [32m+[m | ||
| await wallet.generateAddressPair(1310066242, true);[m | ||
| await wallet.generateAddressPair(1087984800, true);[m | ||
| await wallet.generateAddressPair(1310064953, true);[m | ||
| await wallet.generateAddressPair(1310062823, true);[m | ||
| [31m- [m | ||
| [32m+[m | ||
| const { tx: newTx } = await wallet.bumpTxFee({[m | ||
| txid: '8b78e4d2ac2211472454f940445210b6487aaa0f889e18066eb3f623352607f5',[m | ||
| changeIdx: 0,[m | ||
| [36m@@ -204,7 +204,7 @@[m [mdescribe('Wallet', function() {[m | ||
| await wallet.unlock('abc123');[m | ||
| });[m | ||
| [m | ||
| [31m- [m | ||
| [32m+[m | ||
| it('should throw an error if neither rawTx nor txid is provided', async () => {[m | ||
| try {[m | ||
| await wallet.bumpTxFee({ changeIdx: 0 });[m | ||
| [36m@@ -230,7 +230,7 @@[m [mdescribe('Wallet', function() {[m | ||
| it('should bump the fee of a transaction with feeRate', async function() {[m | ||
| sandbox.stub(wallet, 'getTransactionByTxid').resolves({ 'txid': '0x0cf410cfe7fb268ad06ae115edfa8a30a8dea3979336a647b09b5a789c4b53d5', 'network': 'regtest', 'chain': 'ETH', 'blockHeight': 43245, 'blockHash': '0x9edb8d10883a360f7ff0c26860b6a159f5b7a74226949a4365691a879fafcdfc', 'blockTime': '2024-01-08T16:31:46.000Z', 'blockTimeNormalized': '2024-01-08T16:31:46.000Z', 'fee': 42000000000000, 'value': 1000000000000000000, 'gasLimit': 200000, 'gasPrice': 2000000000, 'nonce': 0, 'to': '0x7ee308b49e36Ab516cd0186B3a47CFD31d2499A1', 'from': '0x5FbdD2712d05D1a73e0b3Eba5efE8c3d42a336C3', 'effects': [], 'data': '0x', 'internal': [], 'calls': [], 'confirmations': 33 });[m | ||
| sandbox.stub(wallet.client, 'importAddresses').resolves();[m | ||
| [31m- [m | ||
| [32m+[m | ||
| const { tx: newTx, params } = await wallet.bumpTxFee({[m | ||
| txid: '0x0cf410cfe7fb268ad06ae115edfa8a30a8dea3979336a647b09b5a789c4b53d5',[m | ||
| feeRate: 300[m | ||
| [36m@@ -549,4 +549,3 @@[m [mdescribe('Wallet', function() {[m | ||
| });[m | ||
| });[m | ||
| });[m | ||
| [31m-[m | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||||
| #!/bin/sh | ||||||||
|
|
||||||||
| dir=$(pwd) | ||||||||
|
||||||||
| dir=$(pwd) | |
| script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | |
| dir=$(CDPATH= cd -- "$script_dir/.." && pwd) |
MicahMaphet marked this conversation as resolved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file appears to be an accidentally committed terminal-colored
git diffoutput (contains ANSI escape sequences) rather than source code/config. It should be removed from the repository (and the intended changes applied to the real files instead, if needed).