Commit Graph

575 Commits

Author SHA1 Message Date
Chris Stewart
76e468c5c4
2024 01 28 Refactor PeerFinder.start() to avoid initializing connections (#5376)
* 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
2024-01-29 09:46:31 -06:00
Chris Stewart
3a927edee1
Fix bug when requesting FilterSyncMarker for filter headers (#5344)
* 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
2024-01-06 09:59:26 -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
5e81ec5ed2
Add ChainApi.getBestChainTips() (#5338)
* Add ChainApi.getBestChainTips()

* Implement BitcoindRpcClient.getBestChainTips()

* Revert NodeTestUtil

* Use ChainApi.getBestChainTips() throughout codebase rather than blockHeaderDAO.getBestChainTips()
2023-12-31 16:54:40 -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
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
531c909597
Use BitcoindRpcBackendUtil.buildBitcoindNodeApi() in wallet test fixtures, re-implement getConfirmationsForBlocks() to use akka streams to avoid max-open-requests limit inside of akka (#5259) 2023-10-12 18:02:06 -05:00
Chris Stewart
12e5dfc021
Fix chain fixtures to use ChainHandler rather than always using ChainHandlerCached (#5243)
* Fix chain fixtures to use CHainHandler rather than always using ChainHandlerCached

* Remove unecessary ChainAppConfig.start()
2023-09-25 11:13:59 -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
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
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
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
b1e6488bb7
Move Socks5ProxyParams, Credentials into core (#5138) 2023-07-08 13:57:44 -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
458a80d854
Destroy wallet config when tearing down node (#5105) 2023-06-15 13:39:37 -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
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
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
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
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
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
benthecarman
08757d536f
Lnd 0.16.0 rpc (#5005)
* Lnd 0.16.0 rpc

* Add 2 second delay for after channels are open
2023-03-30 14:43:26 -05:00
Chris Stewart
dc0e3645d0
2023 03 24 is tip stale (#5024)
* WIP

* Fix test

* Add more tests for stale header

* remove uncessary comments
2023-03-26 08:20:27 -05:00
Chris Stewart
d53ed7d487
Bump clightning version to v23.02.2 (#5025)
* 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
2023-03-26 06:26:46 -05:00
Chris Stewart
3db663a387
Remove v20 bitcoind support (#4992)
* Remove v20 bitcoind support

* Remove v20 bitcoind from downloadBitcoind task

* Remove duplicate test
2023-02-19 13:28:46 -06:00
Chris Stewart
af349d2179
Remove support for v19 of bitcoind (#4991)
* 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
2023-02-16 10:27:56 -06:00
Chris Stewart
b329c3670e
Add rpc for syncwithvalidationinterfacequeue, use it in NodeUnitTest.syncNeutrinoNode (#4983) 2023-02-11 14:32:59 -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
7e346e58fe
Refactor NodeTestUtil.awaitBestHash() to take a reference to bitcoind (#4973)
* Refactor NodeTestUtil.awaitBestHash() to take a reference to bitcoind

* Empty commit
2023-02-05 08:59:09 -06:00
Chris Stewart
1391c9497e
Segregate handling of exceptions in fixtures (#4971)
* Segregate handling of exceptions being thrown in test cases vs fixture setup code

* Add log message
2023-02-04 11:56:23 -06:00
Chris Stewart
76fc3cdc41
Refactor to not throw an exception is node is already syncing (#4970)
* Refactor to not throw an exception is node is already syncing

* Refactor method name
2023-02-03 12:57:19 -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
9646994a99
Encapsulate PeerData.client (#4944) 2023-01-09 11:56:38 -06:00
Chris Stewart
3a8eff8feb
Some cleanups in the node project (#4941) 2023-01-07 07:33:57 -06:00
Chris Stewart
8f4ed4ac83
Refactor to use NodeTestUtil.awaitSync() (#4942) 2023-01-06 15:57:07 -06:00
Chris Stewart
746e23cf86
Refactor NodeTestUtil.awaitSync() to check compact filter headers / compact filters as well (#4934) 2022-12-29 10:36:37 -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
60998fe2d1
Reduce timeouts for syncing in NodeTestUtil (#4923) 2022-12-14 11:34:50 -06:00
benthecarman
f4244d7a0e
Add bitcoind v24 (#4902)
* Add bitcoind v24

* Make newest bitcoind version v23 for now
2022-11-28 08:43:49 -06:00
Chris Stewart
746635a551
Remove v18 from bitcoind-rpc (#4845)
* Remove v18 from bitcoind-rpc

* Remove v18 from bitcoind downloads

* WIP

* Fix submitheader RPC test with v23 bitcoind

* Have join psbt handle randomizing input & output ordering

* Cleanup

Co-authored-by: benthecarman <benthecarman@live.com>
2022-10-23 08:59:18 -05:00
benthecarman
1d1af1d52e
Add generate helper function for bitcoind (#4852) 2022-10-19 14:22:30 -05:00
benthecarman
2a30232181
Update lnd to v0.15.3-beta (#4850)
* Update lnd to v0.15.3-beta

* Add improvements made in #4687
2022-10-18 09:42:37 -05:00
Chris Stewart
2482eb939a
remove v17 bitcoind rpc (#4822)
* 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
2022-10-16 12:47:43 -05:00
Chris Stewart
1a220a3937
2022 10 14 v19 testkit refactor (#4843)
* 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
2022-10-15 13:50:44 -05:00
Chris Stewart
2a617558dd
Fix type signature (#4830) 2022-10-15 07:14:34 -05:00
Chris Stewart
6683259652
Try upgrading clightning tests to newest bitcoind (#4829) 2022-10-15 07:13:42 -05:00
Chris Stewart
718053668d
2022 10 07 node test fixes (#4819)
* Add CachedBitcoindPairNewest

* Try to get ReConnectionTest to use test fixtures

* Empty commit to run CI
2022-10-07 09:49:25 -05:00
Chris Stewart
34e023e93f
2022 09 29 handle unordered sigs (#4807)
* 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
2022-09-29 11:43:50 -05:00
Chris Stewart
2c85f92b18
Fix bug in DualWalletTestCachedBitcoind where we didn't pass pgUrl (#4806)
* 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
2022-09-27 15:11:48 -05:00
Chris Stewart
9c506b639f
Add OrderedSchnorrSignatures, use it in OracleAttestment (#4803)
* Add OrderedSchnorrSignatures, use it in OracleAttestment, propagate it threw the codebase

* Small cleanups

* Add SortedVecFactory

* Fix test case with out of order nonces
2022-09-26 19:35:04 -05:00
Chris Stewart
a1fad6bcc4
Fix bug where postgres tests weren't running on dlcWalletTest/test (#4801)
* Fix bug where postgres tests weren't running on dlcWalletTest/test, fix postgres bugs

* Simplify and add a comment

* fix dbCommonsTest/test

* Cleanup
2022-09-24 14:51:14 -05:00
benthecarman
c0443a972d
Have EmbeddedPg check PG_ENABLED value (#4791) 2022-09-20 06:55:40 -05:00
benthecarman
6b479e8765
Add support for mac m1 lnd rpc (#4780)
* Add support for mac m1 lnd rpc

* Remove unneeded wait

* Add timeout to isStarted

* Consider RPC_ACTIVE not started

* Fix formatting
2022-09-14 15:35:28 -05:00
benthecarman
8bbfbc89d7
Add handling so test lnd clients can be reached by docker (#4729)
* Add handling to test lnd clients can be reached by docker

* Subsitute during config construction instead in call credentials
2022-09-08 08:07:39 -05:00
Chris Stewart
26595ab3ac
Fix bug where no exception was thrown if the acceptor did not have enough money (#4728)
* 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
2022-09-07 19:08:27 -05:00
benthecarman
018a6e58ee
Add [regtest] section to fixture config (#4717) 2022-09-07 05:56:55 -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
ea123139d9
Remove support for bitcoind v16 rpc client (#4634) 2022-08-21 08:17:16 -05:00
rorp
7b754138b8
Drop support for the experimental bitcoind version (#4586)
* Drop support for the experimental bitcoind version

* update docs
2022-08-08 14:48:33 -05:00
rorp
0404cffe26
Embedded Pg v1.0.1 (#4567)
* 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>
2022-08-06 07:30:26 -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
benthecarman
f286b42c71
Retry lnd startup if it fails (#4573) 2022-08-04 16:43:09 -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
a02e25b0ce
Refactor WalletRoutes to take DLCWalletLoaderApi as a paramete (#4565)
* 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
2022-08-04 09:16:46 -05:00
rorp
78648f1e40
PostgreSQL friendly wallet names (#4571)
* Postgres friendly wallet names

* cleanup

* fix unit tests
2022-08-04 08:54:33 -05:00
Chris Stewart
8cb45e8208
Add unit tests for loader rescans (#4570)
* Add unit tests for loader rescans

* Move common methods into super class to be DRY

* Cleanup
2022-08-03 13:16:52 -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
Shreyansh
8b646802b3
Fix postgres database not clearing after test (#4558)
* fix postgres database not clearing after test

* Empty commit to run CI

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-01 07:49:55 -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
2cd8c80f67
Refactor so we don't create multiple WalletAppConfig in testkit (#4548)
* Refactor so we don't create multiple WalletAppConfig in testkit

Fix buildBip39PasswordConfig

* Remove bip39Password argument from dlcWalletTest fixtures

* Fix allowExternalDLCAddresses config in tests

* Remove unnecessary overrides of BitcoinSWalletTest.getFreshConfig, fix docs

* Add DLCExecutionBackendTest.afterAll()

* Fix nodeTest bip39Password usage

* Fix bug where we weren't using correct config inside of getFreshConfig

* Fix DLCExecutionBitcoindBackendtest.afterAll()

* Fix RescanDLCTest
2022-07-30 17:20:18 -05:00
GreyMcCarthy
3ae169a41f
V22 RPC Support Update Continued (#4424)
* 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>
2022-07-28 07:53:08 -05:00
Chris Stewart
b69e487d04
Move MockChainQueryApi/MockNodeApi out of BaseWalletTest (#4542)
* 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
2022-07-27 10:18:22 -05:00
Chris Stewart
a2e7c428cf
Bump sleeps on CallbackUtilTest (#4534)
* 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
2022-07-25 06:36:48 -05:00
benthecarman
f1e9a34690
Remove hard coded values for embedded pg config (#4533) 2022-07-24 13:21:32 -05:00
Chris Stewart
b905afa65e
2022 07 20 wallet rescan stream (#4530)
* 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
2022-07-24 12:26:21 -05:00
benthecarman
412e6a06c4
Allow pg embedded better support for 3rd party libraries (#4532) 2022-07-24 07:26:35 -05:00
Chris Stewart
d4210fad65
Pull over changes from loadwallet branch (#4527) 2022-07-21 12:12:32 -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
rorp
5d309fbae0
Fee rate WS notification (#4518)
* Fee rate WS notification

* make the test more CI friendly

* fix the default config

* always return errors

* fix build

* scalafmt

* send notifications every time
2022-07-19 16:41:06 -05:00
Chris Stewart
0cb93ddbf4
2022 07 17 node callback akka streams (#4516)
* 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
2022-07-19 13:45:41 -05:00
rorp
e90e372e54
Add sync JSON field to the getinfo endpoint output (#4452)
* 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
2022-07-12 14:41:43 -05:00
Chris Stewart
1ae4d40dac
Implement rescancomplete callback (#4475)
* Implement rescancomplete callback

* Add walletName to payload

* Add to documentation
2022-07-09 16:23:15 -05:00
Chris Stewart
de935032ea
Make coreTestJVM.dependOn(testkit), add new multi core dispatcher to allow more cores for TaprootTTests to hopefully take load off the scala execution context (#4477) 2022-07-09 09:40:39 -05:00
Shreyansh
0b53c7be12
Change tests to use disconnectnode rpc instead of restarting bitcoind (#4468)
* change tests to use disconnectnode rpc instead of restarting bitcoind

* fix issue with querying for node uri when not initialized
2022-07-08 18:53:37 -05:00