Commit Graph

232 Commits

Author SHA1 Message Date
Chris Stewart
65e67287f8
2024 10 21 Replace Future.sequence() usage with Future.traverse() (#5732)
* Use more Future.traverse()

* More Future.traverse()
2024-10-22 16:57:23 -05:00
Chris Stewart
4471f74ccf
Add error field toImportDescriptorResult, move BitcoindException to app-commons (#5705)
* Add error field to ImportDescriptorResult, move BitcoindException to app-commons

* Fix docs
2024-10-12 09:49:42 -05:00
Chris Stewart
7caea21b6a
refactor: Move more methods out of WalletApi (#5681)
Remove more methods out of WalletApi

refactor: move getTransactionsToBroadcast to SendFundsHandlingApi
2024-09-26 16:22:30 -05:00
Chris Stewart
d17934f17f
Add SendFundsHandlingApi, remove HDWalletApi (#5680)
* Begin moving methods out of HDWalletApi

* Add SendFundsHandlingApi, remove HDWalletApi

* Fix docs

* Move makeOpReturnCommitment() to SendFundsHandlingApi

* Remove MockWalletApi

* Cleanup

* Fix RoutesSpec

* Revert logback-test.xml
2024-09-22 09:32:01 -05:00
Chris Stewart
8cfd5e8d6b
2024 09 19 address handling refactor (#5679)
* wallet: Create has-a relationship for AddressHandling rather than is-a

* Fix infinite loop in AccountHandlingApi.getNewAddress(account)

* Fix appServerTest

* Revert Server.scala
2024-09-21 11:41:57 -05:00
Chris Stewart
8c5d685953
Refactor codebase to have has-a relationship with RescanHandling rather than is-a (#5675)
* Refactor codebase to have has-a relationship with RescanHandling rather than is-a

get everything compiling

Get all tests passing

* Revert and clean up files

* Fix docs
2024-09-19 09:46:56 -05:00
Chris Stewart
38850d22e3
2024 07 31 bitcoind callbacks (#5631)
* Add NodeApiCallbacks

* Add BitcoindCallbacks

* Add BitcoindRpcAppConfig

* fix docs

* Add helper method for construction

* Add helper constructor method to avoid explicitly passing BitcoindRpcAppConfig parameter to BitcoindRpcClient when we have a BitcoindInstanceLocal

* Fix docs
2024-08-02 07:43:24 -07:00
Chris Stewart
562e5602e3
Add -Xsource:3 to node/ node-test/ tor/ tor-test/ (#5589) 2024-05-11 11:21:08 -05:00
Scala Steward
afddf73c48
Update scalafmt-core to 3.8.1 (#5501)
* Update scalafmt-core to 3.8.1

* Update .scalafmt.conf settings to be factory default settings

* Fix typo

* scalafmt

* Empty commit to re-run CI

* Revert some scalafmt back to original scalafmt.conf

---------

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2024-04-20 19:55:49 -05:00
Chris Stewart
f7dd69bec3
refactor: Use 'peerWithServicesDataMap' name consistently across NodeState and PeerManager (#5478) 2024-03-17 16:30:52 -05:00
Chris Stewart
9a71a96fb8
2024 03 11 Remove filtersync job (#5471)
* Rework DataMessageHandler to consider syncing filterheaders if we receive a headers message with 0 block headers

* scalafmt

* Remove syncfilter job

* Cleanup

* Reduce received headers log to DEBUG

* Rework SyncNodeState.toString()

* Call PeerManager.startFilterSync() in DataMessageHandler

* Don't test MTP in unrelated test
2024-03-12 15:05:54 -05:00
Chris Stewart
708ce41f24
Re-implement bitcoin-s.node.query-wait-time (#5470)
* Add sentQuery Instant to SyncNodeState subclasses, add logic in DataMessageHandler.handlePayload() to detect if a query has timed out

* Refactor to use NodeTestUtil.disconnectNode()

* Cleanup comments
2024-03-11 09:54:44 -05:00
Chris Stewart
55e4dab86e
Rework NodeApi.downloadBlocks() to use DoubleSha256DigestBE (#5456)
* Rework NodeApi.downloadBlocks() to use DoubleSha256DigestBE rather than DoubleSha256Digest

* Fix test cases

* Fix docs

* Fix compile
2024-03-05 15:19:32 -06:00
Chris Stewart
898d2b44ee
Fix bug where we were executing block callbacks when we hadn't seen a block header (#5455)
* Fix bug where we were executing block callbacks when we hadn't seen a block header

* reduce log to DEBUG
2024-03-05 13:47:03 -06:00
Chris Stewart
238948e185
Remove PeerMessageSenderApi param from DataMessageHandler (#5453) 2024-03-05 11:12:17 -06:00
Chris Stewart
ae3a634703
2024 03 01 Fix syncPeer exceptions (#5446)
* Add NodeRunningState.removePeer(), add helper method onDisconnectNodeStateUpdate() to consolidate disconnect logic

* Remove duplicate logic

* Add bitcoin-s.node.maxConnectedPeers test

* Clean up resources in test case

* Remove unecessary replacePeers()

* Add NodeState.addPeer()

* Add NodeRunningState.connectedPeerCount, separate handling of connection slots and filter slots
2024-03-04 09:22:16 -06:00
Chris Stewart
d1ecd35e63
Fix PeerDb.lastSeen race condition in unit tests (#5435)
* Disconnect from bitcoind side rather than bitcoin-s side to make sure we don't run into a race condition for updating lastSeen

* Remove usage of CachedAppConfig, switch implicit param args for PeerDAO to be consistent with rest of code base

* Fix bug in getNodeURIFromBitcoind(), disconnect from bitcoind side in PeerManagerTest

* Add println to see why still fialing

* Add PeerConnection.getLocalAddress, add parameter localAddressBitcoinS  to NodeTestUtil.getNodeURIFromBitcoind() to make sure we are getting the correct URI

* Empty commit to run CI
2024-02-28 10:33:01 -06:00
Chris Stewart
783ed1903d
Rename bitcoin-s.node.inactivity-timeout -> bitcoin-s.node.health-check-interval (#5418) 2024-02-23 08:31:22 -06:00
Chris Stewart
1dff918848
2023 02 21 pekko (#5413)
* Get dependencies resolving, get tor module compiling

* Get everything compiling with pekko

* Rework configs/logging to use pekko namespace

* Rename AkkaUtil -> PekkoUtil, BitcoinSAkkaAsyncTest -> BitcoinSPekkoAsyncTest
2024-02-22 10:26:21 -06:00
Chris Stewart
b89b31fe09
2024 02 18 peerfinder duplicate connect (#5403)
* Pull PeerFinder changes over from #5390

* Filter out peers we are already connected when attempting to discover peers inside of PeerFinder

* Try to work around mutable.Map.isEmpty bug by converting to immutable Map
2024-02-18 11:47:32 -06:00
Chris Stewart
fe33c2919c
Fix inconsistency of PeerDAO primary key usage (#5398)
* Fix inconsistency of PeerDAO primary key usage

* Add Peer.port helper method
2024-02-14 13:31:56 -06:00
Chris Stewart
536cc26ba5
Update last seen value in PeerDb on disconnect (#5397) 2024-02-13 16:38:18 -06:00
Chris Stewart
05d03e7da6
Remove skipPeers, better PeerFinder.toString() (#5396) 2024-02-13 09:01:50 -06:00
Chris Stewart
cac546bb57
Fix bug where we were only setting bitcoin-s.node.inactivity-timeout on regtest (#5389)
* Fix bug where we were only setting bitcoin-s.node.inactivity-timeout on regtest

* Remove log, scalafmt
2024-02-08 21:36:15 -06:00
Chris Stewart
451e019225
2024 01 31 Fix PeerManager.connect() bug where PeerFinder was unaware of peer (#5381)
* Fix bug in PeerManager.connect() where we would throw ane xception when our PeerFinder had not seen the peer before

* Remove ReConnectionTest case where we constantly try to reconenct o a peer we disconnected, revert logback-test.xml
2024-01-31 11:10:48 -06:00
Chris Stewart
018631dad4
Create NodeTestUtil.awaitConnectionCount() (#5378)
Refactor ReConnectionTest to use NodeTestUtil.awaitConnectionCount()

Refactor more of codebase to use NodeTestUtil.awaitConnectionCount()

Refactor PeerManagerTest to use NodeTestUtil.awaitConnectionCount()

Refactor more nodeTest to use NodeTestUtil.awaitConnectionCount()

use bitcoinds.size for expectedConnectionCount
2024-01-31 07:39:20 -06:00
Chris Stewart
f26e6f7c5a
initiate disconnect from PeerManager rather than bitcoind in connection (#5354)
* initiate disconnect from PeerManager rather than bitcoind in connection count test

* Empty commit to re-run CI
2024-01-14 16:24:05 -06:00
Chris Stewart
9cd60d5366
2024 01 02 encapsulate state p2psink (#5342)
* Move NodeState back to node module

* Refactor peerWithServicesDataMap into NodeState

* More usage of state.peerDataMap in stream

* Fix log message

* Fix compile

* Move PeerFinder into NodeState

* WIP: Move PeerFinder init into NeutrinoNode.start()

* Get things mostly working again after rebase

* Fix bug in handling of headers message where we wouldn't transition to DoneSyncing if a peer sent us 0 headers

* Move SendToPeer into stream

* scalafmt

* Empty commit to run CI

* Re-add DataMessageHandlerTest

* Renable disconnecting portion of NeutrinoNodeTest

* Empty commit to run CI

* Remove disconnection part of test again

* Empty commit to re-run CI

* Empty commit to re-run CI
2024-01-13 17:22:01 -06:00
Chris Stewart
3c5bace825
Dont initiate disconnect logic from bitcoind, its flakey for some reason (#5343)
* Dont initiate disconnect logic from bitcoind, its falky for some reason

* Fix bug where we weren't switching sync to another peer on disconnect for the case where we were waiting for disconnection

* Empty commit to run CI

* Empty commit to run CI
2024-01-05 11:52:39 -06:00
Chris Stewart
b39736fb8d
Rework NodeTestUtil to use a specific bestBlockHash (#5332)
* Rework NodeTestUtil to use a specific bestBlockHash, this is useful in reorg situations

Use param in reorg test, modify scaladoc

WIP

* Cleanup

* Try to fix usage of stopHashBE

* Cleanup

* WIP: Fix getCompactFilterStartHeight()

* Revert logback-test.xml

* Fix bug with isFiltersSynced() in reorg situations

* scalafmt, fix compile

* Fix another bug with isFiltersSynced()

* Fix compile
2023-12-31 17:38:12 -06:00
Chris Stewart
a3e1267484
2023 12 30 isfiltersync bug (#5337)
* Fix another bug with isFiltersSynced()

* Fix compile

* Cleanup uncessary checks

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-12-31 14:06:21 -06:00
Chris Stewart
06dfd9cea4
Rework randomPeerWithServices() to be inside of NodeState (#5331)
* Rework randomPeerWithServices() to be inside of NodeState, try to move more state into NodeState

* Don't try to sync from peer waitingForDisconnection

* Add PeerWithServices, keep track of ServiceIdentifier in PeerManager and NodeState

* Try to make reorg test more reliable

* Empty commit to run CI
2023-12-29 14:47:29 -06:00
Chris Stewart
d983a1bac4
2023 12 24 Make filter headers / filters sync work with block header reorgs (#5333)
* Rework ChainApi.nextBlockHeaderBatchRange() to take stopHash parameter, get chainTest/test passing

* WIP: Refactor ChainApi.nextFilterHeaderBatchRange()

* Finish ChainApi.nextFilterHeaderBatchRange() refactor, get all tests passing except reorg related tests in nodeTest

* Get NeutrinoNodeTest reorg test case working

* Improve flaky test

* Cleanup

* Switch sync check to bitcoinds(1)

* Empty commit to run CI

* Implement batchSize tests in ChainHandlerTest

* Rework ChainHandlerTest to not assume we have the genesis filter header / filter inserted into the database already

* Cleanup println

* Fix bug with nextFilterHeaderBatchRange() wrt to startHeightOpt parameter

* Fix off by one bug with compact filter sync

* Add check for connectionCount

* Add longer timeout

* scalafmt
2023-12-28 10:43:01 -06:00
Chris Stewart
16fb5d2dad
2023 12 19 compiler opts (#5330)
* Enable more compiler options

* enable -Xlint:valpattern, fix bug with out Test / scalacOptions were set with incorrect source code compiler flags

* Enable -Xlint:eta-sam

* Fix cryptoTestJVM

* Fix cryptoTestJS/test

* Fix asyncUtilTest

* Fix asyncUtilTest
2023-12-20 05:42:01 -06:00
Chris Stewart
01537185bd
2023 12 13 mv connectioncount check fixtures (#5324)
* Move peer connection count checks into test fixtures

* Add connection count check in another test fixture

* scalafmt
2023-12-14 06:19:47 -06:00
Chris Stewart
7f337073c9
Improve ReConnectionTest (#5323)
* Improve ReconnectionTest

* Await sync before starting our inactivity check
2023-12-13 06:25:24 -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
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
be30da578d
Bump timeout for checking when peer is disconnected (#5277)
* Bump timeout for checking when peer is disconnected

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-10-29 09:04:21 -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
522821869d
Move filterBatchCache into NodeState.FilterSync (#5253) 2023-10-05 14:56:08 -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
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
Scala Steward
d7037ede28
Update scala-library to 2.13.12 (#5235)
* Update scala-library to 2.13.12

* Fix compiler errors on scala 2.13.12

---------

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2023-09-12 10:45:17 -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
aa02683db9
Cleanup use of syncPeerOpt as a param in parts of PeerManager (#5209) 2023-08-26 12:37: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
c2902c1146
Fix onBlockReceived unit test (#5166)
* Fix onBlockReceived unit test

* scalafmt
2023-07-25 16:20:39 -05:00