Commit Graph

561 Commits

Author SHA1 Message Date
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
625e790477
Rework TransactionProcessing to be a has-a relationship rather than is-a relationship in the codebase (#5659)
Refactor TransactionProcessing into case class

Get walletTest/test passing

DLCWallet WIP

Get dlcWalletTest/test passing

Small cleanups

Fix RoutesSpec gettransaction unit test

revert logback-test.xml

cleanup
2024-09-18 12:51:21 -05:00
Chris Stewart
7d8dd2bc0a
refactor: Provide DLCWalletUtil.verifyProperlySetTxIds() with the contractId (#5657) 2024-09-07 16:21:16 -05:00
Chris Stewart
feeb2618d6
Move DLCDAOs to src (#5652) 2024-08-28 06:56:28 -05:00
Chris Stewart
2021f1f111
2024 08 13 walletholder appserver refactor (#5639)
* Implement creatnewaccount rpc

# Conflicts:
#	app-commons/src/main/scala/org/bitcoins/commons/serializers/Picklers.scala
#	app/cli/src/main/scala/org/bitcoins/cli/ConsoleCli.scala
#	app/server-test/src/test/scala/org/bitcoins/server/WalletRoutesSpec.scala

* Get WalletRoutesSpec createnewaccount unit test passing

* Rename HDPurposes -> HDPurpose

* Implement ConsoleCli arg, change HDPurpose json serialization to be a json string instead of a num

* Refactor BitcoinSServerMain to use return Unit rather than WalletHolder

* Generate block in sync flag unit test

* Empty commit to re-run CI
2024-08-15 10:25:14 -05:00
Chris Stewart
41fab3dfd2
2024 08 07 createnewaccount rpc (#5638)
* Implement creatnewaccount rpc

* Get WalletRoutesSpec createnewaccount unit test passing

* Rename HDPurposes -> HDPurpose

* Fix docs

* Implement ConsoleCli arg, change HDPurpose json serialization to be a json string instead of a num
2024-08-13 10:32:03 -05:00
Chris Stewart
0eb1788226
Refactor WalletApi.createNewAccount to not use KeyManagerParams (#5635) 2024-08-10 15:17:35 -07: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
f5adc331f1
Move WalletDAOs to src (#5626) 2024-07-23 14:48:15 -05:00
Chris Stewart
a6b7fada50
Get rest of codebase compiling with -Xsource:3 (#5592) 2024-05-11 14:13:36 -05:00
Chris Stewart
9fe67bbdbe
Remove remaining 2.13 specific code as 2.13.x is the only compiler version supported (#5576)
Fix compile

Remove compat
2024-05-09 09:05:07 -05:00
Chris Stewart
cb3fbe523a
Rework BitcoindRpcTestUtil.getBinary() to match major and minor versions of bitcoind binary when possible (#5569) 2024-05-06 13:00:07 -05:00
Chris Stewart
7ed2b8801a
2024 04 30 upgrade eclair v0.10.0 (#5557)
* Fix open, audit commands for v0.10.0

* Get all unit tests passing

* Add logger.error() to try to debug channel state

* Try adding delay to see if dual funding process can complete before we generate blocks

* scalafmt

* Try bumping number of blocks generated

* Try disabling dual funding

* Cleanup
2024-04-30 14:25:50 -05:00
Chris Stewart
7ee749adcb
2024 04 29 eclair upgrade v0.9.0 (#5556)
* Rework EclairRpcTestUtil.shutdown() to shutdown eclair/bitcoind separately

* Fix keysend test

* Add new eclair websocket events

* Empty commit to re-run CI

* First bug where we weren't shutting down a bitcoind in eclairRpcTest
2024-04-30 07:36:36 -05:00
Chris Stewart
819a047d1e
Add support for lnd 0.17.5-beta (#5554)
* Add support for lnd 0.17.5-beta

Switch Lnd fixture back to BitcoindVersion.newest

Fix linux build

Update lnd windows hash

Fix lnd mac intel hash

* Update proto files

* Revert changes that removed mapping for numeric UInt32, UInt64 types

* Fix version
2024-04-29 13:04:29 -05:00
Chris Stewart
6543b261c4
Implement bitcoind RPC 27.0 (#5552)
* Add bitcoind 27.0

* Fix linux, windows hashes

* Add BitcoindV27RpcClient

* Switch BitcoindVersion.newest = V27

* Try downgrading lndRpcTest to use V26 in tests

* Make pattern matching against 'bitcoind --version' more resilient for new versions of bitcoind

* Add awaitDisconnect() to BitcoindRpcTestUtil.disconnectNodes(), fix flaky v2 connection in unit test
2024-04-28 13:16:39 -05:00
Chris Stewart
7ef6086673
Implement bitcoind RPC 26.x (#5550)
* Get build started for 26.1

* Start introducing v26 data structures

* Switch BitcoindVersion.newest = V26

* Fix GetTxOutSetInfoResult to use hash_serialized_3

* Fix WalletRpcTest

* Refactor PeerInfoResponse to add transport_protocol_type and session_id fields in v25

* Add ServiceIdentifier.NODE_P2P_V2, add support for v2transport to addnode, add default config setting for bitcoind to have v2transport=1 in test framework, add unit test to make sure we can establish a v2 connection

* Remove V20AssortedRpc

* Add loadtxoutset

* Implement getchainstates

* Add getprioritisedtransactions

* Add getaddrmaninfo

* Add importmempool

* Cleanup println
2024-04-27 14:51:45 -05:00
Chris Stewart
5dc5cca9cf
2024 04 24 rm v24 (#5549)
* WIP

* Fix simulaterawtransaction test

* Remove unneeded AdressInfoResult data strutures for versions of bitcoind pre-v21

* Remove v24

* Remove support for v24 bitcoind from bitcoind-rpc.sbt

* Fix tests

* Fix UtilRpcTest

* Fix teardown of bitcoind

* scalafmt
2024-04-26 11:58:55 -05:00
Chris Stewart
1d42de0977
Make wallet.dat be the default wallet name for bitcoind in our codebase (#5543)
* Make 'wallet.dat' be the default wallet name in our codebase

* Fix MultiWalletRpcTest
2024-04-25 06:51:39 -05:00
Chris Stewart
23e32652f3
Implement bitcoind 25.2 (#5540)
* Implement downloading of bitcoind 25.2

* Add aarch64 hash

* Update x86 macos hash, windows hash

* WIP: scanblocks RPC

* Get in progress scanblocks state working

* Get scanblocks start request working

* Fix BitcoindRpcTestUtil.signRawTransaction

* Implement scanblocks abort

* Remove println

* Switch newest version of bitcoind to v25

* Fix BitcoindV25RpcClient.version

* move decodescript test to WalletRpcTest, rework decodescript test to use descriptors,  fix LoadWalletResult

* Empty commit to run CI

* sendrawtransaction maxburnamount param

* Modify testmempoolaccept RPC return type to have two new fields for fee information

* Add test for base too
2024-04-23 17:26:23 -05:00
Chris Stewart
68d267ab8c
2024 04 21 bitcoindrpc testfixtures (#5539)
* Get MiningRpcTest, MessageRpcTest using test fitures

* Remove MultisigRpcTest, move test case to WalletRpcTest

* WIP: P2PRpcTest with fixtures

* Get P2PRpcTest working, comment out test cases that require unconnected nodes for now

* upgrade UtilRpcTest, RawTransactionRpcTest to use test fixture

* Upgrade UTXORpcTest to use test fixtures

* Create DisconnectedPeersRpcTest, create disconnected test fixtures for it

* Remove PreciousBlockRpcTest suite, move test into DisconnectedPeersRpcTest

* Remove UtilRpcTest, move test cases into other files

* Fix unit tests

* Fix rebase
2024-04-22 07:47:00 -05:00
Chris Stewart
f7adb6264e
Remove support for 23.x of bitcoind (#5538)
* Remove support for 23.x of bitcoind

* Remove duplicate test

* Fix compile

* Move unit bech32m unit test earlier in WalletRpcTest

* Make wallet name unique in WalletRpcTest
2024-04-22 05:50:32 -05:00
Chris Stewart
7b3463229f
2024 04 21 Remove BitcoindV22RpcClient (#5537)
* WIP: Remove v22

* Remove TestMempoolAcceptRpc, move it into MempoolRpc

* Remove downloading of bitcoind v22 from bitcoind-rpc.sbt

* move test case above where other test cases create wallets

* Remove duplicate test

* Remove duplicate test
2024-04-21 12:24:09 -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
9442dba217
Remove support for v21 of bitcoind (#5496)
* Remove support for v21 of bitcoind

* WIP: Remove deprecated rpcs wit legacy wallets

* WIP: Work up to importdescriptor

* Get low-r test case passing

* Simplify test case

* Remove BitcoindV21RpcClientTest and move test cases to BitcoindV24RpcClientTest

* Remove RpcTransactionRpcTest that only works on legacy wallet

* Fix MempoolRpcTest

* Delete MultisigRpcTest that depends on legacy wallet

* Get WalletRpcTest passing, ignore keypoolrefill test case for now until https://github.com/bitcoin/bitcoin/issues/29924 is resolved
2024-04-20 16:57:30 -05:00
Chris Stewart
d162242a39
2024 03 24 v21 rpc refactor (#5494)
* WIP: Consolidate V19FilterRpc into BlockchainRpc

* Implement ChainApi.getFilterHeader() with bitcoind

* Make {BitcoindV22RpcClient,BitcoindV23RpcClient,BitcoindV24RpcClient} extend BitcoindRpcClient directly

* Fix MiningRpcTest

* Remove cast in BitcoindBackendTest
2024-03-26 13:04:26 -05:00
Chris Stewart
177542a13c
Remove grizzled.sl4fj was its no longer maintained (#5482) 2024-03-18 16:48:58 -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
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
8b23b1f4f6
Add delay to wait for zmq to get setup in chainTest (#5427)
* Add delay to wait for zmq to get setup in chainTest

* Add println

* only run zmq tests on CI

* Bump Thread.sleep from 1ms -> 10ms

* Empty commit to re-run CI

* Revert things

* try making thread names more unique

* try no sleep

* Remove println

* Put logging back

* Try removing ZMQ.NOBLOCK

* turn off parallelExecution to see if it matters

* Add more logging

* Re-enable parallelExecution

* Try catching all NonFatal exns

* Bump timeout

* Bump maxTries

* Try downgrading jeromq back to 0.5.4

* Revert things

* scalafmt
2024-03-03 11:54:50 -06:00
Chris Stewart
8f812c644f
Fix Promise already completed errors in chainTest (#5440) 2024-02-29 14:53:55 -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
3177ee405f
Move away from suredbits provided peers by default (#5390)
* Move away from suredbits provided peers by default

* Remove setting bitcoin-s.node.use-default-peers

* Don't allow peer to stay connected if it doesn't support compact filters

* Move disconnection logic into managePeerAfterInitialization()

* Remove reconnect() when we have no other peers, send getaddr message after we know we are keeping the peer connection

* Remove hasCf flag check, revert log

* Reduce inactivity-timeout to 5 minutes by default, shuffle peers in PeerFinder beforing pushing onto stack

* Add logic to disconnect AttemptToConnect peers after addr mesage is received

* Create PeerFinder.queryForPeerConnections(), call it directly from PeerManager on health checks rather than restarting PeerFinder

* scalafmt

* Move more logic into managePeerAfterInitalization()

* Don't set isPersistent for db peers by default

* Add call to queryForPeerConnections() inside of PeerManager.onDisconnect() to try to attempt to more peers when we have no more connections, fix MisBehavingPeer logic to not start sync, starting sync should happen in onDisconnect()

* Revert logback-test.xml

* Sort peers we are attempting to connect to by lastSeen parameter

* Refactor DoneSyncing.toHeaderSync() to return Option[HeaderSync] to represent the case where we don't have a peer to sync with

* scalafmt

* Remove duplicate PeerFinder.buildPeerData()
2024-02-20 12:12:57 -06:00
Chris Stewart
e4fbfe73e6
2024 02 16 fix get filter sync marker from stop block header bug (#5401)
* Fix bug in getFilterSyncMarkerFromStopBlockHeader where we were previously querying for children rather than the block hashes at the given height for building the FilterSyncMarker for getcfilter request. Also introduce delay in sending getcfheader because of https://github.com/bitcoin/bitcoin/issues/27085

* Only fallback to reorg scenario if we find no headers at height + 1

* Remove the best filter's block header from the candidate headers in reorg scenarios
2024-02-17 06:26:55 -06:00
Chris Stewart
1685c84eea
2024 01 31 Refactor BitcoindRpcTestUtil.{startSevers(),stopSevers()} to use Future.traverse() (#5382)
* Refactor BitcoindRpcTestUtil.startServers() to use Future.traverse()

* Refactor BitcoindRpcTestUtil.stopServers() to use Future.traverse()
2024-01-31 15:20:36 -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
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