* Conslidate PeerFinder.start() logic into peerConnectionScheduler, add bitcoins-s.node.try-peers-start-delay config settig to indicate how long until we start attempting to connect to peers in PeerFinder
* Cleanup
* Revert logback-test.xml
* Add documentation
* Empty commit to run CI
* Rework NodeAppConfig.peers to return Vector[Peer] rather than Vector[String]
* Add higher priority to paramPeers
* Fix bug when requesting FilterSyncMarker for filter headers outside of our in memory blockchain's range
* Rework buildNHeaders to be faster, move it to ChainUnitTest
* 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
* Add ChainApi.getBestChainTips()
* Implement BitcoindRpcClient.getBestChainTips()
* Revert NodeTestUtil
* Use ChainApi.getBestChainTips() throughout codebase rather than blockHeaderDAO.getBestChainTips()
* 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
* 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
* 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
* 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
* Make PeerMessageSender.reconnect() return a Future that is completed when the connection is established
* Replace hard require() with AsyncUtil.retryUntilSatisfiedF()
* Defensively try to sync everytime a peer is a initialized
* Turn logging OFF
* Fix DataMessagehandlerTest, remove calls to NeutrinoNode.sync() in test fixtures
* 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
* 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
* 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()
* 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
* 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
* 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
* 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}
* 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
* 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
* Bump version to v23.02.2
* Fix hash
* Reduce timeout on clightning startup, its absurdly long causing slow test iteration
* Try to specify the OS version clightning tests run on to ubuntu-20.04
* Rework downloadClightning to be conscious of the ubuntu OS version
* Empty commit to re-run CI
* Empty commit to re-run CI
* Empty commit to re-run CI
* Remove support for v19 of bitcoind
* Remove downloading v19 bitcoind inside of bitcoind-rpc.sbt
* Clean up docs
* Move unit tests in BitcoindV19RpcClientTest into other test files so we don't remove them, these rpcs are supported in future versions of bitcoind
* 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
* 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
* 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
* remove v17
* fix one error in sign a raw transaction
* try to get BlockchainRpcTest working
* fix MiningRpcTest
* WIP
* Get RawTransactionRpcTest working with v21 of bitcoind
* Fix MiningRpcTest
* Remove println
* Remove prune unit test as i cannot get it to pass on regtest
* Break versioning on V19 of bitcoind rpc client in chain handler, use BitcoindRpcClient with V19BlockFilterRpc
* Make NodeTestWithCachedBitcoindNoP2pBlockFilters for test case with unsupported peers
* Fix docs
* Empty commit
* Empty commit
* Turn logging off again
* Get unit tests passing for unordered nonces/signatures
* Get v0 oracle announcements working again on listannouncements
* Add unit test to make sure we can still validate signatures for attestments with nonces out of order
* Fix bug in DualWalletTestCachedBitcoind where we didn't pass pgurl
* Revert logging LEVEL
* Move nodeTest/test too last as it is always failing preventing running of other test suites
* Add OrderedSchnorrSignatures, use it in OracleAttestment, propagate it threw the codebase
* Small cleanups
* Add SortedVecFactory
* Fix test case with out of order nonces
* Fix bug where no exception was thrown if the acceptor did not have enough money
* Revert ContractInfo.max definition, fix bug in acceptDLCOffer
* Fix incorrect usages of ContractInfo.max
* Refactor ContractInfo.max -> ContractInfo.maxOfferorPayout
* Fix dlc.md
* 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>
* 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
* Embedded Pg v1.0.1
* fix GitHub action evironment
* fix Windows CI tests
* test db-commons in different environments
* remove dbCommontTest from Windows and Mac Github actions
* cleanup
* configurable postgres startup wait
* Empty commit to run CI
* Bump default timeout to 60
* Empty commit
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
* 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
* Refactor WalletRoutes to take DLCWalletLoaderApi as a parameter, use the walletHolder inside of DLCWalletLoaderApi to fulfill requests
Fix rebase
Reduce parallelism in fetchFiltersFlow to 1 to reduce chance of hitting akka's max open requests
* Try fix loader test by catching RejectedExecutionException
* Add println to see if catching excpetion gets hit
* WIP: Try to fix recursive rescan
* Don't map on recursiveRescan so we don't block on it
* 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
* 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
* bitcoind rpc client v22
* addresses and reqSigs deprecation
* getNodeAddresses rpc now returns a network field
* fixed so that support for V23
* debuggging changed extends BitcoindRpcClient to extends BitcoindV21RpcClient
* added network input to getnodeaddresses which makes it so only outputs addresses with that specified network
* getnodeaddresses accepts a network input and outputs addresses with that network. Test did not run on previous commit now it passes.
* added (listdescriptors rpc testing in progress), added descriptors flag to getwallet info rpc (testing in progress), added include unsafe option for fundrawtransaction and walletcreatefundedpsbt rpcs (testing in progrss), adding test for createwallet with descriptors enabled (not complete)
* fix so that getwalletinfo works with descriptors flag, fix so now can create descriptor wallet, test for create descriptor wallet now runs and passes
* added tests, bug in listdescriptors implmentation
* listDescriptors rpc is implmented and passes all tests
* listDescriptors test was previously causing (be able to decode a redeem script) test in the suite to fail becasue of createwallet, the bug is now resolved
* bug fix in V17AssortedRpc
* bug fixes
* fixed listdescriptors test, create descriptor wallet test, wallet with priv keys enabled test, decode redeem script test, so that no longer use await return and await result
* fix for tests failing
* listDescriptors Rpc implmented and passes tests
* cleanup
* scala formating changes
* generate block to address test uncommented V22 changed to PostV22 in some of the names of the case classes
Co-authored-by: shruthii625 <shruthii1410@gmail.com>
* Move MockChainQueryApi/NodeApi out of BaseWalletTest
* fix docs
* Move wallet configurations out of BaseWalletTest
* Move helper methods out of BitcoinSFixture trait into companion object to simplify the hierarchy
* Refactor usage of WalletWithBitcoind to allow parameterization of the BitcoindRpcClient type
* Bump sleeps on CallbackUtilTest
* Bump timeout even more
* Reduce timeout again
* Re-bump to 5 minutes
* Make sure we shutdown actor system in test fixture BitcoinSServerMainBitcoindFixture
* Implement rescan with akka streams
Get basic stream working with rescan
Fix bug where we weren't using rescan specific threadpool
Implement killswitch for rescan
* WIP: Expose promise to allow external completion of rescan stream
* Rework RescanStarted.RescanStarted to contain a promise to complete the stream early, and a future that represents the completed streams materialized value
* Comment cleanup
* Fix compile errors, remove killswitch
* Fix 2.12.x compile
* Introduce ActorSystem into wallet, refactor rescans to use that ActorSystem
* Fix import
* Fix bug where we were prepending instead appending to batched Vector
* Propogate RescanState upwards into WalletRoutes
* Refactor fetching of filters to be a Flow
* 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
* Fee rate WS notification
* make the test more CI friendly
* fix the default config
* always return errors
* fix build
* scalafmt
* send notifications every time
* 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
* 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