Commit Graph

278 Commits

Author SHA1 Message Date
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
benthecarman
92ab9faa45
Decide which coin selection solution to use based on waste metric (#3646)
* Decide which coin selection solution to use based on waste metric

* Fix test

* Fix NeutrinoNodeWithWalletTest
2021-10-19 09:47:28 -05:00
Chris Stewart
9e43a242fa
Fix logical error on getunconfirmed balance for an account (#3721)
* Fix logical error on getunconfirmed balance for an account

* Actually call getunconfirmedbalance

* remove println

* Run scalafmt
2021-10-05 06:23:30 -05:00
Chris Stewart
ea375f9c55
Actually validate master xpub on startup (#3719)
* Fix bug where we didn't validate the master xpub on oracle server startup

* Add test for WalletAppConfig and seeds

* Remove comments

* Fix scalafmt
2021-10-04 10:37:37 -05:00
Chris Stewart
48213d9b81
Implement MasterXPubDAO (#3451)
* Implement MasterXPubDAO

* Fix nits

* Add postgres migrations

* Make sure tables are getting cleaned on postgres

* Get dlcOracleTest test cases passing with validation of the master xpub in the database on startup

* Fix test case

* Fix more tests

* Move things around so keymanager does not need to depend on dbCommons

* Get all walletTest passing

* Add unit test for wallet startup

* Fix rebase

* Get all sqlite tests passing

* Get postgres test cases passing locally

* Remove early call to walletAppConfig.start() in node project

* Make KeyManagerAppConfig.externalEntropy private

* Fix MasterXpubDAO.existsOneXpub()

* Fix bug in migrating database for oralce project
2021-09-21 08:05:23 -05:00
Chris Stewart
132479d271
Implement ability to provide external entropy to bitcoin-s (#3672)
* Encapsulate initialization of DLCOracle.start() method

* Use internal WalletAppConfig.kmConf rather than passing in custom key manager parameters

* Add KeyManagerAppConfig.defaultAccountType

* Get all tests passing besides TrezorAddressTest

* Get TrezorAddressTest passing with provided entropy

* Add unit test to make sure we can always derive the seed

* Get docs compiling

* Fix dlcWalletTest test cases

* Add more test cases to keymanager

* Add the new configuration to the example configuration

* Add more test cases

* Remove coverage on 2.12 as it isn't accurate

* Rework DLCOracleAppConfig.start() to call kmConf.start() so the oracle can use entropy provided via bitcoin-s.conf
2021-09-18 09:49:11 -05:00
Chris Stewart
0fb2cd0149
Remove implicit conversions from BitcoinSAppConfig -> {WalletAppConfig,ChainAppConfig,NodeAppConfig} etc (#3652) 2021-09-08 13:54:18 -05:00
Chris Stewart
1f35dbdb85
Fix bug where we weren't waiting on a future to complete in for expression (#3627) 2021-08-29 19:08:05 -05:00
Chris Stewart
f5ed232946
Bump fee by more to make sure our fee rate is increasing the test case (#3625) 2021-08-29 18:08:07 -05:00
Chris Stewart
bedc152f33
Write unit test for SpendingInfoDAO.upsert() (#3620)
* Write unit test for SpendingInfoDAO.upsert(), match on outpoint rather than id

* Add more explicit error message for failing to clear utxos and addresses
2021-08-29 08:00:05 -05:00
benthecarman
184bf415df
More bitcoind backend wallet tests (#3605)
* More bitcoind backend wallet tests

* Use bip39 pass

* Remove database
2021-08-26 08:24:28 -05:00
benthecarman
5df7a8bdf3
Add test for ZMQ Polling backend (#3088)
* Add test for ZMQ Polling backend

* Use TestAsyncUtil, increase maxTries

* Add multiple attempts
2021-07-06 19:20:12 -05:00
benthecarman
bd11c84462
Add ability to sweep wallet (#3274)
* Add ability to sweep wallet

* Respond to review

* empty
2021-06-16 14:37:40 -05:00
Chris Stewart
aaa7b42ae7
Add unit test we can handle spending funds and receiving funds in same tx (#3185)
* Add unit test we can handle spending funds and receiving funds in the same transaction inside the wallet

* Use fundRawTranaction() to make sure the utxo is reserved
2021-06-14 08:57:30 -05:00
Chris Stewart
5caf7ee38b
2021 06 10 cache spendinginfodbs for block (#3245)
* Add mark as spent optimization to batch writes rather than write inside the method

* Scaladoc refactor

* Refactor received spendingInfoDbs to be cached outside of processTransactionImpl()

* Implement processBlockCachedUtxos() to improve performance

* Fix typo
2021-06-11 15:14:02 -05:00
benthecarman
c9798d6842
Test for processing a block we receive and send in (#3189)
* Test for processing a block we receive and send in

* Use psbts
2021-06-08 10:46:54 -05:00
Chris Stewart
72636b7180
2021 05 09 received utxos (#3063)
* Make TransactionProcessing.processTransactionImpl() a bit more parallel, fetch all relevant received and spent txos in parallel

* More refactors, make sure return types are Vector rather than Seq to make sure we don't have any pathlogical surprises with scala collections

* Fix type annoation to be Vector

* Fix remaining usage of Seq in TransactionProcessing

* Fix pattern match on Vector on 2.12.x

* Change input to Vector rather than Seq in processSpentUtxos()
2021-05-12 10:45:23 -05:00
Nadav Kohen
78f4dfb8c6
Pubkey Refactor (#2936)
* Removed ExecutionContext from ECKey

* Refactored ECPublicKey to remove compression state and introduced ECPublicKeyBytes to handle cases where serialization of input is important

* Fixed the rest of bitcoin-s so that it passes all tests

* Made all ECKeys into case classes

* Successfully added isFullyValid invariant to ECPublicKey!

* Fixed docs

* Added scaladocs and fixed a RpcPsbtResult bug

* Reject private keys of length < 32 and fix WIF parsing bug
2021-05-06 13:19:52 -05:00
Chris Stewart
77cd94ac41 2021 04 27 wallet fixtures config (#2980)
* Refactor MultiWalletTest to actually shutdown the walletAppConfigs

* Remove 'implicit' modifier from getFreshWalletConfig. This is a problem as it can be used implicitly to bind resources (threads, files etc) that need to be cleaned up. Since it is implicitly passed, it is very hard to remember to clean up these resources

* Cleanup TrezorAddressTest

* Remove unecessary BitcoinSWalletTest.afterAll()

* Fix docs

* Removal of datadir race condition

* Cleanup nodeTest to shutdown the transitive chainAppConfig required by NodeAppConfig

* remove experimental tag on NeutrinoNodeTest

* Remove extra line

* Cleanup after BitcoindChainhandlerViaZmqTest

* Push to github to force re-run of CI 2
2021-04-29 06:30:58 -05:00
Chris Stewart
73939a15fc Call WalletAppConfig.stop() when destroying wallet in test fixtures (#2975)
* Fix bug introduced in PR 2597, we need to explicitly call WalletAppConfig.stop() now rather than transitively calling it via Wallet.stop()

* Fix calls to wallet.stop() -> wallet.walletAppConfig.stop() in BitcoindBlockPolling,BitcoindBackend. Also add some explicit type annotations
2021-04-26 15:48:33 -05:00
Chris Stewart
a27d4acd9f Get FilterSync test working with cached bitcoind in chainTest project (#2952)
* Get FilterSync test working with cached bitcoind in chainTest project

* Small refactor to be DRY

* Fix docs

* Refactor ChainSyncTest to use 1 cached bitcoind, as a by product add ChainWithBitcoindNewestCachedUnitTest

* Remove unecessary mixin trait

* Fix missing ChainWithBitcoindNewestCachedUnitTest.afterAll()

* Reduce thread pool size for akka's internal dispatcher in unit tests from 2 -> 1. Same with the blocking dispatcher

* Add comment
2021-04-26 07:41:30 -05:00
benthecarman
38fdbb33c4 Add test for tx that doesn't originate from wallet (#2932) 2021-04-20 18:34:38 -05:00
benthecarman
105942efa2 Use filters for bitcoind backend syncing if available (#2926)
* Use filters for bitcoind backend syncing if available

* Start bitcoind polling after sync is done

* Fix compile issue and test
2021-04-20 17:28:23 -05:00
Chris Stewart
19319494cd 2021 04 19 Cleanup after ourselves in postgres tests (#2921)
* Fix missing database shutdown on WalletAppConfig.stop()

* Cleanup BitcoindBlockPollingTest

* Cleanup ProcessBlockTest and all tests that use CachedBitcoind

* Cleanup BitcoindBackendTest

* Cache rescan thread pool rather than creating a new one everytime
2021-04-19 13:58:00 -05:00
Chris Stewart
a3954dbcae 2021 04 17 spendinfodb invariant (#2912)
* Add invariant to spendingInfoDb to that requires if the spendinginfodb is in a TxoState.spentStates, the SpendingInfoDb.spendingTxIdOpt is defined

* Remove unused SpendingInfoDAO.updateTxoState()

* Remove comment

* Make TxoState and explicit parameter for test methods. Most test methods depend on a sample utxo state, so make the caller of the method specify what state they want the txo to be in

* Fix github actions config

* Fix RoutesSpec test
2021-04-18 09:02:49 -05:00
benthecarman
d0629486ab Wallet Rebroadcast Transactions thread (#2711)
* Wallet Rebroadcast Logic

* Use wallet scheduler for address queue rather than it's own thread

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>

* Bump default

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-04-07 08:13:43 -05:00
Nadav Kohen
e6899b20b1 Made ECPrivateKey signing synchronous and got src compiling (#2652)
Fixed tests

De-futured tx buidling, finalizing and signing

Responded to review
2021-03-23 17:05:58 -05:00
benthecarman
c3c96a61c3 Reduce fee rate for spending coinbase utxos (#2815) 2021-03-23 05:56:05 -05:00
Chris Stewart
2287c6ced9 Implement caching of bitcoind in the walletTest,nodeTest, and partially bitcoindRpcTest project (#2792)
* Create CachedBitcoind, implement it in FundTransactionHandlingTest

* Add BaseWalletTest, extend it with BitcoinSWalletTest & BitcoinSWalletTestCachedBitcoind, add CachedBitcoinV19 and use it RescanHandlingTest

* Make ProcessBlockTest work with cached bitcoind

* Make trait for CachedBitcoindNewest for the newest version of bitcoind

* Make UTXOLifeCycleTest use cached bitcoind

* Add WalletBloom, WalletSyncTest to use cached bitcoinds

* Add WalletIntegrationTest

* Rework beforeAll() and afterAll() into the super trait like BaseWalletTest

* Add standlone BitcoindFixtures, use it in BitcoindBackendTest

* Use new BitcoindFixtures in BitcoindBlockPollingTest

* Introduce BaseNodeTest, start implementing the usage of cached bitcoinds in the nodeTest project

* Use cached bitcoind's with SpvNodeTest & SpvNodeWithWalletTest

* Fix bug on postgres with reusing database, upsert the genesis header rather than create it

* Get NeutrinoNode tests workign with cached bitcoinds

* Fix NeutrinoNodeWithWallet by destroying wallet state for Postgres

* Add teardown helper method for bitcoind

* Teardown chain project when using node fixtures since node is dependent upon the chain project.

* Turn off parallelExecution again

* Switch the parallelExecution flag to only be set on CI, so we can get better performance when running locally

* Start implementing BitcoindFixtures, use BitcoindFixturesCachedTriple on TestUtilRpcTest

* Fix compiler errors, begin implementing NodePair

* Refactor TestRpcUtilTest to use 2 bitcoinds rather than 2

* Reduce the number of bitcoinds that MultiWalletRpcTest needs from 3 -> 1

* Reduce number of bitcoinds used in WalletRpcTest from 3 -> 2

* Add some documentation

* Try to re-add parallelExecution

* Reduce the number of bitcoinds used in PsbtRpcTest from 3 -> 2

* Disable parallelExecution in Test again

* Make BitcoindV21RpcClientTest & BitcoindV20RpcClientTest reduce bitcoind usage from 2 -> 1

* Make BitcoindV19RpcClienttest reduce bitcoind usage from 2 -> 1

* Rework MempoolRpcTest to use fixtures, add BitcoindVersion to CachedBitcoindCollection

* Make sure clientAccumm has to be specified as a paramter now rather than filling in by default

* Begin parameterizing NodePair/NodeTriple to retain type information for the specific version of bitcoind that was used

* Don't implement version in super trait

* Fix docs

* Fix async issue in V21 test suite

* Append to vectors in CachedBitcoinCollection rather than replace

* Fix rebase issues

* Add scaladocs

* Fix BitcoindV18RpcClient address info test

* Implement fixtures in BitcoindV17RpcClientTest fixtures

* Cleanup v17 PsbtRpcTest

* Reduce bitcoind usage from 3 -> 1 in BitcoindV18RpcClientTest

* Remove abandon transaction test, this allows us to reduce the number of bitcoind's used in MempoolRpcTest from 3 -> 2

* Remove the requirement to inject  BitcoinSAsyncFixtureTest, add it in the test traits explicitly to make things easier. Also add explicit afterAll() method to tear down both the CachedBitcoind & BitcoinSAsyncFixtureTest

* Fix missing Await.result() in BitcoindRpcTest.afterAll()

* Rework MultiWalletRpcTest to use a NodePair

* Rework BlockchainRpcTest to use fixtures

* Rework Client start()/stop() methods. Now use an AtomicBoolean to indicate when a user has requested a client to start/stop rather than sending pings to bitcoind that can fail because the conneciton pool has been shutdown in test cases

* Try my luck with turning on parallelExecution in CI again

* Revert parallelExecution, now testes do not run in parallel on CI

* Only turn off parallelExecution for bitcoindRpcTest

* Adjust build to only have bitcoindRpcTest NOT in run parallel on mac, reduce number of blocks used in BitcoindRpcTestUtil.createNodeSequence

* Run less tests in the rpc test suite as that takes the longest, move them over to node/wallet/dlc test suite on mac osx CI

* Don't run eclair tests in parallel either

* Remove CachedBitcoind from BitcoinSWalletTest

* Fix async bug in test case

* Push to github to force re-run of CI

* Push to github to force re-run of CI

* Push to github to force re-run of CI
2021-03-19 06:37:53 -05:00
benthecarman
12bff309c2 Add Broadcast TxoState (#2735)
* Add broadcast TxoState

* Update scaladoc
2021-03-18 14:16:53 -05:00
benthecarman
9494eec1b8 Move blockhash to tx table from spending info table (#2744)
* Move blockhash to tx table from spending info table

* Add test, fix spending tx id col name

* Scaladocs, add test

* Add more unit test

* Make id not comparable in process tx test

* Fix tests

* attempt to fix

* Add mempool comment to scaladoc

* Deparallelize process inputs & outputs
2021-03-16 10:05:29 -05:00
Chris Stewart
1959495cec Add testkit-core module (#2726)
* Refactor AsyncUtil to just use an execution context rather than an actor system

* Create testkit-core, start moving data structures over to testkit-core

* WIP, getting rid of the hard dependency on BitcoinSAsyncTest and akka

* Rework test traits to not be dependnent on akka, move BaseAsyncTest into testkitCore, add a test trait that just uses the default scala executionContext

* Get everything compiling

* Move logback-test.xml to testkit-core so it applies to coreTest,cryptoTest as well

* Cleanup rebase issues

* Fix Deps.scala

* Address ben's code review

* Segregate jvm settings and compiler settings

* Filter out -Xfatal-warning for scalajs for now since there is a ton of errors

* Move maintainer settings into CommonSettings.settings
2021-03-02 07:05:21 -06:00
Chris Stewart
7a068ac036 2021 02 25 async utils (#2725)
* Refactor AsyncUtil to just use an execution context rather than an actor system

* Create async util project, use it in various projects that depend on it
2021-02-25 13:26:38 -06:00
Chris Stewart
1a2ddf6a0d Reduce usage of .findAll() (doesn't scale for large dbs). Now pass in… (#2706)
* Reduce usage of .findAll() (doesn't scale for large dbs). Now pass in the specific things we are searching for

* Add timestamps for checking how long it takes to processBlock()
2021-02-21 16:15:50 -06:00
Chris Stewart
a5252b20ba Bump the timeout for address queue exception test to make sure we get correct exception (#2697) 2021-02-20 13:50:28 -06:00
Aris
f8694eb097 Fix/typos (#2633)
* Fix typos

* Collection minor fixes

Removes redundant .headOption on options
Replaces .exists(_ == ???) with .contains(???)
Replaces option == None with option.isEmpty
2021-02-07 15:00:25 -06:00
Chris Stewart
8f958bf5d9 Update scalafmt (#2619) 2021-02-03 16:37:12 -06:00
benthecarman
e2ace38a1f Fix rescan to fetch blocks during scan (#2540) 2021-01-22 10:28:53 -06:00
benthecarman
2291bf0eae Create isChange function for wallet (#2535)
* Create isChange function for wallet

* Scaladocs
2021-01-20 12:11:24 -06:00
Chris Stewart
6193af7709 Remove WalletSync.sync() -> WalletSync.syncFullBlocks() (#2522) 2021-01-15 17:05:11 -06:00
Chris Stewart
51e9796b39 2021 01 11 issue 2493 (#2503)
* Rename NodeUnitTest.confg -> NodeUnitTest.getFreshConfig()

* Rename CachedBitcoinSAppConfig.config -> CachedBitcoinSAppConfig.cachedConfig

* Make CachedChainAppConfig extend CachedBitcoinSAppConfig

* use cached configs in both wallet/chain project as well taking ben's suggestion to fix those
2021-01-11 16:45:10 -06:00
Chris Stewart
98ace6f14e 2021 01 02 issue 2457 (#2461)
* WIP

* Get neutrino node with wallet 'receive information about received payments' working again

* Fix compile

* Remove initial sync logic from test case

* Remove sync logic in NeutrinoNodeWithWallet test cases

* Improve logging and rename a few things

* WIP2

* WIP3

* Get NeutrinoNodeWithWallet tests working

* Implement WalletSync, which allows you to sync a wallet from a arbitrary data source

* Get all tests passing again

* Use spv.appConfig in DataMessageHandlerTest rather than caching the config

* Modify cleanup to hopefully get CI passing

* Fix postgres tests by cleaning the table during the destroy phase of the test fixture. This is needed because the same postgres database is shared between tests in the same test suite

* Revert logback-test.xml

* Get sqlite/postgres tests passing pt 2

* syncHeight -> syncDescriptorOpt()

* Add case for genesis block hash in WalletSync

* Fix SpvNodeWithWallet test case to actually test spv functionality

* Remove nodeCallbacks parameters, callbacks should be registered on nodeAppConfig
2021-01-09 09:33:37 -06:00
Chris Stewart
dc73cb26ff Rename wallet.getSyncHeight() -> wallet.getSyncDescriptorOpt(). We don't just use height in the descriptor, the hash is just as valuable for connecting to chains (#2479) 2021-01-07 07:40:30 -06:00
benthecarman
4fb1c4f954 Make KeyManager return better error messages (#2464)
* Make KeyManager return better error messages

* Increase test coverage

* Refactor

* Create type for raw strings
2021-01-04 12:43:55 -06:00
Ben Carman
8df2fcd1fd Account for rounding of fee rate in CPFP test (#2423) 2020-12-23 07:18:42 -06:00
Ben Carman
8996be43ec Add extra checks for RBF transactions (#2416)
* Add extra checks for RBF transactions

* Move to util function, don't allow CPFP of confirmed txs
2020-12-22 14:12:15 -06:00
Ben Carman
f7671a4f99 Add wallet function to bump fee with CPFP (#2399)
* Add wallet function to bump fee with CPFP

* Add bump fee integration tests
2020-12-21 07:04:01 -06:00
Chris Stewart
4d9c9415d9 2020 12 20 root dependson (#2404)
* Make bitcoin-s root project depend on all other modules

* remove unused import

* Remove crossScalaVersion in root project
2020-12-21 06:47:04 -06:00
Ben Carman
fcfc3d076f Add wallet function to bump fee with RBF (#2392)
* Add wallet function to bump fee

* Bump sequence number

* Respond to review

* Fix test
2020-12-20 07:43:18 -06:00
Chris Stewart
d204056ad8 2020 12 19 enable test compileropts (#2400)
* Fix bug where test compiler opts were not enabled

* Fix all exsting compiler warnings in test project

* Add scalaCollectionCompat dependency to bitcoindRpcTest so we can use @nowarn annotation on scala 2.12
2020-12-20 07:09:07 -06:00
Ben Carman
cd13bdb77a Rescan Improvements (#2379)
* Rescan Improvements

* Make test use fetchFilters instead
2020-12-18 07:05:59 -06:00
Ben Carman
52ef1fa185 Add ability to store ExtPrivateKey instead of Mnemonic (#2372)
* Add ability to store ExtPrivateKey instead of Mnemonic

* Use private vals, change name

* Fix docs

* private to km

* Correct scaladocs
2020-12-17 13:25:04 -06:00
Ben Carman
1225584526 Multi Wallet support (#2345)
* Multi Wallet support

* Fix Oracle tests

* Fix some CI errors

* Increase KeyManagerAppConfig code coverage

* Add test for multiple seeds in seed folder

* Move things in reference.conf files

* Lower key manager coverage requirement

* Fix postgres test issues

* Create DbAppConfig

* Add some docs, fix hardcoded postgres db name

* Clarify db vs schema

* Add character types

* Fix chaindb in conf

* Always copy default seed

* Remove need for driverName config
2020-12-16 17:27:56 -06:00
Ben Carman
685d5b0273 Let wallet sign PSBTs (#2236)
* Let wallet sign PSBTs

* Add example to docs

* Add logs and test case
2020-11-07 09:25:59 -06:00
Ben Carman
47a38f88db Make aesPassword option for wallet config (#2217)
* Make aesPassword option for wallet config

* Add to docs

* Make AesPassword optional

* Small touchups

* Fix for oracle server

* Fix docs

* Increase code coverage
2020-11-06 07:00:18 -06:00
Chris Stewart
581d46c2c8 2020 11 02 cleanup (#2233)
* Cleanup a bunch of imports in test

* Use @nowarn annotation for testing things that are deprecated

* Fix base58 test

* Cleanup crypto-test

* Use scala collection compat dependency to get access to the @nowarn annotation on scala 2.12.x

* Rework more scala 2.13.x compile failures in chain-test and key-manager-test

* Optimize imports for entire project

* Fix nits
2020-11-03 11:07:04 -06:00
Ben Carman
9787e89403 Add Wallet State Descriptors (#2157)
* Add Wallet State Descriptors

* Sync blocks while offline w/ bitcoind backend

* Add to WalletDbManagement

* Update db management test

* Respond to review

* Rename function
2020-10-14 14:17:51 -05:00