Commit Graph

325 Commits

Author SHA1 Message Date
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
Chris Stewart
1ccc6a9230
2023 07 19 cleanup nodetest (#5156)
* Remove explicit call to sync()

* Remove extra call to NodeUnitTest.syncNeutrinoNode() in test fixture

* Add NeutrinoNodeNotConnnectedWithBitcoinds

* Don't switch sync peer if its the same peer we are currently syncing from it

* Fix another test

* Remove another sync() call

* Add carve out with MisBehavingPeers for the case where the badPeer was our last peer

* Remove more .sync() calls
2023-07-21 09:18:48 -05:00
Chris Stewart
e08469901b
Make PeerMessageSender.reconnect() return a Future that is completed when the connection is established (#5155)
* Make PeerMessageSender.reconnect() return a Future that is completed when the connection is established

* Replace hard require() with AsyncUtil.retryUntilSatisfiedF()
2023-07-19 13:10:15 -05:00
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