Commit Graph

1507 Commits

Author SHA1 Message Date
Torkel Rogstad
5e9b26bbab Remove untyped CryptoUtil methods (#722)
Types are our friends:-)
2019-08-27 06:32:50 -05:00
Scala Steward
2ced3b1bf9 Update sttp:core to 1.6.4 (#664) 2019-08-26 13:54:56 +02:00
Scala Steward
7260789812 Update sbt-mdoc to 1.3.2 (#720) 2019-08-26 13:39:02 +02:00
Scala Steward
d50225d010 Update flyway-sbt to 6.0.0 (#719) 2019-08-23 18:44:42 -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
Scala Steward
b6a73d01ef Update flyway-sbt to 5.2.4 (#715) 2019-08-23 12:55:14 -05:00
Chris Stewart
db18a4bfa4 fix monitor invoice timing out in #693 (#718)
* fix monitor invoice timing out in #693

* Bump timeout more
2019-08-23 11:57:53 -05:00
Torkel Rogstad
2f5d4db1b2 Bump test coverage (#713)
* Bump test coverage

* Lower test coverage requirement for chain
2019-08-23 18:32:55 +02:00
Chris Stewart
2238308201 2019 08 16 process header optimization (#701)
* WIP: implement processHeaders() in ChainHandler instead of processHeader()

* Create ConnectTipResult which is returned from Blockchain.connectTip(), this decouples 'BlockchainUpdate' and Blockchain.connectTip(). This was needed because it doesn't make sense to have a Vector[BlockHeaderDb] returned from Blockchain.connectTip() as we are validating one header. However, to execute batch inserts, we need to accumulate headers somewhere. I choose to do this in BlockchainUpdate with the 'successfulHeaders' field.

* make chain-verification log level INFO

* Add unit test for benchmarking ChainHandler.processHeaders() that cuts out extraneous noise in another test case

* Address code review
2019-08-23 05:48:09 -05:00
Scala Steward
61fc6e16e3 Update sbt-native-packager to 1.4.0 (#711) 2019-08-22 09:56:34 -05:00
cwaldron97
47644b7910 (WIP) Createwallet rpc from V17 (#712)
* create wallet rpc

* fixed test

* change to createwallet test

* create wallet test
2019-08-21 16:34:11 -05:00
Chris Stewart
cf3c63e780 Use transactionally when inserting data into our database with createAll (#708) 2019-08-21 06:28:28 -05:00
Scala Steward
ac73ba9414 Update akka-actor, akka-stream, ... to 2.5.25 (#700) 2019-08-20 10:46:21 -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
ff051ac7a2 2019 08 05 broadcast tx test (#680)
* Start refactoring BroadcastTransactionTest to use new SpvNodeFundedWalletBitcoind fixture

* Double timeout to 10.seconds on spv node disconnect

* Attempt to bump disconnect even more

* Add more logging around starting and stoping spv node to try and debug failures with fixtures on test suites

* move starting of spv node into one place in the fixtures -- createSpvNode() --, also look at ordering of destruction to make sure that the spv node is stopped/destroyed BEFORE bitcoind is stopped/destroyed. If the inverse order happens, our spv node won't receive a response from bitcoind and will hang waiting for the Tcp connection to close gracefully

* Try switching from  to  to get CI to pass

* Add more logging and throws to try and debug failures on ci

* Add logging in the case we send a close command and peer isn't defined

* Match on Tcp.Connect on default receive in P2PClient

* Make SpvNode.disconnect() check to see if we are connected before attempting to disconnect

* Add more logging in fixtures, change behavior of SpvNode.disconnect() to not throw if we are already disconnected

* Switch to preferred way of terminating actor system in tests

* Make PeerMessageSender.sendMsg() return a , make sure a message is not sent to P2PClient until we are fully intialized

* Switch p2p logging to DEBUG

* Complete disconnect promise on peer message recv in the case where we didn't have a peer to begin with

* Make SpvNodeTest more robust, fix bug for when we send 'sendheaders' message. We shouldn't do this until our peer has sent us a verack

* Only send 'sendheaders' message to our peer after we receive a 'sendheaders' message from our peer. Hopefully this solves async issues where we were sending 'sendheaders' before our handshake was fully completed with our peer which means we wouldn't get headers sent to us

* Cleanup pt1
2019-08-14 07:18:36 -05:00
Chris Stewart
6369c64b6f Make all instances of HashDigest extend AnyVal so we do not allocate runtime objects to avoid GCs (#690) 2019-08-14 06:35:10 -05:00
Chris Stewart
7caf0c355b 2019 08 09 Don't use BlockHeaderDAO in TipValidation (#688)
* WIP: De-futurify TipValidatoin.chewNewTip()

* De-futrify POW and TipValidation, now tip connection is done synchronously thanks to our in memory blockchain implementation

* Fix improt issues, unused parameters
2019-08-13 10:33:19 -05:00
Scala Steward
0abc9a77cf Update slf4j-api to 1.7.28 (#687) 2019-08-10 10:50:48 -05:00
Scala Steward
42c36cc067 Update akka-actor, akka-stream, ... to 2.5.24 (#686) 2019-08-09 16:03:15 -05:00
rorp
5cac74d8a6 Fix Eclair start/shutdown test (#684) 2019-08-09 15:56:33 -05:00
Chris Stewart
5d8a4c0ef2 Change 'height' types from Long -> Int. Int.MaxValue is 2147483647, which is an order of magnitude more than current block heights on mainnet/testnet bitcoin (#685) 2019-08-09 09:22:00 -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
Chris Stewart
c934d8efc2 Address issue #673, also refactor fixture stuff to be in companion ob… (#676)
* Address issue #673, also refactor fixture stuff to be in companion objects rather than traits so they can be re-used without extending the trait itself. This allows for more modularity with our fixtures

* fix bugs in unit tests, address #675 to make MerkleBufferTests faster

* Refactor test timeout in UpdateBloomFitlerTest

* fix callback logic bug on matching unrelated txs/addresses in UpdateBloomFilterTest, re-order broadcasting of things to avoid async bugs hopefully

* Make  a def in NodeUnitTest, this keeps tests in the same suite from using the same config. This allows us to write multiple tests per suite, instead of just one. This also adds implicit parameters to our fixture constructors/destructors to properly create and destroy this config. The long term goal here also should be getting rid of config.initialize() we are calling everywhere as this is a anti-pattern, fixtures should take care of construction and destruction of things

* Broadcast tx earlier in test case for UpdateBloomFilterTest

* Rework NodeWithWalletTest to use the new fixtures we have in the node project, now use SpvNodeFundedWalletBitcoind
2019-08-06 11:49:17 -05:00
Scala Steward
4d1b509ae7 Update slf4j-api to 1.7.27 (#677) 2019-08-06 07:13:32 -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
dd6c86dc14 Add EitherOps back (#666) 2019-07-31 09:16:05 -05:00
cwaldron97
e6dcd1cfb4 Cleaning up Publish Logs (#634)
* This PR is attempting to remove the publishing errors when publish
locally many of which are incorrectly linked things in scaladocs which
there are some differences in formatting. Hopefully this removes alot
if not all of the "link not found for ..." warning messages that show
up.
2019-07-31 12:28:22 +02:00
Torkel Rogstad
cee2665d49 Add note on how to build JAR files (#663) 2019-07-30 18:52:50 -05:00
cwaldron97
f59d4007c3 Replace Bitcoins params in RPC client with CurrencyUnit (#618)
* implemented currency unit and wrote a writer

* Convert more Bitcoins parameters to CurrencyUnit
2019-07-30 18:52:01 -05:00
cwaldron97
7183296b6b Killing Joda Dependency (#643)
Remove Joda dependency
2019-07-29 12:22:25 +02:00
Torkel Rogstad
6f42dca64b Merge pull request #567 from Christewart/2019-07-03-resolve-http-parse-exn-bitcoind
Attempt to resolve issue #527 where bitcoind returns html indicating …
2019-07-23 00:38:28 +02:00
Chris Stewart
898691d1a1 Implement missing branch on POW validation for testnet, implement Blo… (#652)
* Implement missing branch on POW validation for testnet, implement BlockHeaderDAO.find

* implement second special case for if we are allowing min difficulty blocks, but are at a POW change interval. If we are at a POW change interval, we return that block

* Address code review
2019-07-22 07:19:57 -05:00
Torkel Rogstad
400219f74d Tweak error logging of bitcoind responses
In this commit we move the error handling part of bitcoind responses
closer to the source of where they will happen, hopefully
giving better error messages.
2019-07-22 13:33:22 +02:00
Chris Stewart
a378838a8a implement ability to monitor a invoice that we are generated (#649)
* implement ability to monitor a invoice that we are generated

* reorganize tests to get them to pass
2019-07-19 13:03:43 -05:00
Torkel Rogstad
428bd079d9 Merge pull request #647 from torkelrogstad/2019-07-18-merkle
Fix merkle block parsing error
2019-07-19 10:51:28 +02:00
Torkel Rogstad
c64f143628 Fix merkle block parsing error 2019-07-19 10:49:34 +02:00
Chris Stewart
13ba42b087 Call BitcoindRpcTestUtil.stopServer inside of EclairRpcTestUtil.shutdown (#645)
* Call BitcoindRpcTestUtil.stopServer inside of EclairRpcTestUtil.shutdown

* Reset submodule
2019-07-18 12:35:33 -05:00
Torkel Rogstad
dadf01493a Merge pull request #606 from scala-steward/update/sbt-native-packager-1.3.25
Update sbt-native-packager to 1.3.25
2019-07-18 15:50:27 +02:00
Torkel Rogstad
5f80476f4a Update cli.sbt for native-image building 2019-07-18 15:47:59 +02:00
Torkel Rogstad
245a77b3db Merge pull request #637 from cwaldron97/2019-07-16-remove-bitcoinj-dep
Remove BitcoinJ from dependencies
2019-07-18 11:01:19 +02:00
cwaldron97
ab29c0cc8f more removal 2019-07-17 14:47:45 -05:00
Scala Steward
f3b92d33ce Update akka-http, akka-http-testkit to 10.1.9 (#639) 2019-07-17 13:17:58 -05:00
Nadav Kohen
0013aded27 Removed self-reference infinite loop for LnTaggedFields.apply (#641) 2019-07-17 12:34:33 -05:00
Scala Steward
f252a08f6b Update sbt-native-packager to 1.3.25 2019-07-17 15:31:16 +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
cwaldron97
87f6300082 started to remove bitcoinj deps 2019-07-16 15:12:38 -05:00
Chris Stewart
90dbb9d9f8 qAddress issue where source and target fields don't work completely for jdk 9+ when trying to target jvm 1.8 (#636) 2019-07-16 14:58:36 -05:00
Chris Stewart
220d8d160e Scope the targetting of code only to compiling code, instead of including things like javadoc generation (#632) 2019-07-16 11:32:27 -05:00
Torkel Rogstad
393a531f8a Merge pull request #630 from torkelrogstad/2019-07-16-false-positives
Remove assertion on irrelevant TX
2019-07-16 17:15:11 +02:00