Commit Graph

234 Commits

Author SHA1 Message Date
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
rorp
f5940c93d4
Contact list (#4234)
* Contact list

* fix unit tests

* Add contact rpc tests

* Add documentation

* Refactor ConsoleCli into app-commons

* Add commands to bitcoin-s-cli

* Fix timeout for rescan

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-04-21 13:02:35 -05:00
Chris Stewart
5ad5993f1a
Refactor WalletAppConfig test fixture destructions to stop the config… (#4266)
* Refactor WalletAppConfig test fixture destructions to stop the config when tearing down

* Fix test fixture where walletappconfig might not be started
2022-04-17 09:23:21 -05:00
Chris Stewart
24125eaca3
Fix case where we broadcast tx with a tag, and then also add the tag when we receive the tx in a block (#4239) 2022-04-03 13:40:19 -05:00
Chris Stewart
33171fd069
Use the set of addresses in the wallet when rescanning rather than generating more (#4211) 2022-03-26 06:22:09 -05:00
rorp
0770fe0550
Mempool support for the bitcoind RPC client (#4196)
* Mempool support for the bitcoind RPC client

* fix unit tests

* fix race conditions

* fix compile error

* add more logging
2022-03-22 15:40:27 -05:00
Chris Stewart
413dbcacbb
Rename clearUtxosAndAddreses(account) -> clearUtxos(account) (#4206) 2022-03-22 13:08:03 -05:00
Chris Stewart
d5807daeab
Remove SpendingInfoDb.txid parameter (#4199) 2022-03-19 15:21:36 -05:00
Chris Stewart
46229d712c
Rename clearAllUtxosAndAddresses() -> clearAllUtxos() (#4193)
* Rename clearAllUtxosAndAddresses() -> clearAllUtxos()

* Fix unit test

* Fix docs
2022-03-16 08:53:08 -05:00
Chris Stewart
668ab21ca1
2022 03 09 label refactor (#4175)
* Rename existing getaddresslabels -> getaddresslabel

* Fix missing rename of GetAddressLabel

* Modify pk constraint on wallet_address_tags to be tag_name rather than tag_type

* Add dropaddresslabel for a specific address

* Fix migrations

* Add unit tests and fix existing tests

* Add docs
2022-03-09 15:36:44 -06:00
Chris Stewart
c11d9ef1fe
Fix unit test where coinbase input was sometimes selected (#4165) 2022-03-04 16:09:08 -06:00
Chris Stewart
4cefa56c99
Add unit test for address creation when we are already watching the script (#4152)
* Add unit test for address creation when we are already watching the script

* revert wallet

* Add upsert test too

* revert test again
2022-03-03 07:36:44 -06:00
Chris Stewart
374c1d7b9f
Upgrade RescanHandlingTest to use the newest release of bitcoind (#4151) 2022-03-02 09:59:25 -06:00
Chris Stewart
7a5c2971dd
Refactor receive flow to use the same utxo state transitions (#4134)
* Refactor receive flow to use the same utxo state transitions as the rest of the wallet

Get tests passing again with refactored utxos

Remove unecessary wallet methods

Fix test cases

* Remove fixture on UTXOHandlingTest

* Fix bug where funding happens in parallel in fixture and can lead to blockchain reorgs
2022-02-26 19:08:50 -06:00
Chris Stewart
c069b01e53
2022 02 24 rm prune addresses after rescan (#4130)
* Fix bug where we prune unused addreses on rescan. This doesn't let us discover funds for addresses sent that were not paid to until after the rescan was completed

* Add test case

* Fix neutrino node test case

* Some cleanup
2022-02-26 07:43:23 -06:00
Chris Stewart
3ba95700b2
Add RescanState, make sure we don't start concurrent rescans (#4131) 2022-02-25 05:23:51 -06:00
Chris Stewart
e6bf7bd67e
Segregate updating received utxos and spent utxos (#4093)
* Fix UTXOHandlingTest cases

* Reduce log level

* Add comments, fix bugs so that we can transition from TxoState.ConfirmedReceived -> TxoState.PendingConfirmationsReceived

* Fix BroadcastSpent/BroadcastReceive bugs

* Add scaladoc to updateUtxoStates()

* Break receive and spent tests into two test cases

* Remove unneeded database write

* Fix rebase
2022-02-20 15:37:52 -06:00
Chris Stewart
528e7c8f0e
Remove TxoState.DoesNotExist (#4108) 2022-02-18 16:31:03 -06:00
Chris Stewart
dc47c070a2
Fix SpendingInfoDAO.findOutputsReceived() bug (#4090) 2022-02-14 10:11:23 -06:00
rorp
4d85b7a3d7
Support for big SPKs (#4084)
* Support for big SPKs

* Support for big SPKs

* Bump number of migrations

* Fix other test case

* cleanup

* cleanup

* fix psql migrations

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-02-14 07:22:34 -06:00
Chris Stewart
cf16d93648
Fix bug where we didn't set spendingTxId when transitioning from Reserved -> PendingConfirmationsSpent (#3909)
* Fix bug where we didn't set spendingTxId when transitioning from Reserved -> PendingConfirmationsSpent

* Try to add unit test

* WIP

* WIP2

* Get reserved state working

* Fix assertion, cleanup logs

* Cleanup test case
2022-01-28 06:50:24 -06:00
Chris Stewart
b918cf78b7
Fix bugs where we were building internally inconsistent SpendingInfoDb (#4016)
* Fix bugs where we were building internally inconsistent SpendingInfoDb

* Fix error message
2022-01-27 07:22:09 -06:00
Chris Stewart
e802254a20
2022 01 24 rm appconfig varargs (#4011)
* Get things compiling

* Get tests passing

* Fix docs
2022-01-25 07:25:05 -06:00
Chris Stewart
52dcf51e82
Automatically download binaries if they are used in test suite (#4005)
* Remove download binary scripts from CI, try to make binary downloads contingent on tests being run in a project

* Cleanup docs to remove unecessary downloadBitcoind
2022-01-23 17:43:30 -06:00
rorp
21c97bba12
Filter transactions for onTransactionProcessed (#3990) 2022-01-18 09:52:41 -06:00
Chris Stewart
9dd126bb9f
Modify estimatefee endpoint to return a number rather than a string (#3973)
* Modify estimatefee endpoint to return a number rather than a string

* Fix compile

* Fix infinite loop on converting to sats/vb, add tests
2022-01-12 12:17:04 -06:00
Chris Stewart
d06b064b6b
2021 12 28 blockprocessed callback (#3946)
* WIP

* Get appServerTest passing with chain notifications

* Reorder where SourceQueue gets initialized so that we can use it to construct the wallet's callbacks

* DRY

* Fix missing callback for neutrino chaincallbacks

* Bump timeout

* Bump timeout

* When wallet is empty call doSync() with the last blockheader bitcoind has seen

* Revert skipping compact filters on IBD for bitcoind

* Revert logging
2021-12-30 13:41:17 -06:00
Chris Stewart
2d9d12816b
Add WalletCallbacks.onBlockProcessed() (#3912) 2021-12-16 12:26:48 -06:00
Chris Stewart
8307fdc0d1
2021 12 12 wallet doublespend tests (#3898)
* WIP

* Fix sql queries, fix up unit tests that were implicitly using wallet.processOurTransaction()

* Remove default parameter markAsReserved=false on FundTransactionHandling.fundRawTransactionInternal()

* Fix submodule

* Add test to make sure if we fail to reserve utxos, we roll the database transaction back

* Add some clarifying comments

* address ben's code review for failures in finishSend()

* Scalafmt
2021-12-15 07:03:11 -06:00
Chris Stewart
ba88fb1a03
2021 11 12 fix multiple tag issue (#3822)
* WIP

* Add test case to make sure we can tag an address multiple times

* Actually assert the tagnames/addresses
2021-11-12 15:57:39 -06:00
Chris Stewart
b3d61bc793
Add deleting address tags to to clearAllUtxosAndAddresses() (#3817)
* Add deleting address tags to to clearAllUtxosAndAddresses()

* assert address tag return is empty
2021-11-12 08:53:55 -06:00