Commit Graph

561 Commits

Author SHA1 Message Date
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
Shruthii RG
d53f164478
BitcoindRpcClient Improvements (#3600)
* Changes in bitcoind-rpc module

* Get things compiling

* Implement BitcoindInstanceRemote & BitcoindInstanceLocal

* Fix doc compile

* bitcoind remote instance test

* rename BitcoindInstanceRemote

* Scalafmt

* Applied requested changes(except one)

* implemented fromConfigFile and fromDataDir for BitcoindInstanceRemote

* implemented fromNetworkVersion

* BitcoindInstanceRemote changes

* Get things compiling

* Add implict type parameter to InstanceFactory

* Fix recursive reference of version <-> getNetworkInfo

* bug fix

* bug fix 2

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-09-07 08:49:01 -05:00
benthecarman
656e9b1b5d
Sort DLC table by last updated (#3607)
* Sort DLC table by last updated

* Add LastUpdatedDb

* Make visible

* Fix compile

* Add time, fix sorting

* Switch to local time

* fix compile

* Fix test

* Fix postgres migration

* Specify zoneId
2021-08-31 14:27:36 -05:00
Chris Stewart
0746b14331
Move BitcoindRpcAppConfig into the bitcoind-rpc project (#3610) 2021-08-27 06:43:31 -05:00
rorp
704b02ae6c
Use random ports for pre-packaged Tor daemon (#3604)
* Use random ports for pre-packaged Tor daemon

* fix unit tests

* configurable random ports

* shutdown hook
2021-08-26 13:02:49 -05:00
Chris Stewart
a5f4f9663c
Add BitcoinSServerMain test to connect to bitcoind (#3591)
* Add BitcoinSServerMain test to connect to bitcoind

* Add tor tests

* Fix compile

* Remove println

* Allow to reset BitcoinSServer promise

* Remove println

Co-authored-by: benthecarman <benthecarman@live.com>
2021-08-26 09:08:38 -05:00
Chris Stewart
b980f4894d
Implement BitcoinSAppConfig with ActorSystem (#3596) 2021-08-24 07:41:05 -05:00
benthecarman
495ab62104
Tor in Testkit (#3484)
* Tor packaged for testkit

* Add CI row

* Small fixes

* More fixes

* Keep tor running

* Skip tor test for old version of bitcoind

* Respond to review

* Fix with master

* Bump tor start time to same as app config

* Use cached tor for DLCNodeTest

* Disable parallel execution for dlc node test with tor

* Fix DLCNodeTest for tor and clearnet

* Fix name of CI rows
2021-08-23 13:06:14 -05:00
rorp
54ce2ebeb2
P2P reconnect logic (#3572)
* P2P reconnect logic

* some fixes

* more changes

* fix DuplicateFilters exception in case of  disconnect in the middle of syncing filters

* more fixes

* Repurpose maxconnections test to be just a generic reconnection test

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-08-20 05:51:51 -05:00
benthecarman
addb1254ee
Fix for if tor is already running (#3562) 2021-08-17 09:47:31 -05:00
benthecarman
621e8e9033
Rescan DLC Tests (#3515) 2021-08-11 07:29:33 -05:00
rorp
3d4cf1fc91
Tor support for all sub-projects (#3506) 2021-08-10 08:07:12 -05:00
Chris Stewart
4f7b6422ea
2021 08 06 app config refacotr (#3498)
* Move AppConfig into app-commons, reduce classpath deps on keyManager,tor

* Move test ServerArgParserTest

* Fix compile error
2021-08-07 14:36:11 -05:00
benthecarman
1051e6365a
DLC P2P Client (#3402)
* DLC P2P WIP

* P2PClient refactor (#10)

* Add to CI

* Remove unused

* Attempt to create DLCNode and Tests

* Full Tor support

* Get DLCNegotiationTest passing

* Config options, connect & send func

* Test for DLCNode

* Add createDLCNode to config

* Fix formatting

* Update DLC state after all other data is set

* Remove unneeded line

* Respond to some review

* 2021 07 26 dlc node code review (#13)

* WIP

* WIP2

* Rewrite tests not use Await.result()

* Skip Tor test on CI

* Cleanup threadpool leaks in tests

* Handle actor pattern matching better

* Respond to review

* Implement DLCNode.stop

* sock5 -> socks5

* Use Tcp.Unbind

* Respond to review

* Implement postStop

* Switch to unbind

Co-authored-by: rorp <rorp@users.noreply.github.com>
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-08-02 18:15:56 -05:00
Shreyansh
1426c31483
Multi peer: Sync with random peer (#3454)
* ensure random peer used for sync supports compact filters

* test file

* fix

* refactor

* rerun ci

* rerun ci

* changes from comments

* fix

* fix tests

* changes from comments

* refactor

* remove unintended diffs
2021-07-31 07:54:31 -05:00
Shruthii RG
e2c2798e60
Implemented the ability to fetch unconfirmed transactions (#3429)
* relay flag in version message made configurable

* modified test classes as well

* Update configuration.md

* reverted few files and cleaned up format

* fixed mistake

* enabled neutrino node to receive transactions as a callback

* added txid to log message

* changed txId to txIdBE

* unit test added for checking if we're getting transaction as a callback
2021-07-23 13:01:07 -05:00
Chris Stewart
1032669f21
Add unit test for moving seeds and making sure we can get the same public key after moving (#3441) 2021-07-23 13:00:27 -05:00
benthecarman
2597904019
Move DLCWalletApi to core module (#3438) 2021-07-21 15:25:18 -05:00
Shreyansh
4be2b2109b
[WIP] Adding multi-peer support (#3401)
* establish conn with multiple peers

squash 1

squash 2

squash 3

* add tests

* change log msg level

* minor changes

* fix

* formatting

* fix docs

* commit to rerun ci

* changes from comments

* fix bug

* rerun ci
2021-07-21 15:18:45 -05:00
Chris Stewart
b2b2ca45db
Add ability to configure postgres database backends for test cases via reference.conf (#3421) 2021-07-19 09:55:36 -05:00
Chris Stewart
b7b2a7099f
2021 07 15 dlc oracle pg (#3413)
* WIP

* Get postgres test passing by not allowing 0 byte (NULL character in UTF 8 string) in the utf8 generator
2021-07-17 12:19:49 -05:00
rorp
8b663d91b6
Tor support for P2P (#3311)
* Tor support for P2P

* fix stuck connections

* unit tests

* docs

* update docs

* respond to the PR comments

* fix docs
2021-07-13 14:27:24 -05:00
benthecarman
cada6fdc63
Fix DLC not storing nSequence for funding inputs (#3342)
* Fix DLC wallet not storing nSequence for funding inputs

* Fix DLCTest
2021-06-29 09:36:30 -05:00
benthecarman
cfe0c2f0d8
Multi wallet support for DLC database (#3289)
* Multi wallet support for DLC database

* Fix for postgres
2021-06-22 12:56:26 -05:00
benthecarman
fafc564da8
Update LND to v0.13.0-beta (#3290) 2021-06-21 16:20:08 -05:00
benthecarman
e63a12e47f
Better error message for invalid DLC refunds (#3209) 2021-06-15 10:57:50 -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
7ba7f8b9ba
Try to add block generate to address in fixture setup to get around compact filter sync edge case (#3231)
* Try to add block generate to address in fixture setup to get around the case where block headers & filter headers are synced but compact filters are not

* Push to github to force re-run of CI 2

* Add ChainApi.getBestFilter(), use it in sync to determine if filter headers & filters are in sync

* Push to github to force re-run of CI 3

* Simplify getBestFilter, add unit test

* Add more comments, clean up some code
2021-06-08 12:47:28 -05:00
Chris Stewart
bf02e89faa
2021 05 29 dlc pnl (#3198)
* WIP

* WIP2

* Get tableview rendering something

* Add basic unit tests for accounting

* Add rate of return

* Add myPayout and theirPayout to json objects

* Address code review

* Fix 2.12 compile, adjust table view

* drop isInit column on table view

* Fix scala 2.13
2021-05-31 11:12:24 -05:00
benthecarman
0e701bc9d0
Fix verify funding sigs (#3194)
* Fix verify funding sigs

* Sort funding inputs

* Sort utxos in dlc signer

* Other multi input fixes & tests

* Fix compile error
2021-05-28 19:59:45 -05:00
Nadav Kohen
17d1145504
Removed extraneous findAll call from CRUD.updateAll (#3154)
* Removed extraneous findAll call from CRUD.updateAll

* Made update tests deal with unchanged element
2021-05-26 14:22:18 -06:00
benthecarman
be8e965367
DLC Wallet pulldown (#3138)
* DLC Wallet pulldown

* Respond to review
2021-05-25 17:31:01 -05:00
Nadav Kohen
ac3bae403b
Pulled down all remaining non-wallet non-gui code on adaptor-dlc (#3101) 2021-05-18 06:29:46 -05:00
Nadav Kohen
58070f4120
Pulled down dlc and dlcTest projects into core and dlcTest (#3068)
* Pulled down dlc and dlcTest projects into core and dlcTest

Added dlcTest to CI runs and fixed compilation issues

* Fixed docs

* loosened fee rate bound assertions to only sanity test
2021-05-14 12:27:21 -05:00
Chris Stewart
a2911f31ed
Fix race condition with BitcoindChainHandlerViaZmqTest (#2990)
Turn off logging again

Try to move things around even more to make sure zmq is started

Turn logging level down to ERROR to hopefully get some meaningful output

Adjust both valdiation & ChainHandler to be ERROR level logging

switch zmqpubrawblock to be the port we know is free

Reduce logging to WARN

Bump bitcoind max retries to 120

Fix rebase

Revert logging

Remove some noisy logs

Restore logs to trace level

Add explicit tag
2021-05-01 13:11:13 -05:00
Chris Stewart
38baea5e24 refactor BitcoindRpcTestUtil test methods to take ZmqConfig rather than zmqPort (#3002) 2021-04-30 10:59:16 -05:00
Chris Stewart
f792fb3480 Fix database pool name for postgres database connection pools (#2997)
* Fix database pool name for postgres database connection pools

* Add timestamp to pool name
2021-04-30 06:38:37 -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
85fed08c58 Reduce pg connections from 300 -> 50 in test cases (#2974)
* Reduce pg connections from 300 -> 50 in test cases

* Reduce connection count to 25

* Push to github to force re-run of CI

* Switch explorer over to prod for now as test is down to get CI passing

* Reduce shared buffers memory size

* Push to github to force re-run of CI 2
2021-04-28 06:22:56 -05:00
benthecarman
e3017fd17d Peer Message Receiver Refactor (#2938) 2021-04-27 15:54:44 -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
3483a461f1 Don't wrap pg.close() in a Try and then do nothing with it, propogate the exception (#2972) 2021-04-26 09:45:19 -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
Chris Stewart
e064cd77ea Fix missing teardown code for MultiWalletRpcTest (#2946) 2021-04-23 09:31:12 -05:00
Chris Stewart
16538980e3 Fix missing super.stop() to shutdown DbAppConfig db connection pool (#2943)
* Fix missing super.stop() to shutdown DbAppConfig db connection pool inside of all DbAppConfig subclasses that override stop()

* Fix import

* Remove implicit modifier to NodeUnitTest.getFreshConfig(), make sure we are shutting down chainAppConfig inside NodeUnitTest

* Remove chainTest subclasses implementing ActorSystem, make sure we do correct cleanup in ChainUnitTest

* Decouple CachedChainAppConfig & CachedAppConfig. When using only one sub module in the CachedAppConfig, teardown may fail as the other modules might not be started such as using chainAppConfig in chainTest, BitcoinSAppConfig.stop() requires us to call nodAppConfig.stop() first, which isn't started.

* Push to github to force re-run of CI 4
2021-04-23 08:21:56 -05:00
Chris Stewart
c95c0f9706 Move wallet scheduler into WalletAppConfig (#2933)
* Move wallet scheuler into WalletAppConfig, use scheduler.shutdownNow() so we actually shutdown the scheduler rather than wait for all queued tasks to finish executing before shutting down

* Fix typo

* Move rescan thread pool in to walletAppConfig, shut it down on wallet shutdown

* Fix compile
2021-04-21 11:06:29 -05:00
Chris Stewart
de5f7fc7f9 Reduce number of threads in postgres connection pool for tests (#2931)
* Reduce number of threads in postgres connection pool from 10 -> 2

* Try reducing to just 1 thread
2021-04-20 12:47:28 -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
Chris Stewart
bb379ecfcf Add docs for using CachedBitcoind (#2880)
* Add docs for using CachedBitcoind

* revert paths in testkit.md to be references to the appropriate scaladoc
2021-04-09 09:43:22 -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
benthecarman
4055de7690 Inital LND rpc with some tests (#2836)
* Inital LND rpc with some tests

* Fix ZMQ test

* Correct datadirs

* Most tests

* Fix eclair tests

* Make tests less flaky

* Have CI download lnd

* Respond to some review

* Fix ZMQ tests

* Cached bitcoind for lnd tests

* Fix fixtures, bump timeout

* InstanceFactory & ConfigFactory

* Fix compile issue for 2.12.12

* Move factories to core.api.commons
2021-04-05 04:52:56 -05:00
rorp
911fca5825 Schnorr js (#2805)
* Schnorr sigs for Scala.js

* fix build

* put BIP340 test vectors in a shared space

* remove teskit dependency, fix point edge cases

* fix build

* add unit tests for point addition

* scaladoc

* cleanup

* respond to the comments

* Fix usage of BitcoinSLogger

Co-authored-by: christewart <stewart.chris1234@gmail.com>
2021-03-22 12:56:40 -05:00
benthecarman
c6c4e83e9e Remove logging from testkit core (#2813)
* Remove logging from testkit core

* Fixup deps
2021-03-22 11:48:27 -05:00
benthecarman
07514e2348 Remove logging from core (#2810)
* Remove logging from core

* Remove slf4j from testkit core

* Remove logback from coretest
2021-03-21 19:11:55 -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
Chris Stewart
78448b277c Revert "Schnorr sigs for Scala.js (#2784)" (#2802)
This reverts commit 8e7bde0ed9.
2021-03-16 13:19:16 -05:00
rorp
8e7bde0ed9 Schnorr sigs for Scala.js (#2784) 2021-03-16 10:21:47 -07: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
49544fc7f3 Turn off parallelExecution and remove extra AsyncUtil test class (#2790) 2021-03-11 09:36:54 -06:00
Chris Stewart
5b4aac5178 Refactor starting second bitcoind in MempoolRpcTest, remove Thread.sleep (#2776)
* Refactor starting second bitcoind in MempoolRpcTest, remove Thread.sleep

* Add AkkaUtil.nonBlockingSleep(), replace usages of Thread.sleep() with it where possible

* Remove more Thread.sleep()

* Try bumping threadpool for scheduler

* Reduce scheduler threadpool size to 2

* Push to github to force re-run of CI
2021-03-10 09:36:34 -06: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
rorp
c90f318fd7 Refactor crypto module to be compatible with Scala.js part 1 (#2719)
* Refactor crypto module to be compatible with Scala.js

* more changes

* some more changes

* abstract out Schnorr stuff

* abstract out adapter stuff

* cleanup

* some more cleanup

* fix build

* Removed references to ECPoint outside of .jvm scope

* remove references to ECPoint from the shared code

* cleanup

* remove cirlular dependencies

* more cleanup

* cleanup

* move SipHash to CryptoContext

* scaladoc

* scalafmt

Co-authored-by: nkohen <nadavk25@gmail.com>
2021-02-27 05:58:20 -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
benthecarman
86566c575d Simplify oracle server RPC api (#2656) 2021-02-23 13:17:20 -06:00
Chris Stewart
be18b1baf2 Cache httpClient in bitcoind, rename Test.akkaHttp -> Test.akkaHttpTestkit (#2702) 2021-02-20 13:42:39 -06:00
Chris Stewart
392eb316f6 Add guard for the case when listFiles returns null (#2696) 2021-02-19 13:36:45 -06:00
Aris
85087b0f70 Refactoring chain (#2662) 2021-02-13 14:10:40 -06:00
Chris Stewart
8f958bf5d9 Update scalafmt (#2619) 2021-02-03 16:37:12 -06:00
Nadav Kohen
93f33d26b6 Update dlc before release (#2543)
* Pulled down DLC data structure work

* Responded to Ben's review

* Gave Vector types names

* Pulled down Chris' work
2021-02-02 08:14:24 -06:00
benthecarman
03ca6f617e Optimize filter sync and fetching filter heights (#2568) 2021-01-30 14:56:47 -06:00
Chris Stewart
756bfc4427 2021 01 27 conectionpool (#2578)
* Give connection pool example config

* Get hikari logging working on postgres

* fix 2.12.x

* Bump metrics core to a supported version

* Add hikari-logging and hikari-logging-interval configuration options to turn off/on hikari and schedule how often logs appear

* Turn off hikari logging in the db-commons/reference.conf and add it to appserver/reference.conf

* default the logging to off in scala code

* Make sure connection pool is enabled in db-commons, add default database configuration to website

* Address code review, fix things that didn't need to be changed
2021-01-28 09:44:03 -06:00
rorp
05e21b1200 Bump Eclair version (#2405)
* Bump Eclair version

* cleanup

* Bump JVM version for CI

* Update docs

* Fix docs
2021-01-22 10:47:19 -06:00
benthecarman
523f1098fc Implement OracleAttestmentV0TLV, save outcome to db (#2516)
* Implement oracleAttestmentV0TLV, save outcome to db

* Update with tlv changes

* Update tlv to not have 2 list sizes

* small change

* Update OracleEvent.verifyAttestations

* Use correct pub key

* Verify correct outcomes
2021-01-22 09:45:45 -06:00
rorp
fc48964721 Fix 'client1.getDaemon.datadir.exists() was true' (#2544) 2021-01-21 12:38:17 -06:00
benthecarman
811e96bb4f Fix BitcoindV21RpcClient testkit errors (#2533) 2021-01-18 16:19:00 -06:00
Chris Stewart
abc0a2b459 Refactor test case to be more idiomatic in hopes this kills CI failures (#2524) 2021-01-16 14:26:51 -06:00
Chris Stewart
6193af7709 Remove WalletSync.sync() -> WalletSync.syncFullBlocks() (#2522) 2021-01-15 17:05:11 -06:00
benthecarman
d69c60b8b2 Bitcoind v0.21.0 support (#2414)
* Bitcoind v0.21.0rc3 support

* Use v0.21.0 instead of Experimental in node tests

* Bump to rc5

* Use official release

* Fix rebase issues

* Remove DoNotDiscover tag

* Fix count for NeutrinoNodeTest
2021-01-14 14:01:44 -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
68af9760b3 Clean up fixture shutdown code a bit to try and see if this resolves … (#2498)
* Clean up fixture shutdown code a bit to try and see if this resolves issue on CI

* Rework fixtures so we aren't starting app configs in multiple places

* Fix scaladoc
2021-01-09 17:07:26 -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
6eff248f3d Add officially supported version of bitcoind by eclair, also add the ability to specify which version of bitcoind you are using for EclairRpcTestUtil.getBitcoindRpc (#2490) 2021-01-08 11:43:48 -06:00
benthecarman
6b441631f3 Limit bech32 addresses to segwitv0 (#2471)
* Limit bech32 addresses to segwitv0

* extend ScriptFactory, make check exhuastive
2021-01-07 08:13:31 -06:00
benthecarman
46c73970ff Remove callbacks param from DataMessageHandler & PeerMessageReceiver (#2476) 2021-01-06 13:23:47 -06:00
Chris Stewart
4e1a6c69f0 2020 12 18 enable lint options (#2454)
* Enable -Xlint:adapted-args,nullary-unit on our for compile scope

* Add Xlint:infer-any compiler option

* Fix build so test compiler options are actually enabled

* Enable more scalac linting options

* Add '-Xlint:eta-sam'

* Add 'Xlint:inaccessible,Xlint:missing-interpolator'
2021-01-03 08:01:26 -06:00
Chris Stewart
5411c89f22 Remove extra logback files (#2456)
* Remove extra logback files

* Adjust logging levels in testkit/logback-test.xml
2021-01-03 07:25:45 -06:00
Chris Stewart
b2560c4606 Rework BlockHeaderDAO.chainTips into two methods: BlockHeaderDAO.{get… (#2443)
* Rework BlockHeaderDAO.chainTips into two methods: BlockHeaderDAO.{getBestChainTips,getForkedChainTips}. getForkedChainTips is needed for reorg situations in the case a block header is received that builds off a stale tip

* Deduplicate BlockHeaderDAO.getBlockchains() that are subchains for the best chains
2021-01-01 09:04:29 -06:00
Nadav Kohen
493673c68b Outstanding DLC branch diff (#2432) 2020-12-23 18:13:57 -06:00
Ben Carman
67e7426260 Windows Secp Update & fix for parsing Windows paths (#2398)
* Windows Secp Update

* Add docs about errors

* Fix paths in config

* Bump timeout
2020-12-21 16:34:53 -06:00
Ben Carman
8912fcbc82 Fail broadcasting transaction when disconnected (#2336)
* Fail broadcasting transaction when disconnected

* Wait until disconnected

* Move test

* Move to separate file

* Attempt fix

* Make test never have a peer

* Improve reliablity
2020-12-17 13:28:32 -06:00
Nadav Kohen
f7fdca3e22 DLC Data Structures on Master Cleanup (#2375)
* Moved dlc data structures from commons to core

* Renamed DLC payout curve classes

* Split OutcomeValuePoint up into an ADT

* Added utility for computing Schnorr multiple-signature points

* Replaced tuples in RoundingIntervals with types

* Replaced tuples in DLCPayoutCurve with Indexed

* Fixed a compile bug
2020-12-17 09:09:57 -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
61d3a14c07 Don't allow fee unit gen to be 0 (#2346)
* Don't allow fee unit gen to be 0

* Fix other 0

* Fix always 0 fee unit gen
2020-12-12 07:34:26 -06:00
Nadav Kohen
b7ffea2525 Pulled down work from adaptor-dlc onto master (#2339)
* Pulled down work from adaptor-dlc onto master

* Reverted some accidental deletions

* Removed unused import

* Added scaladocs

* Responded to Ben's review

* Added some scaladocs and invariants

* Responded to chris' review

* Responded to more review

* Added some comments
2020-12-11 17:32:35 -06:00
Chris Stewart
7df02c4198 Start refactoring testkit to allow for specifying a different binary … (#2325)
* Start refactoring testkit to allow for specifying a different binary directory than the sbt default

* Fix BitcoindRpcTestUtil

* Add BitcoindRpcTestClient
2020-12-07 13:14:40 -06:00
Chris Stewart
b8e0847ff3 Remove hard coded bitcoind version eclair was depending on and switch to latest version of bitcoind (#2324) 2020-12-06 08:06:39 -06:00
Ben Carman
794f6e073e Fix TLV parsing for non-standard strings (#2312)
* Fix TLV parsing for non-standard strings

* Create function

* Fix oracle migrations

* Forced all TLV strings to be normalized implicitly

* Removed redundant normalization

* Fix oracle

* Bump migration test

* Fix 2.12.12 compile

* Use NetworkElement & StringFactory

Co-authored-by: nkohen <nadavk25@gmail.com>
2020-12-03 12:30:17 -06:00
Chris Stewart
80d3eaf6d7 Make BitcoinSAyncTest more thread safe and make sure we have all the … (#2292)
* Make BitcoinSAyncTest more thread safe and make sure we have all the expected test cases aggregated before we starting reducing over the results

* remove extra code

* Fix scala 2.12.x compile
2020-11-26 07:53:33 -06:00
Chris Stewart
66ec96b1f5 2020 11 13 issue 2258 (#2260)
* Introduce ChainHandlerCached which behaves like the old ChainHandler. Now Chainhandler.getBestBlockHeader() will read headers from the database

* Remove ChainHandler.blockchains field, now it's only available in ChainHandlerCached

* De-futurify ChainHandler.fromDatabase()

* Adjust logging

* Patch test case

* Use BlockHeaderDAO.chainTips when getting best header rather thean BlockHeaderDAO.getBlockchains(). Implement a helper method ChainHandler.toChainHandlerCached()

* Fix chain.md,wallet.md

* Make ChainHandler.getBestBlockHeader() consider time of header if chainwork is the same. Make test cases less strict on what header is the best header when both chainwork and time are the same on the eader

* Only execute callbacks on headers that are going to be created in the database, not all headers passed into ChainHandler.processHeadersWithChains()

* Turn up log level again

* Small optimizations, check if we have seen a header before before processing it in ChainHandler.processHeadersWithChains(). Fix FilterSyncMarker.toString(). Use ChainHandlerCached in Node

* Remove ChainHandlerCached in appServer, re-add it in Node.scala
2020-11-17 06:19:07 -06:00
Ben Carman
ec6afbb271 Use same config option for key manager projects (#2252)
* Use same config option for key manager projects

* Use BIP39KeyManager.initialize
2020-11-11 12:18:02 -06:00
Ben Carman
7ac9cd1525 Use New Oracle TLVs in DLCOracle (#2162)
* Update Oracle to use new TLVs

* Rename things to use new names, scaladoc, small clean ups

* Add descomposition tests, docs, sign numbers outside of range
2020-11-10 06:08:43 -06:00
Ben Carman
fcf0c842ad Update Oracle TLVs (#2185)
* Update Oracle TLVs

* Change string size to be BigSizeUInt

* Move nonces to oracle event tlv

* Introduced EventDescriptor tests and NumericEventDescriptor methods to query possible outcome data

* Added contains function

* Added tests for containsToPrecision

* Remove EventDescriptor.outcomes and other related fields

* remove unused formatNum method

* Address code review from Ben

* Move oracle pub key to announcement

Co-authored-by: nkohen <nadavk25@gmail.com>
Co-authored-by: christewart <stewart.chris1234@gmail.com>
2020-11-07 16:26:21 -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
Ben Carman
f628c265ae Add DbManagement tests for Oracle (#2186) 2020-10-14 08:04:00 -05:00
Chris Stewart
112ec90286 Refactor db configuration to use the key 'user' rather than 'username' inline with slick documentation (#2184) 2020-10-13 10:02:02 -05:00
Ben Carman
77e8cabf5b Oracle Announcement TLVs (#2149)
* Oracle Announcement TLV

* Add pubkey, event uri & descriptor

* TLVParentFactory, EnumEventDescriptorTLV

* Add trailing V0 to types

* Make names match spec pr

* Add range descriptor

* Add num outcomes to enum descriptor
2020-10-08 22:47:40 -05:00
Chris Stewart
3625c5bf88 2020 10 08 issue 2147 (#2153)
* Add test case for resolving typesafe config variables and making sure we honor system properties

* Remove println

* Move AppConfigTest test caess into the db-commons project
2020-10-08 10:37:13 -05:00
Ben Carman
7b53b02cfa Make ZMQ Listeners typed (#2144) 2020-10-08 01:21:50 -05:00
Ben Carman
52ba32769a Increase DLC Oracle test coverage (#2128) 2020-10-05 22:06:31 -05:00
Chris Stewart
ade2503702 2020 10 05 redo config (#2121)
* Use absolute paths for resolving configurations

Make log level OFF again

WIP: Move resolution of config into AppConfig.start(), things are totally broken

WIP: Make AppConfig.config private

Get all tests passing again but using absolute path in configuration

* Cherry-pick onto master

* Fix BitcoinSAppConfig configuration keys to use the full path

* Apply code review

* Fix log, move invariant for requiredConfirmations back into the lazy val

* Fix DlcOracleAppConfig to use absolute path
2020-10-05 18:00:30 -05:00
Chris Stewart
9b09b04230 Upgrade to scalac 2.13.3 (#2115) 2020-10-04 07:42:44 -05:00
Ben Carman
d57c059921 Add basic DLC Oracle (#2094)
* Add basic DLC Oracle

* Respond to review

* Respond to more review

* Add maturation time

* Add to testkit, tag hashes, better val names

* More clear vals, version tagged hashes

* Signing key clean up

* Add pubkey to db
2020-10-03 08:04:57 -05:00
Nadav Kohen
e71b664e1a Brought down ecdsa adaptor signatures implemented in scala from the dlc-crypto branch (#2034) 2020-10-02 10:43:59 -05:00
Ben Carman
ad6c2563bd Create Util functions for wallets with a bitcoind backend (#2076)
* Create Util functions for wallets with a bitcoind backend

* Move function, delete reduant function

* Fix imports
2020-09-30 08:50:49 -05:00
Ben Carman
920e30e5a2 Bitcoind v0.20 updated rpcs & tests (#2061)
* Bitcoind v0.20 updated rpcs & tests

* Test sorted multi
2020-09-28 14:25:28 -05:00
Ben Carman
e53317b409 Create initial BitcoindV20RpcClient (#2060) 2020-09-25 13:29:22 -05:00
Ben Carman
11e6b7d9eb Initial SigNet support (#2057) 2020-09-25 12:29:13 -05:00
Ben Carman
1b57cac8ae trivial: Set timezone and print it in logs (#2046) 2020-09-22 14:03:42 -05:00
Ben Carman
1e3aee55c3 Merge pull request #2019
* Refactor logging to only use grizzled slf4j

* Fix docs

* test travis config change
2020-09-19 14:09:12 -05:00
Chris Stewart
76b9577181 Introduce 'FilterSyncMarker' to ChainApi, make it clearier what exact… (#2003)
* Introduce 'FilterSyncMarker' to ChainApi, make it clearier what exactly the (Int,DoubleSha256Digest) tuple is returned from ChainApi.nextBlockHeaderRange()

* Fix doc

* Add scaladoc to FilterSyncMarker

* Rebase onto master, fix conflicts to use FilterSyncMarker
2020-09-11 13:48:40 -05:00
Chris Stewart
2980e3fc01 Resolve issues with reorgs and syncing filters (#1969)
* Pull over test cases, WIP

* Rework ChainHandler.nextBlockHeaderRange() to use hashes rather than heights to very integrity of header chain, add test case

* Modify test case to make sure we are generating the 'heaviest chain work' header as first in the tuple that is used in reorg test cases

* Refactor to helper method called 'findNextHeader()' to make things simpler

* Add scaladoc to ChainHandler.findNextHeader()

* WIP

* Fix bugs in ChainApi.nextBlockHeaderRange(), now return (startHeight,stopHash) rather than (stopHeight,stopHash)

* Get chain handler tests passing, remove genesis filter header/fitler from default chain project fixture, make it a specialized one to have genesis filter header/filter in the database. Use that specialized fixture in ChainHandlerTest for now

* FilterSync work without having the genesis filter and filter header inserted into the database

* fix bug in DataMessageHandler where we were using sendNextGetCompactFilterHeadersCommand rather than using peerMsgSender.sendGetCompactFilterHeadersMessage

* Refactor ChainHandler.findNextHeader() to centralize where chains are fetched

* Address ben's code review
2020-09-11 12:41:25 -05:00
Chris Stewart
39ef35b9ee Rename parameter names from 'duration' -> 'interval' just like our ActorSystem.schedule() names the parameter (#2005) 2020-09-11 11:10:59 -05:00
Chris Stewart
00480cc391 Use randomized fee rates for wallet tests (#1977)
Co-authored-by: Ben Carman <benthecarman@live.com>
2020-09-09 16:46:33 -05:00
rorp
c62be8b5f6 Update callbacks for LN support (#1938)
Update callbacks for LN support
2020-09-09 11:02:31 -07:00
Chris Stewart
4149271b77 Segregate mainnet chainhandler tests and regtest chainhandler tests (#1988) 2020-09-09 09:50:24 -05:00
Ben Carman
edc80bf13e Don't spend immature coinbases, fix tests (#1981) 2020-09-07 15:08:41 -05:00
Chris Stewart
98236835a5 Rename ChainApi.nextHeaderBatchRange -> ChainApi.nextBlockHeaderBatchrnage (#1957) 2020-09-02 13:19:20 -05:00
Chris Stewart
3ab280a12b Remove AppConfig.initialize() in favor of AppConfig.start() (#1907)
* Remove AppConfig.initialize() in favor of AppConfig.start()

* Fix docs
2020-08-26 16:24:38 -05:00
rorp
23685f124e Add an ability to one Postgres database for all sub-projects (#1897)
* Add an ability to one Postgres database for all sub-projects
2020-08-26 12:20:18 -07:00
Ben Carman
34ef07ef5a Create ADT for NodeType instead of booleans (#1901) 2020-08-26 07:28:35 -05:00
Ben Carman
f468fff7ea Move ChainApi to core (#1888)
* Move Chain Db Reps to core

* Move ChainApi to Core
2020-08-25 07:08:42 -05:00
Scala Steward
bef9c2648e Update scalafmt-core to 2.6.4 (#1686)
* Update scalafmt-core to 2.6.4

* Format everything

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-08-24 14:24:16 -05:00
Ben Carman
cfde581d0c Move all remaining wallet db representations (#1885) 2020-08-24 13:13:52 -05:00
Chris Stewart
172744f47c Db conf on pr 1877 (#1879)
* Extend StartStopAsync with BitcoinSAppConfig, create 'CachedAppConfig' test trait, clean up P2PClientTest

* Start cleaning up after ourselves in the chainTest test suite

* Call .stop() for appConfig's spun up in ChainAppConfigTest

* Database configuration defaults

* increase number of Postgres connections

* add more logging

* close connections pools in tests

* update afterAll()

* Fix conflict

Co-authored-by: rorp <rorp@users.noreply.github.com>
2020-08-24 12:55:04 -05:00
Chris Stewart
3e8e9b0e85 2020 08 22 chaintest cleanup (#1877)
* Clean up code for BroadcastDAO test

* Extend StartStopAsync with BitcoinSAppConfig, create 'CachedAppConfig' test trait, clean up P2PClientTest

* Make MerkleBuffersTest use CachedAppConfig

* Start cleaning up after ourselves in the chainTest test suite

* Cancel background runnable for generating blocks after test case, add nodeAppConfig.stop() to tests in NodeAppConfigTest

* Stop mainnet nodeAppConfig in test as per ben's code review

* Refactor ChainUnitTest.withChainFixture() to use makeDependentFixture()

* Call .stop() for appConfig's spun up in ChainAppConfigTest

* Less parallelization on destruction of chainAppConfig

* Revert parallelExecution/fork jvm in CommonSettings
2020-08-24 11:20:02 -05:00
Chris Stewart
32f03bdf0b 2020 08 21 clean broadcast dao (#1875)
* Clean up code for BroadcastDAO test

* Extend StartStopAsync with BitcoinSAppConfig, create 'CachedAppConfig' test trait, clean up P2PClientTest

* Make MerkleBuffersTest use CachedAppConfig

* Start cleaning up after ourselves in the chainTest test suite

* Cancel background runnable for generating blocks after test case, add nodeAppConfig.stop() to tests in NodeAppConfigTest

* Stop mainnet nodeAppConfig in test as per ben's code review
2020-08-24 11:19:41 -05:00
Ben Carman
2f512364eb Correcly use reference.conf file (#1869)
* Correcly use reference.conf file

* Fix for network specific filter header batch size config option

* Add to other conf files
2020-08-24 06:30:16 -05:00
Chris Stewart
3ae3090d50 Remove uncessary extension of Async 'FixtureAsyncFlatSpec' in WalletDaoFixture, it's inherited from BitcoinSWalletTest already (#1881) 2020-08-24 06:29:18 -05:00
Chris Stewart
05026e5697 Fix async bug with destruction of fixtures (#1878) 2020-08-23 07:44:53 -05:00
Ben Carman
c6ad90139a Move TransactionDb to Core (#1849)
* Move TransactionDb to Core

* Move to api package
2020-08-22 08:04:30 -05:00
Chris Stewart
adf6da5c5d Start calling appConfig.stop() in destruction fixture code (#1868)
* Start calling appConfig.stop() in destruction fixture code

* Address ben's code review
2020-08-21 14:54:23 -05:00
Ben Carman
d187834e1a Create KeyManager Api & move SpendingInfoDb to core (#1848)
* Create KeyManager Api & move SpendingInfoDb to core

* Fix docs, remove sealed form KeyManagerApi

* Move SpendingInfoDb to core wallet api
2020-08-21 14:37:12 -05:00
Nadav Kohen
e8b195f477 Implement basic TLV functionality (#1847)
* Defined BigSizeUInt as in BOLT 1

* Introduced UInt16 and TLV types

* Responded to review

* Responded to review
2020-08-20 14:42:16 -05:00
rorp
2f8dcd1e57 Watch arbitrary SPKs (#1860)
* Watch arbitrary SPKs

* fix unit tests

* fix unit tests

* one more fix

* revert the compiler parameters
2020-08-20 14:33:18 -05:00
rorp
b5a40035ce Refactor wallet DB (#1798)
* Refactor wallet DB

* fix create(), update() and upsert()

* remove accout foreign key

* fix wallet fixtures

* update Postgres schema

* update SQLite schema

* fix AddressHandlingTest

* fix SQLITE_BUSY exception in TransactionProcessing

* fix RescanHandlingTest

* revert NeutrinoNodeTest

* fix SpendingInfoDAOTest

* fix SQLITE_BUSY exceptions

* fix DbManagementTest

* fix "Task rejected" Slick exceptions in Postgres mode

* responded to the PR comments
2020-08-18 13:43:12 -05:00
Ben Carman
ffa1f04d7f Disable logging for tests (#1839) 2020-08-16 08:16:30 -05:00
Ben Carman
48a7f6f86e Remove default false for useLogbackConf (#1816)
* Remove default false for useLogbackConf

* Fix docs

* Set logging level to WARN for tests
2020-08-14 08:53:07 -05:00
Chris Stewart
792da6e92f Output logger configuration on startup now (#1814)
* Output logger configuration on startup now

* Remove core-test/logback-test.xml and core/common-logback.xml, consolidate and move them into testkit/src/main/resources/logback.xml

* Add comment for logging configuration
2020-08-13 12:36:42 -05:00
Chris Stewart
ae81dd3bb3 Create more of a project structure in org.bitcoins.core.api, move DbR… (#1799)
* Create more of a project structure in org.bitcoins.core.api, move DbRowAutoInc into the core project

* Get website compiling again
2020-08-12 06:13:23 -05:00
rorp
628fd80d30 Implement Wallet.listTransactions() (#1744) 2020-08-05 07:21:12 -07:00
Ben Carman
e542a00d19 Callbacks to appconfig (#1740)
* Node Callbacks to appconfig

* Move WalletCallbacks to WalletAppConfig

* Update Docs
2020-08-04 12:27:21 -05:00
Ben Carman
0ece51379e CRUD Test suite + updateAll improvements (#1618)
* CRUD Tests

* Remove some hard coded values

* DeleteAll test optimization

* Make deleteAll transactional

* Fix deleteAll test
2020-07-30 10:10:56 -05:00
Ben Carman
82ba6fc09f Wallet API remove app config (#1706) 2020-07-28 15:19:10 -05:00
Ben Carman
ecd3449100 Address Tagging Attempt 2 (#1320)
* Address & UTXO tagging

* Fix docs

* Remove useless function, improve docs

* Fix rebase errors

* Rebase fixes

* Fix docs

* Fix small test errors

* Fix Postgres migration

* Fix postgres
2020-07-08 14:38:39 -05:00
Ben Carman
1957b0508c Rework signing logic to take full funding transaction (#1560) 2020-06-25 16:10:36 -05:00
Nadav Kohen
b92a93c912 ScriptSignature from P2WSH Witness (#1605) 2020-06-24 15:44:16 -05:00
Ben Carman
f1b9e312a3 Cap the amount of threads an actor system can spin up to 2 in tests (#1578)
* Cap the amount of threads an actor system can spin up to 2 in tests

* Add limits for internal dispatcher and default blocking io dispatcher

* Fix config

* Increase thread count to 2, remove unneeded lines
2020-06-22 14:05:21 -05:00
Ben Carman
cd594ab069 AppConfig Start Interface (#1598)
* AppConfig Start Interface

* Use StartStop interface
2020-06-21 09:33:43 -05:00
Ben Carman
5fba40a210 Add tests that NodeCallbacks are executed (#1582)
* Add tests that NodeCallbacks are executed

* Respond to review

* Rebase fixes

* Formatting changes

* Formatting
2020-06-20 08:47:51 -05:00
Scala Steward
97a4886c6e Update scalafmt-core to 2.6.0 (#1579)
* Update scalafmt-core to 2.6.0

* Upgrade scalafmt, fix all formatting errors

* Scalafmt on 2.12

* fix test

* More fixes

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-19 10:38:12 -05:00
Nadav Kohen
35822f4f33 Refactored to allow support and disabling of RBF (#1588)
Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-18 13:23:14 -05:00
Chris Stewart
ba0f38ccf6 2020 06 14 wallet root accounts (#1556)
* Implement unit test cases for initializing a wallet twice, and failing with an exception when we initialize a wallet with a different key-manager

* Use bip39PasswordOpt cached in the WalletUnitTest suite

* Turn off logging

* Run scalafmt

* Turn log level back to WARN

* Run scalafmt
2020-06-17 15:11:42 -05:00
Nadav Kohen
914c905bd7 Lots of misc. improvements from dlc branch (#1583) 2020-06-17 14:34:01 -05:00
Nadav Kohen
e5bd6e53a3 Added compile scope scalafmtCheck to travis runs (#1563) 2020-06-16 15:16:43 -05:00
Chris Stewart
1753f53fd1 Make it so wallet fixtures take a bip39PasswordOpt as a paramter (#1555)
* Make it so wallet fixtures take a bip39PasswordOpt as a paramter

* Fix doc
2020-06-16 10:45:41 -05:00
Nadav Kohen
baf49b7452 Schnorr Data Structures (#1564)
* Pulled down crypto things from dlc branch including: Schnorr data structures, Schnorr Bouncy Castle implementation, FieldElement, and tests for these things

* Call fromValidHex in CryptoUtil
2020-06-16 09:52:45 -05:00
Nadav Kohen
027bd39474 Fixed all walletTest threads not being closed (#1552) 2020-06-15 10:50:53 -05:00
Chris Stewart
6c20a06b45 Change ChainApi.getBestFilterHeader() return type to Future[Option[Co… (#1550)
* Change ChainApi.getBestFilterHeader() return type to Future[Option[CompactFilterHeaderDb]] to resolve issue 1549

* Run scalafmt
2020-06-13 17:01:51 -05:00
Chris Stewart
c54d6dcbdc 2020 06 09 addr invoice string factory (#1538)
* Implement StringFactory with Address and LnInvoice

* Address code review

* Run scalafmt
2020-06-11 10:44:12 -05:00
Ben Carman
a236073555 Optimize and Clean up WalletRpcTest (#1511) 2020-06-08 14:13:01 -05:00
Ben Carman
34255d8de7 Make Golomb Filter Test run in parallel (#1512) 2020-06-04 16:23:34 -05:00
Ben Carman
61d9f0efba Implement best block hash correctly (#1452)
* Implement best block hash correctly

* Handle no common history

* Fix getBlockProof to be BigInt instead of UInt32

* Fix warnings

* Make get best filter use chainwork

* Remove unused function, test isMissingChainWork

* Fix comparisons for chain work in sql

* Fix migrations from rebase

* Fix CI error

* Fix postgresql
2020-06-04 12:05:10 -05:00
Ben Carman
1dd6025b9d Testkit wallet with bitcoind uses bitcoind as api (#1499)
* Testkit wallet with bitcoind uses bitcoind as api

* Fix docs
2020-06-03 14:05:22 -05:00
rorp
823a392e98 PostgreSQL support (#1315) 2020-06-02 16:37:48 -05:00
Chris Stewart
5aeb8ebdd1 Bump akka to 2.6.4, fix deprecated things (#1374)
* Bump akka to 2.6.4, fix deprecated things

* Bump to 2.6.5 akka

* Clean up imports

* Remove materializer from FeeProviders
2020-05-30 08:49:28 -05:00
Chris Stewart
fd67109d54 Bump scodec to 1.14 (#1489) 2020-05-30 07:53:11 -05:00
Ben Carman
c10d5bc89b Fee Rate Api Support (#1470)
* Fee Rate Api Support

* FeeRateProvider Tests

* Rename folder

* Fix docs
2020-05-29 13:01:20 -05:00
Chris Stewart
ccbc68d668 Add -Xfatal-warnings on Scala 2.13 (#1483)
* Add -Xfatal-warnings on Scala 2.13

* Turn off -Xfatal-warnings in docs/
2020-05-29 06:21:56 -05:00
rorp
932c7ede76 Upgrade Eclair to v0.4 (#1421)
* Upgrade Eclair to v0.4

* fix test binary

* logging

* unquote paths

* fix eclair-node.sh

* OSX fix

* cleanup
2020-05-28 10:50:57 -05:00
Nadav Kohen
bc5953b6c8 Rework Standard Finalizer (into pieces) (#1473)
* Made the standard non-interactive tx finalizer simple using composition of its (reusable) pieces

* Responded to code review and made minor improvements

* Fixed docs
2020-05-27 18:05:37 -05:00
Ben Carman
bbff8af1be Fix FeeUnit match not being exhaustive (#1472) 2020-05-27 06:06:06 -05:00
Nadav Kohen
dfd3353cc4 TxBuilder Refactor (#1426)
* Refactored Transaction

Created RawTxBuilder

Created RawTxFinalizer as layer on top of RawTxBuilder

Introduced RawTxSigner and replaced TxBuilder!

Deleted TxBuilder!

* fixed things after rebase

* Made RawTxBuilder compatible with older versions of scala

* Began responding to review

* Made Finalizer take a Builder rather than the other way around

* Added composition for finalizers

* Ran scalafmt

* Updated txbuilder example documentation

* Moved tests from old TxBuilderTest files to relevant new test files

* Added scaladocs
2020-05-21 09:47:08 -05:00
Ben Carman
99db9062ac Add option to correctly use logback config (#1398)
* Logger now uses correct parent logger for all, names appenders correctly

* Set logback to true for tests, rename file

* Fix docs
2020-05-20 15:46:24 -05:00
Chris Stewart
c26ef26d57 2020 05 19 improve test performance (#1449)
* Reduce number of property based tests on BIP32PathTest and add a Future to NetworkPayloadTest's property based tests so it hopefully runs faster on CI

* Run scalafmt

* Make a few more property based tests async

* Make forAllParallel, refactor some test cases to use it

* Make BlockMessageTest async

* Bump timeout
2020-05-20 06:55:36 -05:00
Ben Carman
4942315c9f Fix allowing BytesToPushOntoStack(0) (#1448) 2020-05-19 16:52:58 -05:00
Nadav Kohen
f2fb27dbe3 Fixed buggy type inference on Gen.frequency by explicitly passing in type parameter (#1439) 2020-05-18 14:56:57 -05:00
Nadav Kohen
4eb9980d6b InputInfo Refactor (#1400)
Added OutputReference and introduced public key computation on SPKs

Made InputInfo into an ADT

Made UTXOSpendingInfo use InputInfo

Replaced UTXOSpendingInfo with NewSpendingInfo and got non-test things compiling

Made aliases for (NewSpendingInfo/NewSpendingInfoFull/NewSpendingInfoSingle)[InputInfo]

Got rid of source code mention of UTXOSpendingInfo

sbt compile passes

tests compile

Fixed all coreTest tests

Renamed to UTXOInfo

Some cleanup

Moved redeem script and script witness accessors to companion object

Responded to code review

Added OutputReference and scaladocs

Moved p2pkhPreImageOpt downstream and generalized to hashPreImages

Fixed adding-spks.md

Fixed psbts.md and txbuilder.md

Renamed UTXOInfo

Apply renaming to docs
2020-05-15 11:14:15 -05:00
Chris Stewart
65f21acbf8 2020 05 11 bech32 addr tostring (#1413)
* Make Bech32Address.toString actually print the string representation not the object one

* Remove Bech32Address.toString all together and use the super class definition

* Add test case

* Run scalafmt
2020-05-11 10:59:36 -05:00
Chris Stewart
83b6a74b18 Add rpcport configuration options in both bitcoin-s.conf and as a command line parameter (#1387)
Implement ability to specify rpcport with bitcoin-s-cli
2020-05-04 19:09:32 -05:00
Nadav Kohen
a503441619 Crypto Project Refactor (#1380)
* Added crypto project and decoupled BitcoinSLogger from NetworkElement

Decoupled BitcoinSLogger from Factory

Moved NetworkElement into crypto project

Moved Factory and BitcoinSUtil (renamed to BytesUtil) to crypto project

Moved MaskedToString to crypto project

Added BytesUtil to imports and cleaned up CryptoUtil.recoverPoint

Moved the rest of crypto stuff to the crypto project

Moved crypto tests to crypto-test project

* Added documentation for crypto project
2020-04-30 12:34:53 -05:00
Ben Carman
6d7685b76e Add wallet creation time for rescans (#1353)
* Add wallet creation time for rescans

* Fix docs

* Clean up and add test

* Remove account bday

* Fix compile issue and docs

* Add more chain handler tests

* Use Instant over Long, add docs

* Fix docs
2020-04-29 09:49:41 -05:00
Ben Carman
4234561db9 Remove Unlocked vs Locked Wallet distinction (#1379)
* Remove Unlocked vs Locked Wallet distinction

* Add back TODO comment
2020-04-28 13:58:14 -05:00
Ben Carman
b8331d4cf1 Re-enable NeutrinoNodeWithWalletTest for Linux (#1366)
* Re-enable NeutrinoNodeWithWalletTest with it disabled for mac

* Change to only Linux

* Only disable for CI runs

* Move IsCI to BitcoinSUtil

* Fix compile issue for earlier versions

* Fix syncing compact filters to not skip last filter

* Fix test to be compatible with new start state

* Use correct isCI

* Fix compile issue

* set CI env
2020-04-27 18:20:47 -05:00
Chris Stewart
2a785388bf Create KeyManagerTestUtil.bip39PasswordNonEmpty for test case that requires non empty password (#1373) 2020-04-27 13:41:18 -05:00
Chris Stewart
4c3f6f8e67 2020 04 08 multi db dao (#1355)
* Implement Slick's multi database support via our DAOs

WIP2 work on chain project

WIP make JdbcProfieComponent so we have a common JdbcProfile

WIP2

Clean up a few things

WIP got CRUDAutoInc compiling

Get closer to everything compiling in the chain project

Begin moving database code into JdbcProfileComponent

WIP source compiling

Get dbCommonsTest/ test cases passing

Get rest of tests compiling and passing

* Rebase onto master, fix conflicts

* Run scalafmt

* Run scalafmt again

* Cleanup a few compiler warnings by adding type annotations to thigns

* Explicitly cast tables where they are needed in the wallet project where we need TableQuery for foreignkey / joins in slick

* Redo definition of 'table' to use the profile.api.TableQuery in scope

* Rename all *Table.scala files to *Db.scala

* First crack at address ben's code review

* Fix docs compile issue

* Fixed casting (#30)

* Fixed AppConfig casting

* Fixed TableQuery casting in DbManagement subtypes

* Fixed casts in DAOs relating to internal types

* Address nadav's code review, move JdbcProfileComponent into it's own file

* Remove unused listTables() method

Co-authored-by: Nadav Kohen <nadavk25@gmail.com>
2020-04-25 11:28:58 -05:00
Ben Carman
e1bd6a158b Make fundWalletWithBitcoind have the same utxo amounts as FundedWallet (#1364) 2020-04-24 09:43:19 -05:00
Chris Stewart
cb88b78540 Bump scala version to 2.13.2 (#1360) 2020-04-23 07:38:20 -05:00
Ben Carman
39088475e3 Add sendrawtransaction CLI and Api commands 2020-04-21 13:14:02 -05:00
Ben Carman
aa8a2e14a6 Move Json Reader, Writers, and Serializers to App Commons (#1328)
* Move Json Reader, Writers, and Serializers to App Commons

* Move app-commons outside of app/
2020-04-10 14:33:37 -05:00
Chris Stewart
76a3edd0af 2020 04 02 get new address queue (#1299)
* WIP: Build queue for getnewaddress

* Implement background thread to process requests to getNewAddress so that we fix issue 1009 with it's async issues

* Run scalafmt

* Replace the mutable.ArrayBuffer in AddressHandling with ConcurrentLinkedQueue

* Put FundTransactionhandling.fundRawTransactionInternal's call to getNewChangeAddress() into the for expression so we don't generate an address when the funding of the transaction fails when selecting utxos

* Move thread initialization out of method

* Switch to using ArrayBlockingQueue, which will block thread with .take() so we don't need to loop constantly, add 'addressQueueSize' and 'addressQueueTimeout' configurations

* Update wallet-test/src/test/scala/org/bitcoins/wallet/AddressHandlingTest.scala

Co-Authored-By: rorp <rorp@users.noreply.github.com>

* Add error handling to return the failed future if the queue is full, add a unit test for when the queue is full

* Run scalafmt

* Rebase

* Add scaladoc for throwing an exception

* Run scalafmt again

Co-authored-by: rorp <rorp@users.noreply.github.com>
2020-04-10 14:19:39 -05:00
Ben Carman
b3250dcfba Update TxoState for transactions after they've been confirmed (#1178)
* Add onBlockHeadersReceived NodeCallback

* Add requiredConfirmations config option

* Update TxoState for transactions after they've been confirmed

* Response to review

* Fix compile issue
2020-04-08 16:51:17 -05:00
Ben Carman
c2a0051411 Network specific filterHeaderBatchSize (#1286)
* Network specific filterHeaderBatchSize

* Catch correct exceptions

* Add filter-header-batch-size-regtest to example configs
2020-04-03 17:36:29 -05:00
Ben Carman
29eb6c2e05 Wallet Transaction Tracking (#1197)
* Incoming and Outgoing Transaction Tables

* Remove script sigs for witness txs

* Create parent tx_table for incoming and outgoing txs

* Response to review

* Use isCloseEnough

* Fix test

* Fix rebase error

* Test that tx is tracking all sats correctly
2020-04-02 06:55:09 -05:00
Ben Carman
ff8df7065c Wallet integration for nested segwit v0 spending (#1272)
* Wallet integration for nested-segwit spending

* Move parameter
2020-03-28 09:40:05 -05:00
Chris Stewart
c30efd4919 Add testkit md (#1234)
* Add testkit md

* Address ben's code review

* Fix links
2020-03-15 12:39:43 -05:00
Chris Stewart
cd84e3483d 2020 03 06 wallet rescan test (#1218)
* Add wallet rescan tests

* Create FilterSync, which gives us an API inside of the chain project to sync filters with

Add another unit test to filter sync

Add more unit tests for ChainSync and FilterSync

Clean up some docs, remove some extra lines of code

Run scalafmt

Add filter-sync.md

Cleanup some nits

Add more information of how FilterSync.syncFilters() works

Add 'FilterWithHeaderHash' type so that we can actually validate/verify block headers that are being fed into the chain project

Run scalafmt, hide imports in filter-sync.md so code appears cleaner

Move implicits out of invisible block as it seems to cause errors

Make it so FilterSync processes filters in batches rather than fetching them all at once

Fix compile error

* WIP bitcoind implement ChainQueryApi

* rework fixtures to be able to support injecting ChainQueryApi implemented by bitcoind into our fixture infrastructure for creating wallets

* Fix rebase problem

* Implement getFiltersBetweenHeight() with ben's solution

* WIP Start implementing NodeApi against bitcoind

* Actually inject the bitcoind backed nodeApi into our fixture

* Get first rescan test working for rescanning the entire blockchain

* Implement test case for rescanning from a specific height

* Fix NeutrinoNodeWalletTest test case that uses a experimental version of bitcoind, for now i believe our experimental binary is on v18

* Add wallet-rescan.md, add helper method to WalletApi that allows you to clear out the wallet's utxos/addresses

* Add another log to try to debug CI

* Address code review

* Fix wrong ordering of deletion of tables in clearUtxosAndAddresses()

* reset logging level
2020-03-13 16:11:02 -05:00
Nadav Kohen
a09e976d66 Added hash types to scriptsignature generators (#1219) 2020-03-11 22:25:21 -05:00
Chris Stewart
4c9a22f1e1 2020 03 08 filter sync (#1209)
* Create FilterSync, which gives us an API inside of the chain project to sync filters with

Add another unit test to filter sync

Add more unit tests for ChainSync and FilterSync

Clean up some docs, remove some extra lines of code

Run scalafmt

Add filter-sync.md

Cleanup some nits

Add more information of how FilterSync.syncFilters() works

Add 'FilterWithHeaderHash' type so that we can actually validate/verify block headers that are being fed into the chain project

Run scalafmt, hide imports in filter-sync.md so code appears cleaner

Move implicits out of invisible block as it seems to cause errors

Make it so FilterSync processes filters in batches rather than fetching them all at once

Fix compile error

* Add comment about trust model

* Run scalafmt
2020-03-10 18:01:14 -05:00
Ben Carman
aa548ece14 Merge pull request #1182 from benthecarman/txo-state-test
TxoState Life Cycle Tests
2020-03-03 17:35:00 -06:00
Chris Stewart
1e661848f7 Make eclair tests use bitcoind v19 rather than bitcoind v17 (#1187) 2020-03-02 12:30:22 -06:00
Ben Carman
bc87bc64eb TxoState Life Cycle Tests 2020-02-28 17:18:28 -06:00
Ben Carman
694e727dfc Fix Wallet tests' keymanager to use changed config (#1173) 2020-02-28 08:53:49 -06:00
Chris Stewart
2279313eb9 Move binaries to be stored inside of the HOME/.bitcoin-s/binaries instead of usrdir/binaries. This makes it so different projects that use bitcoin-s can re-use binaries instead of having to download them for every project (#1128) 2020-02-17 12:07:04 -06:00
Chris Stewart
876eab472f Address issue 916. In our chain project fixtures we did not make sure that tables were fully created before trying to insert information into tables in futures. This causes race conditions on slow CI machines that are fixed now because we call 'makeChainHandler()' inside of the setupTableF flatMap (#1129) 2020-02-17 12:06:33 -06:00
Ben Carman
cf3dd113b5 Reserved TxoState (#1111)
* Reserved TxoState

* Allow fund transaction handling to mark utxos as Reserved

* Add test, fix overloading default arg issue
2020-02-13 06:51:50 -06:00
rorp
53f4750a8d Support for Eclair 0.3.3 (#1097) 2020-02-12 11:30:31 -08:00
Chris Stewart
5f938efb8a Create migration to drop confirmations column from txo_spending_info … (#1099)
* Create migration to drop confirmations column from txo_spending_info table in the wallet database, also fix a long standing issue in BitcoinSFixture where failure cases in the testing suite were not being handled properly

* Fix scala 2.11.12 compile issue
2020-02-07 07:45:15 -06:00
Chris Stewart
f8d77ba261 Add peers section to the example configuration (#1065) 2020-01-23 14:45:18 -06:00
Nadav Kohen
48f775182b PSBT Support (#1031)
* PSBT Serialization/Deserialization (#917)

* PSBT Serialization and Deserialization

* Remove debug code

* Create PSBTParseResult, Add more psbt test cases, and various small nits

* PSBT version checking

* Remove PSBTHelper, give PSBTRecord and PSBTMap a fromBytes

* Fix compile issue, preserve ADT

* PSBT Combiner

* PSBT Updater

* Fix PSBT version number to be read as little endian

* Make function names more clear, add scaladoc, require not finalized

* Combiner scaladocs

* Test case from BIP

* Make compatible with older versions

* PSBT: Fix for EmptyWitness changes (#968)

* PSBTInputMap to UTXOSigningInfo

* Remove vars

* Add missing param

* Fix byteVectorOrdering for when x == y

* getUTXOSpendingInfo Tests

* Fix formatting errors

* Give conditional path default value

* formatting fix

* Fixed InputPSBTRecord.FinalizedScriptSig using asmBytes (#1004)

* Fixed PSBTTest after rebasing onto master

* PSBT Constructors and Extraction (#997)

* Added PSBT constructors

* Revived option to use signers in toUTXOSpendingInfo

* Added transaction extraction

* Responded to code review

* Added extraction test from BIP

* Added validation (option) to PSBT extraction

* Added property based test for PSBT.extractTransactionAndValidate

* Marked PSBT as new code for PropertyCheckConfiguration

* PSBT Finalizer (#1002)

* Added finalizing functionality to PSBTs

* Cleaned things up

* Added finalizer test, fails

* Check that PSBT is not already finalized when finalizing PSBT

* Added P2PKWithTimeout cases

* Formatting fix

* PSBT Generators (#1019)

* Introduced non-finalized constructor

* Added property based test comparing finalized and un-finalized construction, it currently fails due to EmptyScriptPubKey not being supported in various ways. Also fixed a ton of bugs!

* Fixed easy bugs relating to EmptyScriptPubKey, one is left

* Fixed the last bugs (multisig order and 0-of-n stuff) and now tests pass!

* Separated out direct finalized PSBT construction from non-finalized PSBT construction

* Translated construction work in tests into PSBT generators

* Added serialization symmetry test

* Made PSBT fee generation dependent on other generators to ensure low enough fees for signing

* Responded to code review

* Added scaladocs

* Fixed arbitraryPSBT to work with older scala versions

* Fixed PSBT compilation breakages from rebase

* Fixed test breakages from rebase

* Validate the PSBT unknown is not a known field

* Increase code coverage on PSBT tests

* Address review

* formatting

* Add error messages, rename function

* Psbt Signer (#1025)

* PSBT Signer

* Create addSignature function for PSBTs

* Use PartialSignature instead of Tuple

* Create extra util functions

* scaladoc and simplify case

* Formatting fix for psbt scaladocs

* Clean up code, add error messages, and scaladoc

* add type hints

* Change InputPSBTMap.fromUTXOSpendingInfo to use BitcoinSingleSigner

* optimize import

* Define separator byte for psbt map

* getRecords simplification

* remove braces, add error message

* PSBT stuff assigned to nkohen (#1035)

* Responded to psbt review assigned to me

* Moved separatorByte to a place where all can use it

* PSBT independent record calls (#1037)

* PSBT independent record calls

* move logic to super class

Co-authored-by: Nadav Kohen <nadavk25@gmail.com>

* Reworked PSBT finalization to return a Try[PSBT] rather than an Option[PSBT] (#1036)

* PSBT signer property based tests (#1038)

* PSBT property based tests

* Address review

* PSBT Combiner property based tests (#1039)

* PSBT Combiner property based tests

* Create pruneGlobal util function

* Switch to arbitrary gen

* Use BaseTransaction instead of Transaction

* Fix transaction witness to work from base transactions

* PSBTs response to Chris's review (#1046)

* PSBT chris's review

* Rename val, give master fingerprint a val

* Formatting fix

* Responded to code review from chris assigned to nkohen

* Split PSBT.scala into many files

* PSBT Docs (#1048)

* PSBT docs

* Fix compiler error, remove nesting

* PSBT output updater tests

* Validate psbt outputs

* Clean up code

* Remove P2WPKHWitnessV0 addition

* format

* PSBT Updater property based tests

* Move code to match block

* EmptyScriptWitness check

* Address nadav review

* Remove unnecessary code, make utxo adder better

* Move require and add error message

* Move require

* PSBT unit tests by Ben

* Change to EmptyScriptPubKey

* Added unit tests to increase code coverage

* responded to review

* Move PSBT unit test to separate file

* Make unknown generator only generate distinct records

* Use groupBy key instead of distinct

* use only first element

* Combine distinctness by key

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-01-23 11:36:42 -07:00
rorp
17c21b3bac Eclair performance tests (#1013)
* Eclair performance tests

* some more changes

* fix unit tests

* scaladoc

* limit number of payment requests

* fix build errors
2020-01-21 12:54:15 -08:00
Chris Stewart
b8c59b4c93 2020 1 11 accounts (#1022)
* Create 'fundRawTransaction' and 'fundRawTransactionInternal'

* Move TransactionTestUtil to testkit, begin writing tests for fundrawtransaction

* Add FundTransactionTests

* Move things to 'FundTransactionHandling' trait

* Start segregating things by HDAccount in the wallet, this gives us the ability to query for balances based on account, fund a transaction based on an account, generate a new address based on an account etc. All old api calls are now based on the default account, i.e. getBalance() returns the balance for account 0, fundRawTransaction funds the transaction from account 0 etc.

* Fix compile issue with 2.11.x

* Bump address generation Thread.sleep() to 500ms

* Address ben code review

* Address code review
2020-01-21 14:20:58 -06:00
Nadav Kohen
603951ea53 Updated P2PKWithTimeout to use CSV instead of CLTV (#1050) 2020-01-21 12:43:09 -07:00
rorp
ee579117cd Merge branch 'master' into eclair_bench 2020-01-21 10:17:20 -08:00
Chris Stewart
03ed5b0d57 Try bumping the Thread.sleep() to get CI to pass on slow mac osx (#1042) 2020-01-19 09:41:54 -06:00
Nadav Kohen
db6447d88a Single Signing (#1020)
* Introduced UTXOSpendingInfoSingle

* Implemented constructors for UTXOSpendingInfoSingle

* Introduced BitcoinSignerSingle

* Implemented SingleSigner

* Added property-based test for SingleSigner, it fails

* Fixed SignerTest :)

* Responded to code review

* Added scaladocs

* Fixed p2sh(p2wsh) signing

* Responded to code review and separated UTXOSpendingInfoSingle from UTXOSpendingInfoFull

* Fixed outputGen after rebase

* Fixed txbuilder.md to show this branch's changes
2020-01-15 10:00:55 -07:00
rorp
74fa1e61af some more changes 2020-01-14 13:53:12 -08:00
Chris Stewart
54b2fa814e 2020 1 04 fund raw tx (#1010)
* Create 'fundRawTransaction' and 'fundRawTransactionInternal'

* Move TransactionTestUtil to testkit, begin writing tests for fundrawtransaction

* Add FundTransactionTests

* Move things to 'FundTransactionHandling' trait

* Address code review

* Run scalafmt
2020-01-13 13:45:33 -06:00
rorp
09769fd891 Merge branch 'master' into eclair_bench 2020-01-07 14:23:11 -08:00
rorp
b1e42e07a9 Eclair performance tests 2020-01-07 10:02:08 -08:00
Chris Stewart
3bedcb20e0 Add more expressive txo states for the wallet (#1001)
* Add more expressive txo states for the wallet

* Rename 'PendingReceived/PendingSpent' -> 'UnconfirmedReceived/UnconfirmedSent'

* Address code review

* Fix posInt implementation to work with older scala versions

* Rename to PendingConfirmationReceived/PendingConfirmationSpent
2020-01-05 18:42:20 -06:00
Chris Stewart
55f168f920 Implement abililty to use BIP39 password. This means this password ne… (#990)
* Implement abililty to use BIP39 password. This means this password needs to be password through our various projects to be able to correctly generate the key that controls the wallet. This also renames 'CreateKeyManagerApi' -> 'BIP39CreateKeymanagerApi' as the bip39 password is needed when creating the KeyManager

* Add bip39 password to BIP39KeyManager.fromParams(), fix mdocs

* Fix bug in unit test were whe weren't specifying password

* Fix rebase issues
2020-01-03 11:03:45 -06:00
rorp
93c02f02d0 Automated wallet recovery (#985)
* Automated wallet recovery

* responded to the PR comments

* some more changes

* fix docs

* cleanup
2020-01-02 13:18:41 -06:00
Chris Stewart
c3fb7c9a67 This creates a subtype BIP39KeyManager and moves all existing KeyMana… (#988)
* This creates a subtype BIP39KeyManager and moves all existing KeyManager functionality to that subtype. We leave a empty 'KeyManager' trait for now

* Fix website docs
2019-12-27 10:09:04 -06:00
Chris Stewart
24ff908240 Move initialization of wallet entropy into the key manager (#966)
* Move initialization of wallet entropy into the key manager

* Enable key-manager in ci, add coverage minimum

* Add coverage minimum for key manager, add KeyManagerParams, start adding KeyManager test harness

* Remove success cases on ADTs, start using Either

* fix import

* Get test coverage to 90%

* Add documentation for key-manager.md, add side bar for key-manager

* Fix wallet.md

* Make seedPath default to baseDatadir, so we don't have a unique seed for every network. Add more documentation

* Address code review

* Address code review from Ben

* Add missing import

* Add more tests for coverage
2019-12-26 19:12:08 -06:00
Ben Carman
5e6b12ecd8 Change ScriptPubKey to RawScriptPubKey in ScriptWitness (#975) 2019-12-24 07:45:55 -06:00
rorp
72ead16e5c Move rescan logic from node to wallet (#974)
* Move rescan logic from node to wallet
2019-12-23 08:57:55 -08:00
Nadav Kohen
c67b2978bf P2PKWithTimeoutSPK (#967)
* Introduced P2PKWithTimeoutSPK

* Responded to review

* Added some testing for cltv and p2pkWithTimeout SPKs

* Responded to more review
2019-12-19 09:48:00 -06:00
Chris Stewart
2bdbc1c822 Refactor make dependent fixtures to use built in scalatest helper met… (#939)
* Refactor make dependent fixtures to use built in scalatest helper methods

* Avoid unit return warning
2019-12-15 18:25:51 -06:00
rorp
2c53a39fd1 Compute confirmations dynamically (#938)
* Compute confirmations dynamically
2019-12-14 12:06:22 -08:00
rorp
4acd1fbba9 Add a reference to ChainQueryApi to the wallet (#936)
* Add reference to ChainQueryApi to wallet
2019-12-10 14:22:33 -08:00
Chris Stewart
388becbc6b 2019 12 10 scalatest 3.1.0 (#933)
* Update scalatest to 3.1.0

* Modify code to support scalatest 3.1.0
2019-12-10 09:12:47 -06:00
rorp
af70acb03b ChainQueryApi (#926)
* ChainQueryApi

* cleanup
2019-12-09 09:39:35 -06:00
rorp
cbd038b514 Neutrino Wallet: OnCompactFilter handler (#905)
* Neutrino Wallet: OnCompactFilter handler
2019-12-06 13:10:33 -08:00
Ben Carman
5206353a4a Bitcoind v19 RPC (#910)
* bitcoind v19 new RPC calls and tests (#863)

* bitcoind v19 new RPC calls and tests

* Code review changes

* Review part 2

* Rename variable to be more descriptive

* Explanitory comment

* Ignore broken test cases

* Add missing signing functions

* Add test to check avoid_reuse flag is on (#870)

* Add test to check avoid_reuse flag is on

* Add test to make sure flags weren't set

* bitcoind v19 Update mempool RPCs and tests (#868)

* Update mempool RPC calls to bitcoind v19 compatibility

* Typo fix

* Add parameter name to calls

* Fix remaining rpc calls

* Formatting

* scaladoc for param

* Change param to correct type

* Clarify on scaladoc

* Add missing fees parmater to mempool rpcs (#875)

* Add weight field to mempool entries after v19 (#876)

* Move DescriptorRpc to be able to be used by future versions of bitcoind (#878)

* Add window_final_block_height to GetChainTxStatsResult (#880)

* Add passphrase argument to createwallet for later versions (#883)

* Add passphrase argument to createwallet for later versions

* Scaladoc + empty passphrase requirement

* Error message

* Add new services names parameter to P2P rpcs (#874)

* Add new services names parameter to P2P rpcs

* Add ServiceIdentifier Reads

* Add fallback case

* Address review

* Change to Try

* Move PsbtRpc to be able to be used by future versions of bitcoind (#877)

* Move PsbtRpc to be able to be used by future versions of bitcoind

* Add test

* Address comment

* Enable bloom filters for v19

* Enable bip 61 for tests

* Change to official binaries

* Force v18 for Spv Tests

* Remove unused config line
2019-12-04 07:44:44 -06:00
Chris Stewart
dd4787f2af 2019 11 30 key manager (#904)
* Segregate key manager from wallet

* More consistent naming in build.sbt, run scalafmt

* Add test case making sure we don't overwrite a mnemonic seed

* Add key-manager.md

* Fix compile issues with older scala versions

* Address code review
2019-12-04 07:43:29 -06:00