Commit Graph

254 Commits

Author SHA1 Message Date
Scala Steward
ea39f38443 Update scalatest to 3.2.0 (#1592)
* Update scalatest to 3.2.0

* Fix tests to be compatible

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-20 08:46:32 -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
a1d17ab662 Added DLC GUI stuff to a new package in the existing GUI and made a new tab for DLCs (#1590)
Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-18 15:23:53 -05:00
Nadav Kohen
9237074510 Pulled down dlc CLI code (#1589)
* Pulled down dlc CLI code (returns 400 Bad Request when called)

* Added decodeRawTransaction to server

* Moved decoderawtransaction to CoreRoutes

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-18 13:55:17 -05:00
Ben Carman
5319b4c927 Wallet callbacks (#1543)
* Wallet Callbacks

* Move noop to Callback

* Add docs

* Add tests for wallet callbacks

* Use BitcoinAddress instead of AddressDb, improve tests
2020-06-17 17:21:19 -05:00
Chris Stewart
dec503f561 2020 06 12 mv to appconfig (#1553)
* Move hasWallet() to WalletAppConfig

* Move helper methods to create data dstructures in a project to their respective AppConfig file
2020-06-16 12:49:32 -05:00
Nadav Kohen
3912a02f53 Added BlockTimeStamp abstraction for BlockStamps that aren't hashes (#1573)
* Added BlockTimeStamp abstraction for BlockStamps that aren't hashes

* Made BlockStamp and BlockTimeStamp extend StringFactory
2020-06-16 10:54:37 -05:00
Ben Carman
1731bd3163 Callback rework (#1542) 2020-06-15 17:30:08 -05:00
Nadav Kohen
027bd39474 Fixed all walletTest threads not being closed (#1552) 2020-06-15 10:50:53 -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
Chris Stewart
f9f1e89a07 Break things up in server/Main.scala, allow things to be done asynchr… (#1522)
* Break things up in server/Main.scala, allow things to be done asynchronously where they can be

* Rework Main.scala to have small methods that are used to initialize parts of our infra. Now it doesn't depend on global variables in Main either, they are implictly passed to these helper methods
2020-06-09 07:44:37 -05:00
Chris Stewart
b52ec8b041 Introduced bundle project and created main class that runs server and then gui (#1531)
Co-authored-by: nkohen <nadavk25@gmail.com>
2020-06-08 08:32:38 -05:00
Chris Stewart
32c06cbe81 2020 06 05 mv chainwork calc (#1519)
* Fix Chaindb chainwork Migration

* Move chain work calculation out of node, use the ChainApi returnd by runChainWorkCalc()

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-06-05 11:04:09 -05:00
Ben Carman
2f53379f16 Add docs for server endpoints (#1505) 2020-06-04 06:41:07 -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
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
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
Ben Carman
b240130c76 Remove GUI unused imports (#1440) 2020-05-18 14:36:45 -05:00
Ben Carman
51fcb793be Add ability to make OP_RETURN commitments (#1417) 2020-05-18 14:27:05 -05:00
Ben Carman
e44a08bd39 Wallet Send with coin selection algorithim (#1409) 2020-05-18 11:26:39 -05:00
Ben Carman
6067991e02 Add bitcoin-s icon, add dark theme to dialogs (#1425) 2020-05-18 11:16:41 -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
Ben Carman
867e2a9755 Add list unused addresses call (#1408) 2020-05-12 09:29:02 -05:00
Ben Carman
711f5cb99c Add listFundedAddresses call (#1407) 2020-05-12 07:33:22 -05:00
Ben Carman
721b28aefd Add listSpentAddresses call (#1406) 2020-05-12 07:24:52 -05:00
Ben Carman
c571585b3b Wallet send from outpoints (#1405) 2020-05-12 07:24:36 -05:00
Chris Stewart
40c4af93a7 Modify gui background color to be same as our website (#1404) 2020-05-09 08:03:29 -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
90030719e5 Log correct type of node sync (#1384)
* Log correct type of node sync

* Fix stopped node logs
2020-04-30 12:10:48 -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
37c62369eb Batch processing compact filters (#1363)
* Batch processing compact filters

* Use one vector, rename param

* Fix compile issue on older versions

* Process sequentially
2020-04-26 09:34:41 -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
3d26ad8f34 Rescan from account (#1348) 2020-04-24 09:37:12 -05:00
Ben Carman
b83d447e67 Fix sendrawtransaction output again woops 2020-04-22 11:45:56 -05:00
Ben Carman
5ff9bf7839 Change sendrawtransaction return to be just txId (#1354) 2020-04-22 08:01:56 -05:00
Ben Carman
56babfd083 Fix test 2020-04-21 14:38:57 -05:00
Ben Carman
b16b44bb8d Past tense 2020-04-21 13:23:07 -05:00
Ben Carman
39088475e3 Add sendrawtransaction CLI and Api commands 2020-04-21 13:14:02 -05:00
Nadav Kohen
ea4a5e0c42 Increased test coverage by 0.97% (#1343) 2020-04-20 12:53:51 -05:00
Ben Carman
b0150f006d Merge pull request #1316 from benthecarman/dark-mode-gui
Dark mode GUI
2020-04-13 11:42:17 -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
0532d97ae5 Fix Block Header Callback (#1331) 2020-04-10 13:47:23 -05:00
Ben Carman
172eef84ca Set statusLabel.text 2020-04-09 12:06:29 -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
09399f1349 Respond to review 2020-04-07 17:16:14 -05:00
Ben Carman
70d29050f8 Dark mode GUI 2020-04-07 16:06:55 -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
402b9c9f3a Add CLI commands for current wallet apis (#1291) 2020-04-03 17:18:34 -05:00
Ben Carman
7326fd5035 Change NodeCallbacks to Future[Unit] s (#1206)
* Change NodeCallbacks to Future[Unit] s

* Fix compile issue

* Change try to future

* Change Future.sucessful(()) to FutureUtil.unit

* Callback failure handling, callback docs

* Create functions for executing callbacks, make merkleblock a future

* Convert MerkleBuffersTest to BitcoinSAsyncTest

* Fix compiler errors

* Reorder UpdateBloomFilter tests so that txFromWalletP is a success for both calls and the other test does not wait on the promise to complete
2020-04-03 08:57:41 -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
Nadav Kohen
c31a4a3f8a Constructed simple Bitcoin-S wallet GUI (#1285)
* Constructed simple Bitcoin-S wallet GUI

* Added note about bitcoin-s server in doc

* Removed wallet dep from gui

* Replaced lambdas with constructors for compatibility with scala 2.11

* Fixed after rebase
2020-03-31 14:30:24 -05:00
Ben Carman
47c2bc08c4 Merge pull request #1268 from benthecarman/cli-stop
CLI command to stop node
2020-03-30 12:43:00 -05:00
Ben Carman
0bf4d2b51b Merge pull request #1273 from benthecarman/custom-fee-rate-sendtoaddr
Custom fee rate for wallet sends
2020-03-30 12:31:52 -05:00
Ben Carman
e9d261382d Fix CLI commands (#1271) 2020-03-28 08:53:31 -05:00
Ben Carman
2e5c3f1866 Terminate not reliant on node.stop 2020-03-25 13:48:13 -05:00
Ben Carman
5e4d23d562 Custom fee rate for wallet sends 2020-03-25 11:23:12 -05:00
Ben Carman
318c3a83df CLI command to stop node 2020-03-23 16:57:47 -05:00
Ben Carman
a286283aa4 CLI help message include commands and their arguments (#1254) 2020-03-19 08:04:56 -05:00
Ben Carman
fb4bf84891 Remove requirement for sats parameter (#1190) 2020-03-03 08:59:25 -06:00
Ben Carman
77674a3ca8 Allow getbalance to return in sats 2020-02-27 14:18:38 -06:00
Chris Stewart
03cfbc0803 2020 02 21 datadir configurable (#1156)
* Make it so that you can pass in the datadir from the command line

* Add example on website

* implement ben's solution
2020-02-24 09:50:40 -06:00
Nadav Kohen
7169455eff Got rid of warning messages! (#1133)
* Got rid of warning messages!

* Reverted collection conversion changes because scala 2.11 is dumb
2020-02-19 08:02:33 -06:00
Nadav Kohen
099465f72a Multiple Logger Fix (#1086)
* An attempt to fix logging to file using MDC

* Responded to review
2020-02-11 11:35:28 -06:00
Nadav Kohen
90c56fff7e Added server handling for empty account tables while a seed exists (#1094)
* Added server handling for empty account tables while a seed exists

* Add test coverage to key-manager

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2020-02-09 11:14:53 -06:00
Nadav Kohen
da1aecaab5 Console CLI (#1095)
* Moved Cli code to an object called ConsoleCli which can be called from sbt console

* Add --allow-incomplete-classpath to cli.sbt

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-02-04 08:05:38 -06:00
Ben Carman
5276beac6e Simplify txReads 2020-01-28 22:13:50 -06:00
Ben Carman
964fcbc064 Replace null values with EmptyTransaction and PSBT.empty 2020-01-28 10:37:16 -06:00
Ben Carman
d2ed88067b CLI Commands for PSBTs 2020-01-28 00:06:15 -06:00
Ben Carman
0c2d324258 CLI command for filter and filter header counts (#1063) 2020-01-23 14:45:33 -06: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
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
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
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
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
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
Chris Stewart
f4e43ec4d8 2019 11 28 cli native image doc (#903)
* Add documentation about how the cli can be built with a native image

* Finish rest of documentation on building command line client for bitcoin-s

* Add missing akka actor on walletServer classpath, add plugins to be able to build the walletServer as a standalone jar

* Add server.md

* Rename walletServer -> appServer

* Address code review, add missing main class in server project

* Address code review
2019-12-04 07:25:03 -06:00
rorp
2599a1abfa [Neutrino] Update balances (#888)
* [Neutrino] Update balances

* responded to the comments

* some more changes
2019-11-27 16:00:19 -06:00
rorp
14d3878d01 Rescan RPC (#854)
* Rescan RPC

* cleanup

* fix optional args

* cleanup

* unit tests

* fix build error

* fix unit tests

* scalaMock

* cleanup

* more unit tests

* some more validation checks
2019-11-21 08:03:32 -06:00
rorp
ce55897243 Create removed Neutrino tables (#796) 2019-10-14 14:42:59 -05:00
rorp
f4cedece68 Disable OSX neurtino tests in CI (#777)
* Disable OSX neurtino tests in CI

* fix command line

* fix travis config

* revert .travis and mark NeutrinoNodeTest as @DoNotDiscover
2019-10-06 09:30:08 -05:00
rorp
dac3b0091c Remove bitcoind dependency from node (#770)
* Remove bitcoind dependency from node

* addded some comments
2019-10-01 14:11:47 -05:00
Chris Stewart
97472930d0 2019 09 27 logging refactor pt2 (#765)
* Remove AKKA_CONFIG that was preventing sane logging for akka, move db-commons reference.conf to testkit so we can control testkit applications, and then rename app/server/.../application.conf to reference.conf like good libraries should do

* Update contributing.md

* update a few more links inside of contributing.md

* Run scalafmt
2019-09-28 09:50:42 -05:00
Chris Stewart
f65f11aead Add akka logging documentation to our contributing.md (#764) 2019-09-27 10:56:16 -05:00
rorp
74a44d1c4d Initial BIP157 support (#695)
* WIP: Initial BIP157 support

* store block hash and hetgh along with its compact filter header

* download and parse block filters

* getcfilters/cfilter

* cfilter table

* rescan full filter chain

* improved rescan performance

* optimize compact headers download

* addressed the PR comments

* split SVP and Neutrino node implementations

* configurable filter batch sizes

* initial filter sync

* addressed comments

* chage filter table's primary key

* fix Golomb filter deserialization

* batch database inserts

* neutrino node test

* fixed node test

* addressed the PR comments

* serializers tests

* cleanup

* fix compilation errors

* fix unit tests

* increase test coverage

* enable NeutrinoNodeTest

* make scalafmt happy

* don't cache experimental binaries

* inclease test coverage

* fix unit tests

* more granular CI tests

* disable NeutrinoNodeTest

* refactor tests

* addressed comments

* test coveage

* fix formatting

* responded to the comments

* some more changes

* fix the build

* test coverage

* revert testnet3 config parameter

* minor changes

* cleanup
2019-09-25 13:18:51 -05:00
Chris Stewart
67ead0bc7e 2019 09 05 scalafmt update (#735)
* Update scalafmt to 2.0.1

* Scalafmt

In this commit we
1) Reconfigure the .scalafmt.conf file
2) Add a scalafmt binary (same version as specified in conf file)
3) Use said binary on CI to check that everything is formatted correctly

* Ran scalafmt

* Update scalafmt ignore

* Add scalafmt plugin to project/plugins.sbt, run it

* run scalafmt
2019-09-05 20:02:58 -05:00
Torkel Rogstad
8a58d7dde8 Make it possible to construct RPC client without ActorSystem (#725) 2019-08-30 15:12:18 -05:00
Torkel Rogstad
c2f37335b8 Bump Scala versions (#697)
* Bump Scala versions

Support Scala 2.12.9
and 2.13.0.

To make this easier, we delete the `scripts` project. Everything
that was in here was covered by content on the website. We also
delete the `doc` folder, as that was a remnant from when `scripts`
was called `doc`.

* Crib uPickle akka-http support while we wait for publish

* Fix compiler warnings

* Add note on test logging to contribution guide

* Reduce duplication in Blockchain implementation

* Use Scala 2.12 for website

* Introduce compat package object for collections converters

* Fix Either compiler warnings

* Add sync-chain and create-wallet docs from deleted scripts

* Fix rebase goofup
2019-08-23 13:53:00 -05:00
Torkel Rogstad
2a0d78d054 Tweak module logging (#698)
* Split app loggers into their corresponding modules

This avoids a bunch of places with awkward implicit resolution.

We also make sure that all logging in node, chain and wallet
happens with the app loggers, and not BitcoinSLogger

* Tune test logging level to WARN
2019-08-20 08:11:10 -05:00
Chris Stewart
b0b1c1cc42 Start the process of refactoring our ChainHandler to be able to avoid… (#655)
* Start the process of refactoring our ChainHandler to be able to avoid database calls on TipValidation

WIP: Begin explicity passing state back and forth in return types of PeerMessageReceiver, P2PClient, , DataMessageHandler. This commit also implements the ability to keep our blockchain completely in memory. Previously when we were updating the tip of the chain, we had to make a database read to figure out what the best tips are. This is suboptimal for performance because a database read needs to be done for every block header we see, now we just keep the chain in memory

Fix bug in DataMessageHandler that pre-emptively sent a getheadersmsg to our peer. Make 'chainApiF' internal to our spvNode (not a parameter). This forces the chainApi to be created from disk everytime a new SpvNode is spun up. This keeps us in sync with the blockchain at disk at the cost of disk access and less modularity of SpvNode

Address torkel code review

Fix rebase issues

Address code review

Address nadav code review

* Rebase onto master, fix api changes
2019-08-06 13:31:54 -05:00
Torkel Rogstad
46280c9e59 Add functionality for updating SPV node bloom filter (#585)
* Add functionality for updating SPV node bloom filter

* Add SPV node shutdown to exit hook

* Clean up traits/case classes

* Change fixture in WalletBloomTest

* Fix logging bug in TransactionProcessing

* Add MerkleBuffers

In this commit we add MerkleBuffers, which is an object
that lets us aggreagate merkleblocks with their corresponding
transactions before sending them out. This is global, mutable
state (bad!) but it's a working solution for now;

* Use TestAsyncUtil

* Add MerkleBuffers test

* Send getdata if receiving single header

* Change awaitSync to use block count

* Fix UpdateBloomFilterTest

* Add more logging of chain/headers validation

* Send getdata for all blocks

* Nits: Scaladocs, comments toString
2019-08-02 09:22:20 -05:00
Torkel Rogstad
a76f61f97c Add configurable logging to data directory (#640)
* Add logging to data directory

In this commit we add the ability for the node, chain
and wallet projects (+ the server) to log to the users
data directory instead of whatever directory the
binaries was launched from. This is inherently a bit
more complicated than our previous setup, because
we need to read the user directory before we can create
loggers. As a result of this, some files/methods were
moved around, so the relevant app config could be
found in scope.

We also  introduce several logging categories that can be
tuned individually through user configuration. These logggers
are exposed both as traits that give a field `logger`, or
as methods that return the required logger.

* Add datadir configuration to AppConfig

In this commit we add support for AppConfig to pick up
the data directory configuration file. We also add
a section to the contributing guide on how to tune
logging levels.

* Pass data directories explicitly for configuration
2019-08-01 06:01:56 -05:00
Torkel Rogstad
5f80476f4a Update cli.sbt for native-image building 2019-07-18 15:47:59 +02:00
Torkel Rogstad
7f0b11c019 Add functionality for broadcasting TXs to node (#577)
* Add functionality for broadcasting TXs to node

In this commit we add functionality and tests
for broadcasting a TX from our node. To accomplish
this we introduce a table over broadcastable TXs
that's added to when the externally facing method
broadcastTransaction(tx) withing SpvNode is called.
We send out a inv message for the TX we just added,
and upon receiving a getdata message we search in
the previously mentioned table for entries where
the hashes match up.

* Broadcast TX from server to SPV node

* Perform assertions on the balance of bitcoind after sending a TX

* Remove typeclass from broadcast TX

* Refactor withFundedWalletAndBitcoind

* Match on BitcoindExecption instead of throwable

* Clean up broadcast functionality after code review
2019-07-17 07:32:05 -05:00
Chris Stewart
a4e574aac3 2019 07 15 rm cli testkit (#625)
* re-add skip publishing for the cli, remove the dependency from the testkit

* Apply common settings to picker project
2019-07-15 08:04:42 -05:00
Chris Stewart
d67aec8ebb If we don't publish these three subprojects, testkit cannot be used as a dependency for other applications (#621) 2019-07-14 07:27:59 -05:00
Torkel Rogstad
30e6d7030f Somewhat dirty standalone server and CLI binary (#558)
* PoC bitcoin-s-cli

* Add CLI, Server sbt projects, remove Ammonite

In this commit we set up sbt configuration for
CLI, Server (in-work-name) and corresponding
test projects.

We also remove Ammonite shell from sbt, as that
isn't really being used. bloop console offers
the same functionality way more ergonimic.

* Move BitcoinSAppConfig into new server project

Server project depends on node, chain wand wallet
so this is a good time for introducing this class
into main sources. We also introduce
BitcoinSTestAppConfig in testkit, to replace the
functionality in BitcoinSAppConfig related to
tests.

* Type chain in blockchainresult

* MVP server setup for node, chain and wallet

* Extremely dirty CLI for interacting with server

* initial attempt at mimicking Bitcoin Core API

* WalletStorage: add method for checking for seed existance

* Check for seed existance on wallet startup

* Fix bug where MnemonicNotFound was not an error

* Segregate confirmed and unconfirmed balance methods

* Add error handling, improve formatting of CLI output

* Tweak build

Bump Sttp version, downgrade to uPickle 2.11 compat,
skip publish in cli-test and server-test

* Add CLI, server and picklers to root project
2019-07-10 06:33:17 -05:00