Commit Graph

338 Commits

Author SHA1 Message Date
Chris Stewart
e791932f99
Refactor peerData -> peerDataMap, try to fix #4955 (#5030)
* Refactor peerData -> peerDataMap, try to fix #4955

* scalafmt

* Empty commit to re-run CI
2023-04-03 06:35:39 -05:00
Chris Stewart
54b47152d1
Fix bug fetching compact filter height to early in DataMessageHandler (#5031) 2023-04-01 07:21:58 -05:00
Chris Stewart
1d611ec6b5
Remove fetch compact filters in NeutrinoNode.sync() before fetching block headers / compact filter headers (#5023) 2023-03-23 12:01:22 -05:00
Chris Stewart
875a67a73c
2023 03 03 rm DataMessageHandler filter params (#5009)
* Remove DataMessageHandler filter params, tests not passing

* Adjust logging levels

* WIP

* Get tests passing

* Cleanup

* Fix logging level

* Invert isSynced flag

* Rework BaseBlockchain.toString

* Fix BlockchainTest

* Fix syncing of compact filters when walletCreationTime is passed into dmh

* Cleanup
2023-03-14 11:45:21 -05:00
Chris Stewart
de0e892b3e
2023 02 27 Fix bug where duplicate filters caused node not to sync (#5008)
* WIP

* Modify DataMessageHandler to use Set for filter batch, fix test case

* revert log level

* Remove duplicate filters test

* Re-add test to make sure we don't throw an exception when processing a filter we've seen before

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Fix NeutrinoNodeTest

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-03-02 06:46:08 -06:00
Chris Stewart
0577b8c1fe
Improve Inventory toString messages (#4997)
* Improve Inventory toString messages

* Add individual counts rather than showing each service identifier

* Add peer= prefix to peer
2023-02-23 14:12:53 -06:00
Chris Stewart
c7febc1ef0
Segregate P2PClientTest and P2PClientActorTest (#4974)
* Segregate P2PClientTest and P2PClientActorTest to make it easier to test the actor

* Fix cleanup code

* Clean up tables for postgres test case

* Fix BitcoinSAppConfigBitcoinFixtureStarted.afterAll()

* Empty commit

* Add forceNamedWallet parameter to for postgres test cases where we need multiple wallets. This prevents them from writing to the same postgres schema by making unique wallet names

* Cleanup:

* Empty commit
2023-02-06 15:07:18 -06:00
Chris Stewart
f6207b1c9f
Add check we have more than 1 peer before we try to syncFromNewPeer() (#4966)
* Add check we have more than 1 peer before we try to syncFromNewPeer()

* Empty commit

* Return failed Future rather than just logging an error
2023-02-03 15:46:24 -06:00
Chris Stewart
3bc89c680f
Fix case where syncCompactFilters is called but filters but no sync peer is set (#4965) 2023-01-31 06:42:55 -06:00
Chris Stewart
c5983730bb
2023 01 10 refactor peermanager (#4950)
* Make PeerManager.finder private

* Make PeerManager.supervisor private

* Write unit test to see if default peer is added to PeerManager

* Use withNeutrinoNodeUnstarted fixture

* Get unit tests passing

* Add println to try and debug CI

* Add more println

* more println

* Adjust nodeTest / parallelExecution = false

* Try to make error logged to figure out why failure is happening on CI

* Adjust log level to ERROR

* Add catch to try and log failure messages

* Add log for sending messages to peers

* Try to increase threadpool size to see if we are deadlocking

* Add more logs

* Add another log to detect where failure is

* Try using Actor.tell() with explicit ActorRef.noSender

* Very detailed logging

* Remove duplicate method from rebase

* Revert things

* Revert build.sbt

* Empty commit

* Bump timeout

* Empty commit to run CI

* Revert more files
2023-01-27 10:43:50 -06:00
Chris Stewart
60907a7c17
2023 01 25 mv handling network received msg (#4961)
* Move handle network received message into awaitNetworkRequest() context

* Fix bug where I wasn't wrapping in NetworkMessageReceived

* revert logging

* remove more uncessary logs

* Empty commit
2023-01-25 13:38:39 -06:00
Chris Stewart
dd08dedb41
2023 01 24 small changes from pr 4950 (#4958)
* Pull things over from 4950 that shouldn't cause issues to reduce size of 4950

* Reduce timeout for processing a batch of messages from 1000 seconds -> 60 seconds

* scalafmt

* Empty commit
2023-01-25 08:31:57 -06:00
Chris Stewart
dfe92d2ba4
Remove expectTimeout Await.result() (#4957) 2023-01-23 12:30:36 -06:00
Chris Stewart
4e4c6d03f1
Remove Await.result() in initializationTimeoutCancellable (#4956) 2023-01-23 09:00:38 -06:00
Chris Stewart
9646994a99
Encapsulate PeerData.client (#4944) 2023-01-09 11:56:38 -06:00
Chris Stewart
09d53460a1
Implement ability to cancel background task for querying peer with specific services (#4937)
* Implement ability to cancel background task for querying peer with specific services

* Cancel scheduled job when promise is completed
2023-01-02 11:39:13 -06:00
Chris Stewart
a7930657f9
Rework logging so that stack traces aren't printed when we receive duplicate data over the p2p network (#4936) 2022-12-30 14:51:27 -06:00
Chris Stewart
bd79ab0b73
2022 12 12 rm dmh params (#4925)
* WIP

* WIP2

* Get all DataMessageHandlerTest passing

* Get NeutrinoNodeTest passing

* Fix NeutrinoNodeWithUncachedBitcoindTest unit test

* Use chainApi to detect if we are in IBD

* Empty commit

* Revert logging levels
2022-12-28 16:37:28 -06:00
Chris Stewart
96392edde7
Stop P2PClientActor when we receive Tcp.{ErrorClosed,ConfirmedClosed,Closed,Aborted,PeerClosed} commands (#4926) 2022-12-15 16:45:08 -06:00
Chris Stewart
24c6dc2cdb
Download blocks from random peer if we aren't in IBD (#4924)
* Download blocks from random peer if we aren't in IBD

* scalafmt
2022-12-14 16:49:54 -06:00
Chris Stewart
0d76a06331
Call handleDataPayloadHelper explicitly on DataMessageHandlerState (#4921)
* Call handleDataPayloadHelper explicitly on DataMessageHandlerState

* revert changes from other PR

* revert logs
2022-12-14 09:28:56 -06:00
Chris Stewart
6293d45a37
Fix synced flag but in DataMessageHandler bug (#4920)
* Fix synced flag but in DataMessageHandler bug

* Make variable name be syncing since that is what it actually represents
2022-12-13 07:40:00 -06:00
Chris Stewart
aab2b274f0
Remove default parameters from DataMessageHandler (#4918)
* Remove default parameters from DataMessageHandler

* Remove syncPeer default parameter
2022-12-12 15:46:34 -06:00
Chris Stewart
f2be536211
Delay querying for peers for 30 minutes (#4897) 2022-11-23 16:45:04 -06:00
Chris Stewart
1127c56a98
Bump versions to 1.9.7 (#4886) 2022-11-16 09:35:42 -06:00
Chris Stewart
f483e356cb
Adjust period of time we query for peers on the p2p network from 12 seconds -> 1 hour (#4847) 2022-10-17 14:42:14 -05:00
Chris Stewart
e73b328833
Prepare for 1.9.6 (#4820) 2022-10-09 11:12:43 -05:00
Chris Stewart
eb5924ba94
2022 10 03 1.9.5 release notes (#4813)
* add new commits

* Bump versions

* update release notes

* Update release notes
2022-10-03 14:34:36 -05:00
Chris Stewart
88fce93268
Bump more logs to INFO (#4769) 2022-09-12 09:31:30 -05:00
Chris Stewart
0cfad33fae
Add 1.9.4 website, add 1.9.4 release notes (#4726)
* Add 1.9.4 website, add 1.9.4 release notes

* Add versioned sidebars

* Bump more versions to 1.9.4

* update release notes
2022-09-12 08:19:28 -05:00
Chris Stewart
fae1a53579
Bump bitcoin-s.node.query-wait-time=120 seconds (#4759)
* Bump query-wait-time to 120 seconds

* bump disconnection log level

* Bump log to INFO where peer disconnects us
2022-09-10 09:47:50 -05:00
Chris Stewart
d2f8811a1c
Add log when we are fetching peers to sync with (#4693) 2022-08-31 17:39:21 -05:00
Chris Stewart
9353c41e8f
Add some guards for when we set IBD flag to reduce false positive WARN messages (#4683) 2022-08-30 11:47:54 -05:00
Shreyansh
2cae3f803d
Fix infinite invalid header loop (#4667)
* fix infinite invalid header loop

* Adjust log levels to WARN

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-26 09:43:07 -05:00
benthecarman
02f525fd39
Make CRUDAction types more strict (#4657) 2022-08-24 06:15:24 -05:00
rorp
7c112b8a90
Fix rescan for existing wallets (#4656) 2022-08-24 05:42:53 -05:00
Shreyansh
4e4e4aa9ed
change stream to use backpressure (#4654) 2022-08-23 15:54:15 -05:00
Shreyansh
068187c93d
increase buffer size of dataMessageStream to 10000 (#4646) 2022-08-23 08:59:16 -05:00
Chris Stewart
e65346f558
Version 1.9.3 of everything (#4643) 2022-08-22 18:21:07 -05:00
Shreyansh
2c2e03b279
Header sync validation (#4456)
* add header sync validation

* fix docs, minor fixes

* Refactor to us InvalidBlockHeader ChainException, also refactor recovery to private helper method

* changes from comments

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-22 17:05:41 -05:00
Chris Stewart
86463231d6
2022 08 18 Add configuration to only emit websocket events when IBD is done (#4627)
* Implement isinitialblockdownload flag in databaes

* Change to IsInitialBlockDownload to be less confusing

* Fix missing refactors, add ChainApi.isIBD()

* Implement logic for ChainApi.isIBD(), add configuration flag to toggle whether to emit websocket events while IBD is ongoing or not, add isinitialblockdownload field to getinfo endpoint

* Remove confusing ChainApi.isIBD() that didn't accurately account for the case where IBD wasn't set in the database

* Fix bug around emitting the websocket events

* Add some documentation
2022-08-22 10:09:00 -05:00
Chris Stewart
d241e6f9e4
Remove merklebuffers (#4615) 2022-08-16 09:46:31 -05:00
Shreyansh
dea99457b5
fix mac node-wallet test failure (#4585) 2022-08-12 14:25:11 -05:00
GreyMcCarthy
c34b0de886
removed logger parameter from where it's used with callbacks (#4598)
* removed logger parameter from where it's used with callbacks

* removed logger from onTXRecived... and onBlockRecived...

* removed unused imports

* removed logger from walletCallbacks
2022-08-12 12:09:58 -05:00
rorp
9f89ba9b7a
loadwallet endpoint (#4417)
* `loadwallet` endpoint

* Scala 2.12 compatibility

* remove `getwalletname`

* fix unit tests

* fix DbManagementTest

* fix wallet tests

* fix DbManagementTest

* fix RejectedExecutionException

* fix postgres tests

* fix password override

* update `loadwallet`

* Move WalletHolder into wallet module

* Kill use of null in WalletHolder

* Kill use of null in WalletHolder

* Refactor to use WalletAppConfig.DEFAULT_WALLET_NAME

* update cli and unit tests

* cleanup

* Refactors to get compatible with master

* Fix compile

* Distinguish between loadWalletNeutrino & loadWalletBitcoind

* Fix initialized bug with WalletHolder in loadWallet methods

* Refactor loadWalletBitcoindBackend/loadNeutrinoWallet to have a common helper method

* Introduce DLCWalletLoaderApi, refactor codebase to use it

* Fix dumb initialization bug

* Fix test:compile

* Cleanup

* Get loadwallet mostly working with neutrino wallet

* Fix compile

* scalafmt

* Move loadwallet into app-commons

* Remove {DLCWallet,Wallet}.stop()

* Implement LoadWallet json parsing unit test

* Implement stopping of NodeStreamManager callbacks

* Fix rebase, integrate setRescanState into WalletRoutes

* Fix import

* Fix unit tests

* Implement listwallets in ConsoleCli

* Fix imports

* Cleanup

* scalafmt

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-05 17:34:14 -05:00
Chris Stewart
5acbba9377
Replace BoundedSourceQueueWithComplete with SourceQueueWithComplete (#4576)
* Replace BoundedSourceQueueWithComplete with SourceQueueWithComplete so we can use the returned Future

* Recover the expected exceptions in CallBackUtilTest
2022-08-05 11:57:13 -05:00
Shreyansh
c4d358061a
Add P2PClientSupervisor (#4509)
* add P2PClientSupervisor

* changes from comments: made P2PClient Future

* empty commit to see if mac failures are consistent on ci

* changes from comments

* changes from comments
2022-08-04 10:06:04 -05:00
Chris Stewart
191df09196
Move pollBitcoind out of startBitcoindBlockPolling (#4559)
* Move pollBitcoind out of startBitcoindBlockPolling

* Rework startBitcoindBlockPolling to not return Future[Cancellable]

* Stop NodeCallbacksStreamManager inside of NodeAppConfig.stop()

* Make BitcoindSyncState which encapsulates syncing with bitcoind and polling of mempool

* Fix bug where processingBitcoindBlocks cannot be top level val as that method may be used by different parts of the codebase

* Rename isPolling -> processingBitcoindBlocks

* Cleanup more resources in appServerTest/test

* Complete polling stream regardless if we synced blocks are not to complete the Future returned by pollBitcoind

* Empty commit to run CI
2022-08-02 06:40:17 -05:00
Chris Stewart
4b83286922
2022 07 25 wallet api refactor (#4545)
* Move MockChainQueryApi/NodeApi out of BaseWalletTest

* refactor BitcoinSServerMain.start() to return WalletHolder

* Add walletConfig to WalletWithBitcoind

* Move findOutputsBeingSpent into WalletApi

* Add WalletApi.clearAllAddresses(), HDWalletApi.{findAccount, getnewaddress(account)}

* Add HDWalletApi.fundRawTransaction() with an account as parameter

* Add WalletApi.findByScriptPubKey()

* Fix lots of tests in WalletIntegrationTest

* Create WalletApi.processOurTransaction()

* Get things compiling

* Fix tag integration test

* Refactor AnyDLCHDWalletApi -> DLCNeutrinoHDWalletApi

* Fix docs

* Get postgres tests passing locally

* Move initBalance map before calling callback in CallBackUtilTest

* Get compile working, rename to destroyOnlyWalletWithBitcoindCached

* Fix docs

* Fix missing destroyWalletAppConfig

* Fix scalafmt

* Fix bug in dlcWalletTest where wallet db thread pools weren't being shutdown after unit test completes

* Empty commit
2022-07-31 08:04:39 -05:00
Chris Stewart
d4210fad65
Pull over changes from loadwallet branch (#4527) 2022-07-21 12:12:32 -05:00
Chris Stewart
f5cca7e5e1
Add guard for calling NodeCallbackStreamManager.stop() (#4523)
* Add guard for calling NodeCallbackStreamManager.stop()

* scalafmt
2022-07-20 10:16:26 -05:00
Chris Stewart
0a127368f0
2022 07 18 node callback stream manager (#4520)
* Implement akka stream proxy for nodecallbacks

Add killswitch to createBitcoindNodeCallbacksForWallet

Add unit test for killswitch in createBitcoindNodeCallbacksForWallet

Add delays to make sure callbacks are executed

Fix rebase

Move killswitch out of methods into class level val

* Bump timeout

* Attempt to implement NodeCallbacks proxy with akka streams

* Refactor CallbackUtil to use NodeCallbackStreamManager

* Rebase & remove killswitch

* Implement NodeCallbackStreamManager.+ method
2022-07-20 06:28:55 -05:00
Shreyansh
2e309086d5
Fix block fetch issue #4513 (#4522)
* fix block fetch issue #4513

* start syncing before rescane
2022-07-19 16:40:36 -05:00
Chris Stewart
5c9092889b
Add abillity to clear callbacks (#4512)
Fix missing clearCallbacks()

Add some tests

Remove uncessary code from test
2022-07-17 09:10:57 -05:00
rorp
e90e372e54
Add sync JSON field to the getinfo endpoint output (#4452)
* Add `sync` JSON field to the `getinfo` endpoint output

* improve test coverage

* update docs

* rename sync flag

* WebSocket notifications

* fix unit tests

* fix unit tests

* increase test timout
2022-07-12 14:41:43 -05:00
Chris Stewart
1b169d8fa0
Implement torstarted websocket callback (#4476)
* Implement tor started websocket callback

* Implement tor callbacks when tor is provided
2022-07-11 10:26:30 -05:00
Shreyansh
7c649d39db
Fix filter sync if headers received while syncing (#4463)
* fix filter sync if headers received while syncing

* remove unintended diffs
2022-07-08 13:44:15 -05:00
Shreyansh
42564bc810
Find and switch peers (#4408)
* add support to find and switch peers

* fix compile on 2.12

* allow empty config peers in regtest

* fix test

* minor fixes

changes timeouts, fix issue with ipv6 dns seeds, initDisconnect when disconnected bug, dbPeers order fix

* fix: not removing peers on initialization timeout

* fix: query again when previous failed

* fix: wrong condition for deferred peers

* restore log levels

* clean up

* add PeerStack to allow trying peers based on priority values

* fix migrations

* changes from comments

* use StartStopAsync

* changes from comments

* fix switch if peer down test

* changes from comments
2022-06-28 10:19:13 -05:00
Chris Stewart
906e1f5c53
Bump previousStableVersion to 1.9.2 (#4432) 2022-06-27 15:22:17 -05:00
Shreyansh
a7ba46f67d
Update hardcoded seeds (#4412)
* update hardcoded seeds

* run tests again
2022-06-22 05:59:43 -05:00
Chris Stewart
7f43ef98ad
Default to suredbits node if peers field is left empty (#4404)
* Default to suredbits node if peers field is left empty

* Remove log
2022-06-18 18:40:53 -05:00
Shreyansh
d8fc8e588f
Remove Spv code (#4356)
* change node tests to neutrino

* get node test working

* merge DataMessageHandlerTest and DataMessageHandlerNeutrinoNodeTest

* delete unused files

* remove commented out spv parts

* formatting

* delete spv node

* remove merkle callback for neutrino node

* remove spv node wallet callbacks

* formatting

* remove SpvWalletApi

* replace SpvTestConfig with NeutrinoTestConfig

* more replace SpvTestConfig with NeutrinoTestConfig

* minor fix

* fix tests
2022-05-30 07:57:31 -05:00
Chris Stewart
b980c432fd
Bump node initialization timeout to 20 seconds (#4328) 2022-05-10 18:02:12 -05:00
Chris Stewart
ce00d3ac36
Segregate handling of Tcp.ErrorClosed command from the rest of Tcp.ConnectionClosed (#4307)
* Segregate handling of Tcp.ErrorClosed command from the rest of Tcp.ConnectionClosed

* Remove old match
2022-05-02 06:27:21 -05:00
Chris Stewart
22051d2550
Bumps user agent to 1.9.1 (#4226)
* Make user agent dynamic based on version number

* Revert to static version
2022-03-30 06:18:33 -05:00
Chris Stewart
b46574c0c4
2022 02 18 sync since creationtime pt2 (#4109)
* Get things compiling and tests passing

* Fix bug where we weren't using filter height correctly

* Fix docs

* Move creationTime into KeyManagerAppConfig

* Fix nodeTest/test test fixtures
2022-02-22 08:00:14 -06:00
benthecarman
142612f034
Make newConfigOfType use Vector[Config] (#4039) 2022-02-04 06:14:16 -06:00
Chris Stewart
98c5d816ac
2022 01 25 issue 4014 (#4015)
* Refactor testkit tests to use same nodeCallbacks that BitcoinSServerMain uses for neutrino

* Add test case

* Add logs for callbacks

* Cleanup

* Add test case for when funds are spent when we are offline

* Turn off logging again

* Cleanup more logs and comments
2022-01-26 13:16:15 -06:00
Chris Stewart
e802254a20
2022 01 24 rm appconfig varargs (#4011)
* Get things compiling

* Get tests passing

* Fix docs
2022-01-25 07:25:05 -06:00
Shreyansh
a58ef1cd02
Storing peers in database (#3773)
* rebase

* fix

* fix

* remove unwanted diffs

* fix

* formatting

* changes from comments

* Revert "changes from comments"

This reverts commit eb8a795718dc590802a19c7ce4cce4501bd2de1f.

* changes from comments

* add PeerManager

* add sha3-256

* add NetworkUtilTest

* formatting
2022-01-09 07:21:59 -06:00
rorp
4b07629d56
Add getmediantimepast RPC call (#3921)
* Add `getmediantimepast` RPC call

* update docs

* respond to the PR comments
2021-12-22 16:15:30 -06:00
Chris Stewart
f71d3567ed
2021 11 23 crud action (#3851)
* WIP

* Finish implementing {CRUD,CRUDAction}.createAllAction()

* Try to make database inserts more atomic

* Consolidate more database calls in DLCWallet.initDLCForAccept()

* WIP2

* More refactor and using actions

* Add DLCIdDaoUtilNoPK for querying when dlcId is not a primary key

* Add DLCDataManagement.deleteDLC()

* make DLCWalletApi.createDLCOffer() use actions

* Rework DLCWallet.createNewDLCAccept() to use DBIOAction

* Use actions in DLCWallet.registerDLCAccept() a bit

* Create DLCActionBuilder, move actions to there

* Move more actions into ActionBuilder

* Implement transactionally on database writes for actions
2021-11-30 12:38:55 -06:00
benthecarman
90e01d7fc6
Fix broadcasting witness vs legacy txs (#3841)
* Fix broadcasting witness vs legacy txs

* Fix version test
2021-11-22 07:25:58 -06:00
benthecarman
9701769125
Handle TypeIdentifier.MsgWitnessTx messages (#3836) 2021-11-19 06:56:53 -06:00
benthecarman
fc09f41db2
Request witness versions of transactions from nodes (#3829) 2021-11-16 13:17:54 -06:00
rorp
e02c9bba12
Overridable Tor config (#3780) 2021-10-27 12:57:10 -05:00
Chris Stewart
be07786171
Update website to 1.8 and bump various versions on README and node agent version (#3762) 2021-10-17 12:24:30 -05:00
Shreyansh
99107b61ea
Add PeerDAO (#3738)
* add PeerDAO

* update DbManagementTest expected migration count
2021-10-10 07:50:11 -05:00
Shreyansh
ebdf1e2382
add ControlMessageHandler (#3732) 2021-10-08 16:34:33 -05:00
Chris Stewart
781e77844f
Implement ability to get proper version of BitcoindRpcClient from BitcoindRpcApConfig.clientF (#3699) 2021-09-29 06:43:15 -05:00
Chris Stewart
db46e35172
Fix case where we forget to correctly assign currentPeerMsgHandlerRecv (#3662)
* Fix case where we forget to correctly assign currentPeerMsgHandlerRecv when we disconnect

* Make handleNodeCommand() so we handle P2PClient.CloseCommand

* Enable DEBUG logging to see what is happening on CI

* Add PeerMessageReceiverTest

* Add InitializeDisconnectDone

* Bump timeout on condition
2021-09-14 06:38:38 -05:00
Chris Stewart
0746b14331
Move BitcoindRpcAppConfig into the bitcoind-rpc project (#3610) 2021-08-27 06:43:31 -05:00
rorp
704b02ae6c
Use random ports for pre-packaged Tor daemon (#3604)
* Use random ports for pre-packaged Tor daemon

* fix unit tests

* configurable random ports

* shutdown hook
2021-08-26 13:02:49 -05:00
rorp
4ef1e6bcb6
CI fixes (#3597)
* CI fixes

* fix workflow names

* cleanup unused code

* fix ServerRunTest

* change number attempts to start Node
2021-08-25 15:07:27 -05:00
Chris Stewart
ac8bdb120c
Implement PeerMessageReceiverState.InitializedDisconnect. This allows us to distinguish between disconnections we initalized and connections the peer intialized. This is needed for determining whether we should reconnect or not (#3583) 2021-08-21 17:04:50 -05:00
rorp
54ce2ebeb2
P2P reconnect logic (#3572)
* P2P reconnect logic

* some fixes

* more changes

* fix DuplicateFilters exception in case of  disconnect in the middle of syncing filters

* more fixes

* Repurpose maxconnections test to be just a generic reconnection test

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-08-20 05:51:51 -05:00
Chris Stewart
114fbf35fe
Update version, userAgent for bitcoin-s (#3565) 2021-08-18 06:50:04 -05:00
Chris Stewart
037ab7341e
Reduce logs for inv messages and wallet callbacks to DEBUG (#3524) 2021-08-11 11:13:04 -05:00
rorp
3d4cf1fc91
Tor support for all sub-projects (#3506) 2021-08-10 08:07:12 -05:00
benthecarman
8979ac2932
Don't use tor proxy for localhost connections (#3500) 2021-08-07 14:36:33 -05:00
Chris Stewart
4f7b6422ea
2021 08 06 app config refacotr (#3498)
* Move AppConfig into app-commons, reduce classpath deps on keyManager,tor

* Move test ServerArgParserTest

* Fix compile error
2021-08-07 14:36:11 -05:00
benthecarman
b39ca47268
Create TorAppConfig (#3476) 2021-08-04 14:16:22 -05:00
rorp
ca40af5d94
Tor support for BTC RPC (#3470)
* Tor support for BTC RPC

* change config format
2021-08-03 11:07:05 -05:00
benthecarman
1051e6365a
DLC P2P Client (#3402)
* DLC P2P WIP

* P2PClient refactor (#10)

* Add to CI

* Remove unused

* Attempt to create DLCNode and Tests

* Full Tor support

* Get DLCNegotiationTest passing

* Config options, connect & send func

* Test for DLCNode

* Add createDLCNode to config

* Fix formatting

* Update DLC state after all other data is set

* Remove unneeded line

* Respond to some review

* 2021 07 26 dlc node code review (#13)

* WIP

* WIP2

* Rewrite tests not use Await.result()

* Skip Tor test on CI

* Cleanup threadpool leaks in tests

* Handle actor pattern matching better

* Respond to review

* Implement DLCNode.stop

* sock5 -> socks5

* Use Tcp.Unbind

* Respond to review

* Implement postStop

* Switch to unbind

Co-authored-by: rorp <rorp@users.noreply.github.com>
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-08-02 18:15:56 -05:00
Shreyansh
1426c31483
Multi peer: Sync with random peer (#3454)
* ensure random peer used for sync supports compact filters

* test file

* fix

* refactor

* rerun ci

* rerun ci

* changes from comments

* fix

* fix tests

* changes from comments

* refactor

* remove unintended diffs
2021-07-31 07:54:31 -05:00
Shreyansh
85975b8b07
complete handshake with peers (#3446)
fix
2021-07-25 11:11:01 -05:00
Shreyansh
4be2b2109b
[WIP] Adding multi-peer support (#3401)
* establish conn with multiple peers

squash 1

squash 2

squash 3

* add tests

* change log msg level

* minor changes

* fix

* formatting

* fix docs

* commit to rerun ci

* changes from comments

* fix bug

* rerun ci
2021-07-21 15:18:45 -05:00
Shruthii RG
1c6d728197
Made relay flag in version message configurable (#3416)
* relay flag in version message made configurable

* modified test classes as well

* Update configuration.md

* reverted few files and cleaned up format

* fixed mistake
2021-07-19 09:59:43 -05:00
rorp
8b663d91b6
Tor support for P2P (#3311)
* Tor support for P2P

* fix stuck connections

* unit tests

* docs

* update docs

* respond to the PR comments

* fix docs
2021-07-13 14:27:24 -05:00
benthecarman
45233be22d
Update user agent (#3384)
* Update user agent

* update prev version
2021-07-09 06:54:10 -05:00
Chris Stewart
639043227c
Add logs to make it more apparent that No Common Ancestors isn't necessarily bad (#3354)
* Add logs to make it more apparent that No Common Ancestors isn't necessarily a bad thing

* Switch No common ancestor log message to DEBUG
2021-06-30 09:58:43 -05:00
Chris Stewart
7ba7f8b9ba
Try to add block generate to address in fixture setup to get around compact filter sync edge case (#3231)
* Try to add block generate to address in fixture setup to get around the case where block headers & filter headers are synced but compact filters are not

* Push to github to force re-run of CI 2

* Add ChainApi.getBestFilter(), use it in sync to determine if filter headers & filters are in sync

* Push to github to force re-run of CI 3

* Simplify getBestFilter, add unit test

* Add more comments, clean up some code
2021-06-08 12:47:28 -05:00
Chris Stewart
41e22b3cbc
2021 05 23 Sync race condition (#3129)
* Give working code for example on issue

* Fix race condition where both NeutrinoNode.sync() and our data message handler would request the same set of compact filters causing database errors for uniquness violations
2021-05-24 12:30:13 -05:00
Chris Stewart
a104787985
Fix Node.sync() bug that was caused by not starting filter header sync from the current best filter headers block hash (#3092) 2021-05-17 06:04:04 -05:00
benthecarman
e3017fd17d Peer Message Receiver Refactor (#2938) 2021-04-27 15:54:44 -05:00
Chris Stewart
16538980e3 Fix missing super.stop() to shutdown DbAppConfig db connection pool (#2943)
* Fix missing super.stop() to shutdown DbAppConfig db connection pool inside of all DbAppConfig subclasses that override stop()

* Fix import

* Remove implicit modifier to NodeUnitTest.getFreshConfig(), make sure we are shutting down chainAppConfig inside NodeUnitTest

* Remove chainTest subclasses implementing ActorSystem, make sure we do correct cleanup in ChainUnitTest

* Decouple CachedChainAppConfig & CachedAppConfig. When using only one sub module in the CachedAppConfig, teardown may fail as the other modules might not be started such as using chainAppConfig in chainTest, BitcoinSAppConfig.stop() requires us to call nodAppConfig.stop() first, which isn't started.

* Push to github to force re-run of CI 4
2021-04-23 08:21:56 -05:00
benthecarman
d0629486ab Wallet Rebroadcast Transactions thread (#2711)
* Wallet Rebroadcast Logic

* Use wallet scheduler for address queue rather than it's own thread

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>

* Bump default

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-04-07 08:13:43 -05:00
benthecarman
fa80f36d2f Get all of Core working with JS (#2826)
* core-test-js-json

* Add SigPointComputer cross compile
Co-authored-by: Nadav Kohen <nadavk25@gmail.com>

* Fix java.time for scalajs

* InetAddress for scalajs

* Fix linking errors in coreTestJS

* Easy fixes

* InetAddress Tests

* Update micropickle, fix exact functions

* Get BigSizeUIntTest working with upickle

* Fix exact funcs

* Update Base58Test with upickle

* Update ScriptSignatureTest with upickle

* Update TransactionTest with upickle

* Update BlockFilterTest with upickle

* Update ScriptInterpreterTest with upickle

* Update MnemonicCodeTest with upickle

* Add InetAddress unit tests

* Fix compile errors

* Get core tests running, not passing

* Sign with js

* Fix PSBTUnitTest

* Fix PBKDF2 for JS

* Use bcrypto's secp256k1 instead of ecdsa

* Fix 2.12.12 compile

* Core tests passing :)

* Test corejs
2021-03-31 15:04:30 -05:00
benthecarman
07514e2348 Remove logging from core (#2810)
* Remove logging from core

* Remove slf4j from testkit core

* Remove logback from coretest
2021-03-21 19:11:55 -05:00
Chris Stewart
7764828b3a Bump timeout on bind to avoid spurious ci failures hopefully (#2791)
* Bump timeout on bind to avoid spurious ci failures hopefully

* Actually pass the timeout

* Bump to 30 seconds
2021-03-11 12:24:28 -06:00
Chris Stewart
7a068ac036 2021 02 25 async utils (#2725)
* Refactor AsyncUtil to just use an execution context rather than an actor system

* Create async util project, use it in various projects that depend on it
2021-02-25 13:26:38 -06:00
Aris
85087b0f70 Refactoring chain (#2662) 2021-02-13 14:10:40 -06:00
Aris
f8694eb097 Fix/typos (#2633)
* Fix typos

* Collection minor fixes

Removes redundant .headOption on options
Replaces .exists(_ == ???) with .contains(???)
Replaces option == None with option.isEmpty
2021-02-07 15:00:25 -06:00
Chris Stewart
8f958bf5d9 Update scalafmt (#2619) 2021-02-03 16:37:12 -06:00
benthecarman
03ca6f617e Optimize filter sync and fetching filter heights (#2568) 2021-01-30 14:56:47 -06:00
benthecarman
ff6b85d195 Ignore block messages while syncing (#2587) 2021-01-29 09:28:57 -06:00
Chris Stewart
756bfc4427 2021 01 27 conectionpool (#2578)
* Give connection pool example config

* Get hikari logging working on postgres

* fix 2.12.x

* Bump metrics core to a supported version

* Add hikari-logging and hikari-logging-interval configuration options to turn off/on hikari and schedule how often logs appear

* Turn off hikari logging in the db-commons/reference.conf and add it to appserver/reference.conf

* default the logging to off in scala code

* Make sure connection pool is enabled in db-commons, add default database configuration to website

* Address code review, fix things that didn't need to be changed
2021-01-28 09:44:03 -06:00
benthecarman
29bde74cb8 Fix all DAOs to use safeDatabase (#2556) 2021-01-22 16:13:45 -06:00
benthecarman
e10e278aa4 Add walletinfo rpc (#2546)
* Add walletinfo rpc

* Move rootXpub to key manager obj

* Make configuration keys for getinfo the same as the ones in our configuration files

* Cleanup

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-01-22 13:55:21 -06:00
benthecarman
0d07d558c4 Optimize node.start() and fetching filter & filter header heights (#2554)
* Make node.start() more async

* Add missing filter indexes

* Move queries to vals
2021-01-22 10:38:32 -06:00
benthecarman
03e36d5fa2 Recover errors in DataMessageHandler (#2460) 2021-01-10 12:17:51 -06:00
Chris Stewart
68af9760b3 Clean up fixture shutdown code a bit to try and see if this resolves … (#2498)
* Clean up fixture shutdown code a bit to try and see if this resolves issue on CI

* Rework fixtures so we aren't starting app configs in multiple places

* Fix scaladoc
2021-01-09 17:07:26 -06:00
Chris Stewart
98ace6f14e 2021 01 02 issue 2457 (#2461)
* WIP

* Get neutrino node with wallet 'receive information about received payments' working again

* Fix compile

* Remove initial sync logic from test case

* Remove sync logic in NeutrinoNodeWithWallet test cases

* Improve logging and rename a few things

* WIP2

* WIP3

* Get NeutrinoNodeWithWallet tests working

* Implement WalletSync, which allows you to sync a wallet from a arbitrary data source

* Get all tests passing again

* Use spv.appConfig in DataMessageHandlerTest rather than caching the config

* Modify cleanup to hopefully get CI passing

* Fix postgres tests by cleaning the table during the destroy phase of the test fixture. This is needed because the same postgres database is shared between tests in the same test suite

* Revert logback-test.xml

* Get sqlite/postgres tests passing pt 2

* syncHeight -> syncDescriptorOpt()

* Add case for genesis block hash in WalletSync

* Fix SpvNodeWithWallet test case to actually test spv functionality

* Remove nodeCallbacks parameters, callbacks should be registered on nodeAppConfig
2021-01-09 09:33:37 -06:00
benthecarman
46c73970ff Remove callbacks param from DataMessageHandler & PeerMessageReceiver (#2476) 2021-01-06 13:23:47 -06:00
benthecarman
ab55f5163f Request filters after processing (#2463) 2021-01-04 06:37:48 -06:00
Chris Stewart
4e1a6c69f0 2020 12 18 enable lint options (#2454)
* Enable -Xlint:adapted-args,nullary-unit on our for compile scope

* Add Xlint:infer-any compiler option

* Fix build so test compiler options are actually enabled

* Enable more scalac linting options

* Add '-Xlint:eta-sam'

* Add 'Xlint:inaccessible,Xlint:missing-interpolator'
2021-01-03 08:01:26 -06:00
Ben Carman
8912fcbc82 Fail broadcasting transaction when disconnected (#2336)
* Fail broadcasting transaction when disconnected

* Wait until disconnected

* Move test

* Move to separate file

* Attempt fix

* Make test never have a peer

* Improve reliablity
2020-12-17 13:28:32 -06:00
Ben Carman
1225584526 Multi Wallet support (#2345)
* Multi Wallet support

* Fix Oracle tests

* Fix some CI errors

* Increase KeyManagerAppConfig code coverage

* Add test for multiple seeds in seed folder

* Move things in reference.conf files

* Lower key manager coverage requirement

* Fix postgres test issues

* Create DbAppConfig

* Add some docs, fix hardcoded postgres db name

* Clarify db vs schema

* Add character types

* Fix chaindb in conf

* Always copy default seed

* Remove need for driverName config
2020-12-16 17:27:56 -06:00
Ben Carman
9291d6ec3a Fix P2PClient parsing unknown messages (#2315)
* Fix P2PClient parsing unknown messages

* Use Vector, calculate correct checksum
2020-12-06 13:49:30 -06:00
Ben Carman
8cdddfecde Implement BIP 155 addrv2 messages (#2321)
* Implement BIP 155 addrv2 messages

* Add unit tests
2020-12-06 08:07:57 -06:00
Ben Carman
197367dc33 Request witness blocks from peers (#2289) 2020-11-23 22:08:03 -06:00
Chris Stewart
66ec96b1f5 2020 11 13 issue 2258 (#2260)
* Introduce ChainHandlerCached which behaves like the old ChainHandler. Now Chainhandler.getBestBlockHeader() will read headers from the database

* Remove ChainHandler.blockchains field, now it's only available in ChainHandlerCached

* De-futurify ChainHandler.fromDatabase()

* Adjust logging

* Patch test case

* Use BlockHeaderDAO.chainTips when getting best header rather thean BlockHeaderDAO.getBlockchains(). Implement a helper method ChainHandler.toChainHandlerCached()

* Fix chain.md,wallet.md

* Make ChainHandler.getBestBlockHeader() consider time of header if chainwork is the same. Make test cases less strict on what header is the best header when both chainwork and time are the same on the eader

* Only execute callbacks on headers that are going to be created in the database, not all headers passed into ChainHandler.processHeadersWithChains()

* Turn up log level again

* Small optimizations, check if we have seen a header before before processing it in ChainHandler.processHeadersWithChains(). Fix FilterSyncMarker.toString(). Use ChainHandlerCached in Node

* Remove ChainHandlerCached in appServer, re-add it in Node.scala
2020-11-17 06:19:07 -06:00
Chris Stewart
581d46c2c8 2020 11 02 cleanup (#2233)
* Cleanup a bunch of imports in test

* Use @nowarn annotation for testing things that are deprecated

* Fix base58 test

* Cleanup crypto-test

* Use scala collection compat dependency to get access to the @nowarn annotation on scala 2.12.x

* Rework more scala 2.13.x compile failures in chain-test and key-manager-test

* Optimize imports for entire project

* Fix nits
2020-11-03 11:07:04 -06:00
Chris Stewart
ade2503702 2020 10 05 redo config (#2121)
* Use absolute paths for resolving configurations

Make log level OFF again

WIP: Move resolution of config into AppConfig.start(), things are totally broken

WIP: Make AppConfig.config private

Get all tests passing again but using absolute path in configuration

* Cherry-pick onto master

* Fix BitcoinSAppConfig configuration keys to use the full path

* Apply code review

* Fix log, move invariant for requiredConfirmations back into the lazy val

* Fix DlcOracleAppConfig to use absolute path
2020-10-05 18:00:30 -05:00
Chris Stewart
9b09b04230 Upgrade to scalac 2.13.3 (#2115) 2020-10-04 07:42:44 -05:00
Ben Carman
6bd12f1f19 Bitcoind backend on server start up (#2088) 2020-10-02 10:33:24 -05:00
Ben Carman
f19cba90d3 Bump user agent to new version (#2055) 2020-09-24 13:27:10 -05:00
Ben Carman
795d62c041 Change requesting filters log to use big endian hashes (#2048) 2020-09-23 12:02:34 -05:00
Ben Carman
1e3aee55c3 Merge pull request #2019
* Refactor logging to only use grizzled slf4j

* Fix docs

* test travis config change
2020-09-19 14:09:12 -05:00
Chris Stewart
76b9577181 Introduce 'FilterSyncMarker' to ChainApi, make it clearier what exact… (#2003)
* Introduce 'FilterSyncMarker' to ChainApi, make it clearier what exactly the (Int,DoubleSha256Digest) tuple is returned from ChainApi.nextBlockHeaderRange()

* Fix doc

* Add scaladoc to FilterSyncMarker

* Rebase onto master, fix conflicts to use FilterSyncMarker
2020-09-11 13:48:40 -05:00
Chris Stewart
2980e3fc01 Resolve issues with reorgs and syncing filters (#1969)
* Pull over test cases, WIP

* Rework ChainHandler.nextBlockHeaderRange() to use hashes rather than heights to very integrity of header chain, add test case

* Modify test case to make sure we are generating the 'heaviest chain work' header as first in the tuple that is used in reorg test cases

* Refactor to helper method called 'findNextHeader()' to make things simpler

* Add scaladoc to ChainHandler.findNextHeader()

* WIP

* Fix bugs in ChainApi.nextBlockHeaderRange(), now return (startHeight,stopHash) rather than (stopHeight,stopHash)

* Get chain handler tests passing, remove genesis filter header/fitler from default chain project fixture, make it a specialized one to have genesis filter header/filter in the database. Use that specialized fixture in ChainHandlerTest for now

* FilterSync work without having the genesis filter and filter header inserted into the database

* fix bug in DataMessageHandler where we were using sendNextGetCompactFilterHeadersCommand rather than using peerMsgSender.sendGetCompactFilterHeadersMessage

* Refactor ChainHandler.findNextHeader() to centralize where chains are fetched

* Address ben's code review
2020-09-11 12:41:25 -05:00
Chris Stewart
39ef35b9ee Rename parameter names from 'duration' -> 'interval' just like our ActorSystem.schedule() names the parameter (#2005) 2020-09-11 11:10:59 -05:00
rorp
c62be8b5f6 Update callbacks for LN support (#1938)
Update callbacks for LN support
2020-09-09 11:02:31 -07:00
Chris Stewart
98236835a5 Rename ChainApi.nextHeaderBatchRange -> ChainApi.nextBlockHeaderBatchrnage (#1957) 2020-09-02 13:19:20 -05:00
Chris Stewart
e7993890cb Make sure both filter ehaders and filters are empty before sending fi… (#1936)
* Make sure both filter ehaders and filters are empty before sending first filterheader sync message

* Address nit
2020-08-31 06:32:01 -05:00
Chris Stewart
d3af9c2ccb Implement getBestFilterHeader based on a number of block headers that… (#1926)
* Implement getBestFilterHeader based on a number of block headers that can be passed in as a parameter. These headers can be used to indicate what your current best chain is

* Bring back compiler opts

* Fix compiler error for maxByOption as it isn't in the 2.12 std library

* Implement a context free best filter headers search. The basic strategy is to look at headers in the _future_ of our current best filter header

* Fix bug in sql query were we were doing max chainWork too early on block headers, we needed to filter out headers in our set and _then_ we get the max chain work

* Add more unit tests
2020-08-29 08:13:38 -05:00
Ben Carman
ef4329d283 Warn if peer does not support services we need (#1921) 2020-08-27 13:57:58 -05:00
Chris Stewart
13fbb3f889 Improve logging in DataMessageHandler (#1922)
* Improve logging in DataMessageHandler

* Make hashes in logs big endian

* One more big endian conversion i forgot
2020-08-27 12:39:45 -05:00
Chris Stewart
3ab280a12b Remove AppConfig.initialize() in favor of AppConfig.start() (#1907)
* Remove AppConfig.initialize() in favor of AppConfig.start()

* Fix docs
2020-08-26 16:24:38 -05:00
rorp
23685f124e Add an ability to one Postgres database for all sub-projects (#1897)
* Add an ability to one Postgres database for all sub-projects
2020-08-26 12:20:18 -07:00