Commit Graph

264 Commits

Author SHA1 Message Date
Chris Stewart
458f3cb7d3
2024 07 29 rm tx bitcoind callbacks (#5632)
* fix docs

* Fix docs

* WIP

* Integrate BitcoindCallbacks

* Revert loback-test.xml

* Remove logs
2024-08-03 05:16:57 -07:00
Chris Stewart
e68ebeadbc
refactor: Create UtxoHandlingApi, move to has-a relationship within Wallet (#5624)
* refactor: Create UtxoHandlingApi, move to has-a relationship within Wallet

* Add WalletApi.{markUTXOsAsReserved, unmarkUTXOsAsReserved, listUtxos(state), listUtxos(account), listUtxos(tag)}

* move listUtxos(account) into NeutrinoHDWalletApi

* cleanup

* Revert files

* Revert more files

* Remove comment
2024-07-22 14:40:48 -05:00
Chris Stewart
d13e12afae
2024 05 11 wallet xsource3 (#5588)
* Add -Xsource:3 to chain/

* -quickfix chainTest

* Add -Xsource:3 to wallet/ wallet-test/ dlc-wallet/ dlc-wallet-test/
2024-05-11 09:49:10 -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
a6d93622f8
2024 04 16 descriptor fidelity (#5529)
* Implement unit tests for key expression fidelity to user input for hardened paths

* Create HardenedType, rework BIP32Node to take Option[HardenedType] as a parameter

* Fix docs
2024-04-17 18:35:33 -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
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
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
cb26f6de07
Add WalletZmqSubscribers (#5423)
Move connection logic into ZMQSubscriber.start() rather than SubscriberRunnable
2024-02-26 11:28:39 -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
af74450c62
Cancel polling job after walletTest is executed (#5379) 2024-01-31 10:24:44 -06:00
Chris Stewart
5c2c8ee30b
2023 10 19 recursive rescan state (#5269)
* WIP: Implement future chaining for recursive rescans

* Fix deadlock by segregating RescanStarted.doneF into two different methods, one tracking the single pass rescan and one tracking the entire rescan

* scalafmt, add comment

* Fix bug where we were completing Promise twice

* Fix unit test

* Cleanup logs

* Cleanup comment

* Bump timeout

* Empty commit to run CI

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-10-24 08:13:45 -05: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
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
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
36f30c5915
Fix bug where bip39Password was not passed as param in test case (#5040)
* Fix bug where bip39Password was not passed as param in test case

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-04-08 22:19:13 -05:00
Chris Stewart
36ec40dfa3
implement generating addresses when wallet is initialized if creationTime is > 1 hour ago (#5034) 2023-04-04 11:40:26 -05: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
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
benthecarman
1d1af1d52e
Add generate helper function for bitcoind (#4852) 2022-10-19 14:22:30 -05:00
rorp
ddc672cc46
Fix unconfirmed -> confirmed state change (#4816)
* Fix unconfirmed -> confirmed state change

* refactor

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-10-06 07:06:18 -05:00
benthecarman
cad13182df
Use postrgres when flagged in TrezorAddressTest (#4768)
* Use postrgres when flagged in TrezorAddressTest

* Clean database on shutdown
2022-09-15 20:07:51 -05:00
Chris Stewart
2bf1c9d1a5
Try to debug what is happening on CI with zmq test (#4708)
* Try to debug what is happening on CI

* Turn off logging

* Fix compile errors

* try to add sleep to get zmq started

* Cleanup

* Empty commit
2022-09-05 13:23:10 -05:00
Chris Stewart
a0eb0824a2
Fix some bugs around resetting rescan state when a rescan fails (#4642)
* Fix some bugs around resetting rescan state when a rescan fails

* Add test case

* Use .fail() method
2022-08-22 12:55:18 -05:00
Chris Stewart
c09da6f116
Bump rescan test timeouts from 5 -> 10 seconds (#4639)
* Bump rescan test timeouts from 5 -> 10 seconds

* Empty commit

* Use AsyncUtil.awaitCondition rather than a hard timeout
2022-08-22 08:52:43 -05:00
Chris Stewart
eb1327824b
Fix bug where we were not generating change addresses during a rescan (#4631)
* Fix bug where we were not generating change addresses during a rescan with a fresh address pool

* Turn logging level down

* Add awaitRescanDone before checking addresses

* Alternate order we clear addresses and utxos
2022-08-20 13:23:27 -05:00
benthecarman
6119a334fa
Make fundRawTransactionInternal use DBIOActions (#4575)
* Make fundRawTransactionInternal use DBIOActions

* Fix to correctly use callback

* Move reservedUTXOsCallbackF to FundRawTxHelper
2022-08-06 17:14:02 -05:00
rorp
cf22816003
Fix rescan batch boundary bug (#4549)
* Fix rescan batch boundary bug

* Make arguments for rescan required to avoid bugs

* WIP: Debug rescan batches

* Add forceGenerateSpks to fix one bug

* Remove addressCount != 0 check now that we have forceGenerateSpks

* Remove comment

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-06 14:07:35 -05:00
Chris Stewart
c89491c3e7
2022 07 29 fix multiple batch test (#4556)
* Fix multiple batch unit test so it fails

* Fix compile

* Move generateScriptPubKeys into buildFilterMatchFlow()

* Rename param to filterBatchSize

* Rename to buildRescanFlow

* Remove println

* Cleanup
2022-08-03 12:33:37 -05:00
Chris Stewart
b1a7f92c67
Refactor to not use filterThenSum() when calculating balances (#4562)
* Refactor to not use filterThenSum() when calculating balances

* Add await for balance as blocks are processed async

* Add more assertions, fix bad assertions I introduced
2022-08-02 12:33:46 -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
Chris Stewart
af9e5eaeef
Expose DBIOActions for various models in wallet, remove address queue (#4524)
* Expose DBIOActions for various models in wallet, use them in generateScriptPubKeys

* Remove addresses queue

* Remove test case

* Fix rebase
2022-07-31 10:36:45 -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
Chris Stewart
17ef1dcdd9
Fix rescan flag getting set, add unit test (#4554) 2022-07-29 15:17:48 -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
f608c5d5e4
Create a helper case class called FundRawTxHelper (#4544)
* Create a helper case class called FundRawTxHelper to encapsulate the values returned by fundRawTransactionInternal

* Return FundRawTxHelper[ShufflingNonInteractiveFinalizer]

* make FundRawTxHelper.signedTx be a lazy val
2022-07-27 17:12:42 -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
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
Chris Stewart
d4210fad65
Pull over changes from loadwallet branch (#4527) 2022-07-21 12:12:32 -05:00
benthecarman
c210052640
Refactor coin selection to be not be bitcoin-s specific (#4496)
* Refactor coin selection to be not be bitcoin-s specific

* Add to CoinSelectorUtxo
2022-07-20 08:40:11 -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
rorp
414557effb
Add imported flag to the seed JSON (#4459)
* Add `imported` flag to the seed JSON

* scalafmt

* update `walletinfo`

* fix docs

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-07-08 18:55:47 -05:00
rorp
a7aad46934
Seed backup API (#4357)
* Seed backup API

* respond to the PR comments

* exportseed/importseed symmetry

* update docs
2022-06-22 08:14:11 -05:00
GreyMcCarthy
5f82307e27
Added Compute Contract Id test Vectors (#4385)
* Testing contract id calculation

* Added implicit json reader imports
2022-06-13 14:13:48 -05:00
Shreyansh
d8fc8e588f
Remove Spv code (#4356)
* change node tests to neutrino

* get node test working

* merge DataMessageHandlerTest and DataMessageHandlerNeutrinoNodeTest

* delete unused files

* remove commented out spv parts

* formatting

* delete spv node

* remove merkle callback for neutrino node

* remove spv node wallet callbacks

* formatting

* remove SpvWalletApi

* replace SpvTestConfig with NeutrinoTestConfig

* more replace SpvTestConfig with NeutrinoTestConfig

* minor fix

* fix tests
2022-05-30 07:57:31 -05:00
rorp
f680ab8691
Persist whether wallet is rescanning in the database (#4326)
* Persist whether wallet is rescanning in the database

* fix cli

* fix build

* fix unit tests

* fix postgres tests

* remove wallet_state table

* fix rescan bug

* cleanup

* revert Cancellable's

* Cleanup

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-05-23 19:03:02 -05:00
Chris Stewart
6db1f26625
2022 03 22 getrelevantoutputs upfront (#4219)
* WIP

Try and debug

WIP

Fix bug for incomingAmount

Clean up logs

more cleanups on logs

Remove another uncessary log

Don't process tx if we don't have a relevant received output for that specific tx

* Group hashes in batches of 1,000 before querying the db
2022-04-26 11:12:44 -05:00
rorp
3831b35817
Prevent the wallet from creating duplicate UTXOs (#4290)
* Prevent the wallet from creating duplicate UTXOs

* respond to the PR comments

* cleanup
2022-04-25 11:56:37 -05:00