Commit Graph

336 Commits

Author SHA1 Message Date
Chris Stewart
44190a535c
Defensively try to sync everytime a peer is a initialized (#5154)
* Defensively try to sync everytime a peer is a initialized

* Turn logging OFF

* Fix DataMessagehandlerTest, remove calls to NeutrinoNode.sync() in test fixtures
2023-07-19 09:43:23 -05:00
Chris Stewart
f034435430
Move setSyncing into PeerManager.syncHelper() (#5153) 2023-07-18 15:23:01 -05:00
Chris Stewart
e66c078863
First attempt at implementing inactivityChecks() (#5144)
* First attempt at implementing inactivityChecks()

* Move lastParsedMessage logic into PeerMessageSender

* Add bitcoin-s.node.inactivity-timeout config option

* implement unit test

* Fix CommonSettings

* scalafmt

* scalafmt

* Rename lastSuccessfulParsedMsg -> lastSuccessfulParsedMsgOpt

* make sure we disconnect in the case the stream terminates with an error

* Reduce log level
2023-07-16 16:03:16 -05:00
Chris Stewart
4bd5616e67
Make sure PeerData.stop() is called when PeerFinder.removePeer() is called (#5147)
* Make sure PeerData.stop() is called  when PeerFinder.removePeer() is called

* Fix log, add a new log
2023-07-15 09:22:14 -05:00
Chris Stewart
ebe79287af
Implement socks5 proxy in PeerMessageSender (#5136)
* WIP: Implement socks5 proxy in PeerMessageSender

* Get something working

* Refactor to use Either when passing a socks5 message or non socks5 ByteString downstream

* Socks5Message -> Socks5MessageResponse

* Revert things

* More cleanup

* Fix rebase

* Move socks5Handler() Flow into Socks5Connection

* Revert NeutrinoNode

* Implement auth for socks5 proxy in stream

* Cleanups
2023-07-10 06:56:15 -05:00
Chris Stewart
b1e6488bb7
Move Socks5ProxyParams, Credentials into core (#5138) 2023-07-08 13:57:44 -05:00
Chris Stewart
ee619051a3
2023 07 04 node refactors (#5130)
* Make PeerData.peerMessageSender not wrapped in Future

* Remove peerMessageSenderApi param

* Small cleanups

* Rename DataMessageHandlerState -> NodeState

* Cleanups in DataMessageHandler

* Refactor StreamDataMessageWrapper -> NodeStreamMessage

* More small fixes

* Make handleDataPayload() take PeerData rather than Peer

* Move peers into NodeState and remove as param in DataMessageHandler

* replacePeers whenever PeerManager.{onP2PClientDisconnected,onInitialization} is called

* rework ValidatingHeaders.toString()

* Empty commit to run CI
2023-07-07 08:11:39 -05:00
Chris Stewart
9b6bca06c0
Fix duplicate filter header sync by adding delay before attempting to sync filter headers (#5132)
* Fix duplicate filter header sync by adding delay before attempting to sync filter headers

* Fix bug where we don't wait for AsyncUtil.nonBlockingSleep()
2023-07-06 12:05:14 -05:00
Chris Stewart
fc99087c89
Ignore messages in queue that were queued before we disconnected peer (#5131) 2023-07-05 15:31:27 -05:00
Chris Stewart
f522ffec72
2023 06 28 connection fail logs (#5121)
* Rework logs for the case where our tcp connection fails. This makes the logs simpler

* Revert initialDelay

* Remove redundant setting
2023-06-29 09:01:53 -05:00
Chris Stewart
6befad2dd3
Remove offer(SendToPeer) from PeerManager queue (#5119)
* Remove offer(SendToPeer) from PeerManager queue

* scalafmt

* Remove comments
2023-06-28 07:58:34 -05:00
Chris Stewart
08a76fb040
Fix bug in DataMessageHandler.isFiltersSynced() (#5118)
* Fix bug in DataMessageHandler.isFiltersSynced()

* Try alternative implementation to fix bug

* Fix valid states for CompactFilterMessage, revert PeerFinder delay
2023-06-27 14:24:26 -05:00
Chris Stewart
1d82ed04a7
2023 06 18 implement tcp connection using akka streams (#5111)
* WIP: Try to move byte streaming/parsing of p2p messages out of P2PClient

* WIP2: Work on killing the actor, replace it with a steram

* Get basic ability to send/receive version message working

* Transition PeerMessageReceiverState to Initializing inside of PeerMessagesender.connect()

* Refactor things out of PeerMessageSender.connect(), add some flow logs

* Get NeutrinoNodeTest be able to sync passing

* Fix some bugs, create ConnectionGraph helper class

* Use killswitch rather than Source.maybe to disconnect peer

* WIP: Debug

* Switch halfClose to false on Tcp.outgoingConnection() to not keep lingering connections

* Delete P2PClientActorTest

* Delete all P2PClient stuff

* Attempt implementing reconnection logic in PeerMessageSender

* remove supervisor

* Empty commit to re-run CI

* Small cleanups

* Implement sendResponseTimeout()

* Restore logback-test.xml

* Add callback to log error message on reconnect

* Increase queueSize/maxConcurrentOffers size
2023-06-24 07:53:44 -05:00
Chris Stewart
5ae4993bed
Move PeerMessageReceiverState into PeerMessageReceiver (#5110)
* Move PeerMessageReceiverState into PeerMessageReceiver

* Delete PeerMessageReceiverTest
2023-06-19 15:04:35 -05:00
Chris Stewart
e0c9500770
Reduce p2pclient timeout to 10 seconds (#5109) 2023-06-17 08:00:29 -05:00
Chris Stewart
c3eed1e92b
2023 05 05 Make DataMessageHandler be accummulated in our akka stream (#5098)
* WIP

* WIP2

* Rebase with P2PClientCallbacks

* scalafmt

* Rework stream materialization in PeerManager to have DataMessageHandler encapsulated in the stream

* WIP: Fix compile

* Get everything compiling, ignore Uncached tests for now

* Increase queue size

* WIP: Make queue re-usable based on PeerManager.{start()/stop()}

* Get things compiling after rebase

* Try to handle case where we have SendToPeer in queue with peer that has been disconnected

* Empty commit to re-run CI

* Add sleep to let version/verack handshake complete in P2PClientActorTest

* Empty commit to re-run CI

* Reduce usage of bitcoind in P2PClientActorTest from 3 bitcoinds -> 2 bitcoinds

* Add error message to PeerFinder.stop() so we know what peer was not getting removed

* Cleanup error message

* Fix scalafmt, add state to log message

* Fix bug PeerMessageReceiverState.stopReconnect() which didn't send DisconnectedPeer() to queue

* Empty commit to re-run CI

* Empty commit to re-run CI

* Reduce log level of onP2PClientDisconnected

* Empty commit to re-run CI

* Small cleanup

* scalafmt

* Get new reference to ChainHandler in more places node.syncFromNewPeer() is called

* Fix rebase

* Commit to run on CI

* Empty commit to run CI

* Empty commit to run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Try to reproduce with logs on CI

* Empty commit to re-run CI

* WIP

* Rework onP2PClientDisconnected to return new DataMessagehandlerState

* Save comment about bug

* Add a helper method switchSyncToPeer to take into account the previous DataMessagehandlerState if we need to start a new sync because of disconnection

* Empty commit to re-run CI

* Empty commit to re-run CI

* Cleanup

* Fix case where we weren't sending getheaders to new peer when old peer was disconnected when in state DoneSyncing

* Revert logback-test.xml

* remove comment

* Try using syncHelper() rather than getHeaderSyncHelper() to make sure we sync filters as well if needed

* Re-add log

* Fix bug where we weren't starting to sync filter headers

* Tighten dmhState type to SyncDataMessageHandler on syncFilters(), clean up uncessary code

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-06-16 08:08:11 -05:00
Chris Stewart
dae8c0fc9c
Don't execute onResponseTimeout() when disconnecting (#5104) 2023-06-14 15:49:20 -05:00
Chris Stewart
f4f45a1cad
Move {syncFromNewPeer(), syncHelper()} into PeerManager, remove reference to Node inside of PeerManager (#5102)
* Move {syncFromNewPeer(), syncHelper()} into PeerManager, remove reference to Node inside of PeerManager

* Empty commit to re-run CI
2023-06-13 14:18:22 -05:00
Chris Stewart
bed670fb6f
Remove chainApi parameter from NeutrinoNode (#5101)
* Remove chainApi parameter from NeutrinoNode

* Fix doc
2023-06-13 12:07:04 -05:00
Chris Stewart
e3f8eb2cc6
Add PeerMessageSenderApi.gossipGetHeadersMessage(), use it in Node.sync() (#5100)
* Add PeerMessageSenderApi.gossipGetHeadersMessage(), use it in Node.sync()

* Rework invalid headers test case to not need to reach into internals of akka stream

* Rework re-query headers test case to not need to reach into internals of akka stream

* Rework switch peers test case to not need to reach into internals of akka stream

* Use peerManager.offer() rather than reaching into DataMessageHandler to send messages to stream

* use gossipGetHeadersMessage() after getting done with IBD to query all peers instead of just one

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-06-09 15:34:29 -05:00
Chris Stewart
a5778948cb
Remove downloadBlocksBasedOnIBD() as it is redundant (#5099) 2023-06-08 16:10:04 -05:00
Chris Stewart
ae8c97a4d1
Rework Node.sync() to return Future[Peer] rather than Future[Option[Peer]] (#5096) 2023-06-08 10:30:26 -05:00
Chris Stewart
ebe98959ed
Upgrade to scalac 2.13.11 (#5097)
* Upgrade to scalac 2.13.11

* Fix compile issues with scalac 2.13.11
2023-06-08 10:27:39 -05:00
Chris Stewart
295be36d63
Get PeerMessageSenderApi using akka streams for outbound p2p messages (#5069)
* Get PeerMessageSenderApi using akka streams for outbound p2p messages

* Use offer method rather than accessing queue directly

* Fix flaky unit test

* Empty commit to re-run CI

* Move methods for requesting filterheaders/filters into PeerManager, now use akka stream for those outbound p2p message

* Move sendInventoryMessage to PeerManager

* Move sendGetHeadersMessage() methods to PeerManager

* WIP: move more methods to PeerMessageSenderApi

* WIP2

* initialize stream before calling PeerFinder.start() so oubound messages get processed

* Rebase

* Make queue buffer size dependent on maxConnectedPeers

* Change state to HeaderSync() if we are re-querying for block headers

* Empty commit to re-run CI

* Remove PeerMessageSender from handleDataPayload()

* Limit access to PeerManager.peerMessageSenders

* revert a few things

* Fix rebase issues

* Fix rebase

* Turn down logging

* Rebase

* remove guard that checks peer size before labeling as MisBehavingPeer

* Fix small bug where we needed to switch syncPeer and we weren't

* Empty commit to run CI

* Empty commit to re-run CI

* Fix test case where we weren't awaiting for Node.sync() to return Some(peer)

* Empty commit to re-run CI

* Fix another reference where we were calling Node.sync() too soon after Node.start()

* scalafmt

* Add another retryUntilSatisfied() on NeutrinoNode.sync()
2023-06-08 08:47:24 -05:00
Chris Stewart
abeaaa05de
Remove awaitPeerWithServices() (#5093)
* Remove awaitPeerWithServices()

* Empty commit to run CI

* Rework Node.sync() to return Future[Option[Peer]] rather than Future[Unit]. This returns the peer we are syncing with, if we could find one to sync with

* Turn logging OFF again

* Empty commit to re-run CI

* Use AsyncUtil.retryUntilSatisfied() when calling node.sync() after starting node to make sure we have a peer to sync from in a test case

* Await on re-started node not stale reference in NeutrinoNodeWithWalletTest

* Fix second reference

* Empty commit to re-run CI
2023-06-07 04:47:39 -05:00
Chris Stewart
e74af8bf24
Move P2PClientCallbacks.onStop() into disconnection logic rather than Actor.postStop() (#5089)
* Move P2PClientCallbacks.onStop() into disconnection logic rather than Actor.postStop()

* Rename onStop -> onDisconnect

* Add reconnect flag to P2PCallbacks.onDisconnect so we don't attempt to reconnect when not necessary

* Rename flag to forceReconnect, check getPeerConnectionCount in PeerManager.onP2PClientDisconnect to see if we have 0 connections. If we do reconnect

* Add PeerManager.isStarted flag, guard reconnection logic with this flag in onP2PClientDisconnected()

* Clear PeerFinder._peerData when PeerFinder.stop() is called

* WIP: Move disconnection logic into stream

* Rework ordering of PeerManager.stop() to shutdown queue after peers are removed

* Empty commit to re-run CI

* Await for getConnectionCount async in test case

* Try increasing queue size

* Bump queue size to 16

* Put initialization, initialization timeout logic in queue rather than callbacks

* Make messages that are sent to the queue rather than callbacks for various control messages

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Remove P2PCallbacks all together

* Re-add PeerMessageReceiverTest
2023-06-05 10:39:02 -05:00
Chris Stewart
61e142a631
2023 05 29 peermanager peerfinder refactor (#5086)
* WIP

* Reset PeerManager.dataMessageHandler to None on PeerManager.stop()

* WIP2

* Always set dataMessageHandler.peerData we process a new message in the stream

* remove PeerManager from PeerDatta

* Make PeerFinder mutable inside of PeerManager, pass the queue into PeerFinder to decouple PeerManager and PeerFinder

* Don't verify actor system shutdown for now
2023-05-31 13:35:46 -05:00
Chris Stewart
6c38a791d7
Drain data message stream before PeerManager.stop() is complete (#5085)
* Drain data message stream before PeerManager.stop() is complete

* Try to fix race condition where peers.length gets mutated as peers get disconnected

* Adjust logic to check if we have a _new_ peer, not a specific peer count

* rework PeerManager.stop() ordering

* Rework PeerFinder.stop() to use Future.traverse()
2023-05-30 13:57:19 -05:00
Chris Stewart
9202e63c90
Create P2PClientCallbacks to encapsulate callbacks (#5084) 2023-05-30 07:40:52 -05:00
Chris Stewart
34df4ccbb1
Make ControlMessageHandler take PeerManager rather than Node as a param (#5081)
* Make ControlMessageHandler take PeerManager rather than Node as a param

* refactor PeerData to not take a reference to Node

* Move ControlMessageHandler out of {Node,NeutrinoNode}
2023-05-29 09:01:06 -05:00
Chris Stewart
d33f17f0d7
Cancel oninit timeout scheduled job when we disconnect (#5076) 2023-05-24 10:00:56 -05:00
Chris Stewart
777743989a
Remove PeerHandler as it isn't used in src (#5075)
* Remove PeerHandler as it isn't used in src

* Fix rebase
2023-05-22 11:11:03 -05:00
Chris Stewart
8e4aa49aef
Fix ReConnectionTest part 2 (#5074)
* Fix ReConnectionTest

* Cleanup

* Revert logback-test.xml

* Fix connectioncount test case

* Get P2PClientTest passing consistently

* Empty commit to re-run CI
2023-05-22 08:11:57 -05:00
Chris Stewart
c0403da7c6
Make PeerFinder.getData() return Option (#5073) 2023-05-17 15:49:58 -05:00
Chris Stewart
5a8576a057
Encapsulate access to akka streams queue to PeerManager (#5070)
* Encapsulate access to akka streams queue to PeerManager

* Revert logback-test.xml
2023-05-15 15:24:38 -05:00
Chris Stewart
8dfb7d091f
2023 05 05 encapsulate peermanager peermsgsender (#5066)
* Make PeerManager.peerDataMap private

* Remove PeerMessageSender as param to DataMessageHandler.addToStream()

* Remove PeerMessageSender parameter from DataMessageWrapper

* Add PeerMessageSenderApi

* Try adding a supervision strategy to the stream

* Empty commit to re-run CI

* Adjust log level down to try and get a better idea of whats happening on IC

* Add commandName to exception when we cannot find peerMessageSender in stream

* Try decreasing queue size to reduce async processing between being stream processing and actor receiving external p2p message

* Empty commit to re-run CI

* Increase max concurrent offers to nodeAppConfig.maxConnectedPeers

* Revert logging
2023-05-08 15:17:36 -05:00
Chris Stewart
4c6090207a
Add MisbehavingPeer state (#5065)
* Add MisbehavingPeer state

* Remove PeerManager.syncFromNewPeer()
2023-05-05 16:11:25 -05:00
Chris Stewart
2fdd237e20
2023 04 26 dmh state refactor (#5062)
* WIP: Add new states for FilterHeaderSync, FilterSync, DoneSyncing

* Get DataMessageHandler compiling

* Get src compiling

* Get tests compiling

* Remove syncPeer from DoneSyncing

* WIP: Get first NeutrinoNodeTest working

* Get first NeutrinoNodeTest working for basic sync

* Fix small bug

* Fix bug where we transition to HeaderSync when we receive HeadersMessage with 0 headers. Also reduce conflicting states in DataMessageHandler.getHeaders()

* Add caveats for empty HeadersMessage

* WIP: Get NeutrinoNodeTest syncing compact filters during IBD passing consistently

* Remove generate block delay

* Empty commit to re-run CI

* Fix bug in onP2PClientStopped()

* Fix handling of DoneSyncing state when we receive headers messages

* Remove impossible case
2023-05-04 12:45:40 -05:00
Chris Stewart
ce6f0d1507
Refactor HeadersMessage to have helper method for HeadersMessage (#5060) 2023-04-26 10:46:24 -05:00
Chris Stewart
1fc6edf825
Remove initialSyncDone Promise as it isn't used (#5058) 2023-04-25 06:45:15 -05:00
Chris Stewart
ce6d2212c1
2023 04 22 peermanager dmh refactor (#5057)
* WIP: Move DataMessageHandler into PeerManager

* Get things compiling

* Turn off logging
2023-04-24 08:14:02 -05:00
Chris Stewart
1461782865
Move onHeaderRequestTimeout to PeerManager (#5056) 2023-04-23 13:38:15 -05:00
Chris Stewart
7beed5a00d
Only request syncing compact filter headers / filters if our tip isn't stale (#5055) 2023-04-22 10:24:23 -05:00
Chris Stewart
18482c7e44
2023 04 20 decouple node (#5049)
* Remove node parameter to PeerMessageReceiver, pass the ControlMessageHandler and DataMessageHandler as parameters

* Remove node reference in DataMessageHandler, just pass PeerManager as parameter

* Fix pattern match to be exhaustive

* Move fetchCompactFilterHeaders, sendFirstGetCompactFilterHeadersCommand out of DataMessagehandler to decouple DataMessageHandler, PeerManager

* scalafmt
2023-04-20 18:39:30 -05:00
Chris Stewart
447c6d03de
Implement getconnectioncount rpc (#5048)
* Implement getconnectioncount rpc

* Reduce waits in test, add documentation

* Fix docs

* Empty commit to re-run CI
2023-04-19 16:47:54 -05:00
Chris Stewart
51429a7d68
2023 04 17 refactor peer message receiver (#5045)
* WIP: Refactor PeerMessageReceiver methods into PeerMessageReceiverState

* Remove state helper methods from PeerMessageReceiver

* WIP: Remove PeerMessageReceiverState from PeerMessageReceiver

* Get things compiling and tests passing

* Remove currentPeerMessageHandlerReceiver

* Refactor PeerMessageReceiverTest to not use bitcoind
2023-04-18 10:25:24 -05:00
Chris Stewart
13e5e6501c
Fix bug where compact filters weren't being processed in order of block height during IBD (#5041)
* Fix bug where compact filters weren't being processed in order of block height during IBD

* Use sorted compact filter messages in chainApi.processFilters()
2023-04-10 16:42:48 -05:00
Chris Stewart
f95360f8ba
Add logic to fetch block headers after compact filters are synced in IBD to avoid a stale tip (#5037)
* Add logic to fetch block headers after compact filters are synced in IBD to avoid a stale tip

* Restore logging, remove println

* Add comment linking to issue

* Cleanup logging

* Only send getheaders message after filter sync if we are in IBD
2023-04-08 16:12:03 -05:00
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