Commit Graph

338 Commits

Author SHA1 Message Date
Chris Stewart
747389e77d
Rework ConnectionGraph.stop() to return Future[Done] (#5325)
* Rework ConnectionGraph.stop() to return Future[Done] that represents the stream being completed

* Empty commit to re-run CI

* Fix bug in handleStreamComplete()

* Revert log levels

* Empty commit to run CI
2023-12-16 11:18:53 -06:00
Chris Stewart
f4db40897b
Fix bug where PeerConnection.connectionGraphOpt does not get reset on disconnect (#5307)
* Remove calls to PeerData.stop() inside of PeerManager.onDisconnect(), now call PeerConnection.disconnect() when stream is complete

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Make PeerFinder.removePeer() return Option[PeerData]
2023-12-11 16:57:06 -06:00
Chris Stewart
bd3ad1df21
2023 12 07 mat socks5handler (#5322)
* Move socks5 greeting into Socks5Connection.socks5Handler() so each individual uage doesn't have to roll its own greeting

* Implement socks5Handler() to return a materialized stream

Get something working

Cleanup

* Remove connection parameter

* Add scaladoc
2023-12-08 12:36:02 -06:00
Chris Stewart
ef20d5ec83
Rework Socks5Connection.socks5Handler() to emit Socks5ConnectionState downstream (#5315) 2023-12-02 13:02:48 -06:00
Chris Stewart
47c433f365
Replace inactivity logic with Flow.idleTimeout (#5311)
* Replace inactivity logic with Flow.idleTimeout

* Fix bug where we were calling PeerConnection.connect() rather than PeerConnection.reconnect()
2023-11-29 15:13:13 -06:00
Chris Stewart
4913b12431
2023 11 10 peermanager refactor (#5303)
* Pull queue, PeerFinder into NeutrinoNode and out of PeerManager

* Remove ControlMessageHandler param from PeerData

* Make ControlMessageHandle.handleControlPayload() take PeerMessageSenderApi as a param instead of just a Peer

* move construction of akka stream from PeerManager to NeutrinoNode

* Move inactivity checks out of PeerManager and into NeutrinoNode

* Move queue initialization into NeutrinoNode

* cleanup

* Set NeutrinoNode.isStarted to true when NeutrinoNode.start() is called

* Empty commit to re-run CI

* Modify FilterSync.toString()

* scalafmt

* Fix bug where we weren't checking if connection is timed out on activity checks

* Empty commit to run CI

* reset log level
2023-11-17 13:16:26 -06:00
Chris Stewart
7f5ed15521
Reduce inactivity level to DEBUG (#5286)
* Reduce inactivity level to DEBUG

* Empty commit to re-run CI

* Empty commit to run CI

* Empty commit to run CI

* Empty commit to re-run CI
2023-11-08 15:45:55 -06:00
Chris Stewart
7b8df425fb
Reset PeerConnection.connectionGraphOpt = None when connection is disconnected (#5290)
* Reset PeerConnection.connectionGraphOpt = None when connection is disconnected

* Move resetting connectionGraphOpt into PeerConnection.disconnect()

* Call PeerData.stop() inside of PeerManager.onDisconnect()

* Empty commit to run CI

* Empty commit to re-run CI
2023-11-08 08:00:51 -06:00
Chris Stewart
b252c2d6a2
2023 10 16 Implement WalletCallbackStreamManager, DLCWalletCallbackStreamManager (#5263)
* WIP: Implement WalletCallbackStreamManager

* Implement stopping of WalletCallbackStreamManager in WalletAppConfig

* WIP: DLCWalletCallbackStreamManager

* Refactor DLCWalletCallbacks to be a trait

* Integrate DLCWalletCallbackStreamManager into WebsocketUtil

* Use  java.util.concurrent.atomic.AtomicBoolean rather than monix

* Remove logger param from dlc callbacks

* fix docs

* Call super.stop() in DLCappConfig

* Empty commit to run CI

* Try to debug

* Empty commit to run CI

* Revert things
2023-10-19 11:52:07 -05:00
Chris Stewart
cff757cb55
2023 10 03 node refactors (#5256)
* Rename PeerMessageSender -> PeerConnection

* WIP: Move gossip methods into PeerManagerApi, keep single peer methods in PeerMessageSenderApi, but remove peer parameter

* PeerData.peerMessaageSender -> PeerData.peerConnection

* Remove DataMessageHandler.queue as it is redundant

* Get most test cases passing in nodeTest

* Fix ReConnectionTest

* Fix NeutrinoNodeWithUncachedBitcoindTest test case

* Rename PeerManager.{randomPeerMsgSender, getPeerMessageSender} -> PeerManager.{randomPeerConnection,getPeerConnection}

* Refactor PeerManager.getPeerMessageSender to return the new PeerMessageSender

* Rename param

* scalafmt

* Remove unused method

* Revert onInitialization
2023-10-09 10:32:05 -05:00
Chris Stewart
2863b3f5cc
Change PeerManager to keep NodeState in Sink.foldAsync() rather than DataMessageHandler (#5255) 2023-10-05 16:11:36 -05:00
Chris Stewart
522821869d
Move filterBatchCache into NodeState.FilterSync (#5253) 2023-10-05 14:56:08 -05:00
Chris Stewart
a40be1a6bc
Fix bug where we were executing block ehader callbacks when we received 0 block headers from our peer (#5254) 2023-10-05 14:55:49 -05:00
Chris Stewart
1602852419
2023 09 29 waitingdisconnection nodestate (#5251)
* Move waitingForDisconnection into NodeState

* Remove PeerManager.waitingForDisconnection

* Remove mutable _waitingForDisconnection

* Fix compile
2023-10-03 15:35:46 -05:00
Chris Stewart
83cf657a0b
Move initialization of sync into PeerManager's queue (#5250) 2023-10-03 13:16:20 -05:00
Chris Stewart
4972d0a368
Move NodeState to core (#5249) 2023-09-29 12:06:24 -05:00
Chris Stewart
3e6ff52194
2023 09 27 issue 5139 (#5247)
* Add test case for reorg on bitcoin network for NeutrinoNodeTest

* Get unit tests passing

* Refactor findNextHeader() to not take an Option[BlockHeaderDb], not it just takes BlockHeaderDb

* Explicity return None in the case where we don't need sync filter headers

* Fix off by one bug when starting filter header sync
2023-09-29 07:35:26 -05:00
Chris Stewart
c4f0bd3d39
Switch defaults to 12 hours for running peerConnectionScheduler (#5241) 2023-09-21 09:26:40 -05:00
Chris Stewart
3763a53ad5
Adjust so that requery in the case were we have just 1 peer (#5240) 2023-09-20 09:13:23 -05:00
Chris Stewart
d5c74c086d
Reduce NodeCallbackStreamManager from 32 -> 16 (#5229) 2023-09-06 13:35:03 -05:00
Chris Stewart
b3aa7b4b68
Fix bug were we weren't consistently calculating the correct compact filter start height for sync (#5225) 2023-09-06 08:25:43 -05:00
Chris Stewart
489682312d
Reduce NodeCallbackStreamManager to 32 to reduce chance of OOM errors on small heap sizes (#5224) 2023-09-05 13:21:23 -05:00
Chris Stewart
3ae41032a4
Add log to help debug 5208 (#5211) 2023-08-28 12:32:16 -05:00
Chris Stewart
aa02683db9
Cleanup use of syncPeerOpt as a param in parts of PeerManager (#5209) 2023-08-26 12:37:27 -05:00
Chris Stewart
2672c2223c
Remove references to client in PeerManager logs (#5207) 2023-08-26 10:07:10 -05:00
Chris Stewart
39cec3ae51
Fix bug where we weren't checking if filters are stale when determing if we need to sync filters (#5203) 2023-08-25 09:05:35 -05:00
Chris Stewart
11ab921923
Add filter header and filter count to logs (#5202) 2023-08-24 11:14:25 -05:00
Chris Stewart
26290bf4c0
Rework handling of BlockMessage, fix bug where callbacks executed when they shouldn't have been (#5201)
* Rework handling of BlockMessage, fix bug where callbacks executed when they shouldn't have been

* scalafmt
2023-08-24 07:49:15 -05:00
Chris Stewart
e8ab293fa0
Remove Initialized from NodeStreamMessage, return Initialized from ControlMessageHandler (#5199)
* Remove Initialized from NodeStreamMessage, return Initialized from ControlMessageHandler to avoid deadlocking queue with backpressure

* Revert a few things

* scalafmt
2023-08-23 08:34:37 -05:00
Chris Stewart
cc94a92424
Add Await.result() to inactivity check runnable to make sure it completes, or we get an error message if it doesn't (#5197) 2023-08-16 09:43:25 -05:00
Chris Stewart
f36c437648
Guard createFilterSyncJob() with isStarted (#5195) 2023-08-15 11:35:49 -05:00
Chris Stewart
e423de01e1
Remove executing block callbacks if node is in IBD (#5193) 2023-08-12 19:19:13 -05:00
Chris Stewart
998c997ac5
Move initialization cancellable into connection graph (#5192)
* Move initialization cancellable into connection graph so we can cancel it if PeerMessageSender.disconnect() is called

* Create ConnectionGraph.stop()

* fix compile
2023-08-12 17:55:02 -05:00
Chris Stewart
deb34dc87a
Lower log levels to DEBUG (#5188) 2023-08-09 08:50:55 -05:00
Chris Stewart
09623173b3
Increase inactivity check log level (#5187) 2023-08-07 15:00:47 -05:00
Chris Stewart
f2b40c8922
More idiomatic akka stream usage (#5183) 2023-08-06 14:02:58 -05:00
Chris Stewart
b13e0565af
Remove PeerMessageReceiver (#5182)
* Remove PeerMessageReceiver

* Dont use QueueOfferResult, use akka.Done
2023-08-06 13:10:11 -05:00
Chris Stewart
c238191209
2023 08 04 rm peermsgrecvstate (#5177)
* WIP: Remove PeerMessageReceiverState from PeerMessageReceiver

* Get tests passing
2023-08-06 11:57:04 -05:00
Chris Stewart
25f42bf6b8
Reduce log level of 'Received maximum amount of headers' (#5181) 2023-08-05 20:16:17 -05:00
Chris Stewart
08e780a884
2023 08 01 issue 5174 (#5176)
* Move methods out of PeerManager.onInitialization()

* Add PersistentPeerData, QueriedPeerData

* Segregate PeerData -> {AttemptToConnectPeerData, PersistentPeerData}, handle the cases differently in managePeerAfterInitialization()

* Remove call to sync() in BitcoinSServerMain

* Fix bug where we were attempting to stop peers that had already had their connections fail

* reduce log level for peer discovery failures
2023-08-04 11:18:27 -05:00
Chris Stewart
147f7782e5
2023 07 28 cleanup tests (#5172)
* simplify re-query invalid headers test case

* Cleanup test

* Cleanup another test

* Fix re-query invalid headers unti test

* fix unit test

* Empty commit to run CI

* Empty commit to re-run CI

* Empty commit to run CI
2023-08-01 11:26:51 -05:00
Chris Stewart
9b85838823
Implement logic to restart PeerManager in inactivity checks when we have 0 peers (#5171)
* Implement logic to restart PeerManager in inactivity checks when we have 0 peers

* Revert logback-test.xml

* cleanup
2023-08-01 10:07:40 -05:00
Chris Stewart
4d5488f193
2023 07 31 fix filterheader sync bug (#5173)
* fix compact filter header sync bug where we wouldn't start syncing filters

* scalafmt

* remove batch size check
2023-07-31 11:36:18 -05:00
Chris Stewart
99ca1b7abf
Add PeerManagerApi.peers (#5170) 2023-07-28 10:51:10 -05:00
Chris Stewart
cade1afcdf
Implement more checks for createFilterSyncJob() to more strictly check if we have seen any filter headers / filters since the job was scheduled (#5168) 2023-07-27 10:50:40 -05:00
Chris Stewart
e570ebea56
Remove validating headers state (#5165) 2023-07-26 06:56:24 -05:00
Chris Stewart
ef2c96cc99
Add PeerManagerApi (#5164) 2023-07-25 14:34:32 -05:00
Chris Stewart
2d57ff6a3e
Refactor PeerManager methods to be connectPeer(), disconnectPeer() (#5163)
* Refactor PeerManager.{removePeer,waitingForDeletion} -> PeerManager.{disconnectPeer,waitingForDisconnection}

* PeerManager.addPeer() -> PeerManager.connectPeer()

* scalafmt
2023-07-25 11:59:58 -05:00
Chris Stewart
4afaaf8f22
Only log a warning instead of throwing an exception when we try to send a message to a peer we aren't connected to (#5161) 2023-07-25 09:34:14 -05:00
Chris Stewart
2032b16620
Fix bug where we just need to awaitSyncAndIBD() rather than attempt to sync() (#5158)
* Fix bug where we just ned to awaitAllSync() rather than attempt to sync()

* Use awaitSyncAndIBD, mv awaitSyncAndIBD to NodeTestUtil

* Replace more NodeUnitTest.syncNeutrinoNode() with NodeTestUtil.awaitSyncAndIBD

* Replace more NodeUnitTest.syncNeutrinoNode() with NodeTestUtil.awaitSyncAndIBD
2023-07-21 17:08:01 -05:00