Commit graph

128 commits

Author SHA1 Message Date
Nadav Kohen
4ee36e84e9 Removed the sealed trait and private case class Impl pattern from ScriptPrograms (#759) 2019-09-26 07:31:54 -05:00
rorp
933f0fcfd0 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
46681e08d7
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
e18f105abc Refactor sbt and make Eclair tests download bitcoind (#727) 2019-08-30 15:11:52 -05:00
Torkel Rogstad
68f8132070 Remove untyped CryptoUtil methods (#722)
Types are our friends:-)
2019-08-27 06:32:50 -05:00
Torkel Rogstad
a303818c1e 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
227b5239e5
Bump test coverage (#713)
* Bump test coverage

* Lower test coverage requirement for chain
2019-08-23 18:32:55 +02:00
Chris Stewart
999d3aeba7
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
c89cfea924
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
Chris Stewart
762168127c
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
020a935618
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
b706e8ea45 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
cwaldron97
b6a5ffea4d 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
72018bf831 Fix merkle block parsing error 2019-07-19 10:49:34 +02:00
Nadav Kohen
ccd6e7237a Removed self-reference infinite loop for LnTaggedFields.apply (#641) 2019-07-17 12:34:33 -05:00
Torkel Rogstad
48e379d64e
Merge pull request #590 from torkelrogstad/2019-07-10-addresses
Add notion of address types in wallet
2019-07-16 14:01:03 +02:00
Torkel Rogstad
59ed95297b Add notion of address types in wallet
In this commit we
1) Add the notion of address types in the wallet, and remove
    the emphasis on account types. Users now just request
    a segwit/nested-segwit/legacy address, and we take care
    of querying for the correct account
2) Fix a bug where a wallet could only get addresses for
    its default address type. This was a pretty minor bug,
    where a few values that should have been dynamic was
    hard coded.
2019-07-16 12:36:38 +02:00
Torkel Rogstad
ae134f9742 Node cleanup (#591)
* Cleanup

In this commit we cleanup a few Scaladocs and change some
trait/impl pairs into just a case class.

* Node cleanup

In this commit we
1) Rename Client to P2PClient. Client is a very generic name.
2) Clean up some Scaladocs
3) Remove some unecessary objects/traits/classes and replace them
    with case classes
4) Add trace logging of bytes received in P2PClient
2019-07-13 09:26:00 -05:00
Torkel Rogstad
2c46b57b56 Add more type identifiers
In this commit we add type identifers for P2P
messages we hadn't previously implemented. Note
that these aren't used anywhere yet.
2019-07-12 11:04:15 +02:00
Torkel Rogstad
741478a7b2
Merge pull request #565 from piu130/master
Remove redundant function checkResult and refactor Numbers
2019-07-11 13:01:36 +02:00
Ramon Boss
7f67bcdcca format code 2019-07-10 13:52:55 +02:00
Ramon Boss
b7cc0aa751 add scala doc and remove deprecated methods 2019-07-10 13:50:00 +02:00
Ramon Boss
2bac31afe2 use of seperate trait Bounded 2019-07-10 08:40:12 +02:00
Ramon Boss
c3d62e1098 implement isInBound for numbers 2019-07-10 08:39:50 +02:00
Torkel Rogstad
9101aece9b Process outgoing transactions (#555)
* Split wallet functionality into multiple traits

In this commit we refactor LockedWallet into multiple traits
that provide functionality related to a subset of total wallet
functionality. This has the benefit of making it clear which
methods are helper methods that are only intended to be used
in a very specific setting, and which methods are part of the
internal wallet API that other parts of the wallet can use.

* Rework TransactionOutput and TransactionOutPoint to case classes

* Add extension methods for flattening lists of assertions

* Segregate confirmed and unconfirmed balance methods

* Add test for FutureUtil.sequentially

* Add trace logging of balance fetching

* Process outgoing TXOs

Move TX processing into separate trait, add internal API method

Unify DB representation of TXOs

    Prior to this commit we stored TXO information
    across diferent tables, with joins and tuples
    needed a bunch of places to keep track of
    everything we needed. In this commit we unify
    the tables, leaving us with only one table for
    TXOs.
2019-07-09 06:25:24 -05:00
cwaldron97
9c11c83d6c changed default rpcport from 18332 to 18443 2019-07-08 15:46:22 -05:00
Kai BrĂĽnnler
ec5280a0c7 remove duplicate duplicate check :) (#575) 2019-07-04 14:54:46 -05:00
rorp
854242b462 [WIP] New Eclair RPC client (#535)
* [WIP] New Eclair RPC client

* channel, close, connect, getinfo, open, peers

* allchannels, allnodes, allupdates

* audit, channels, findroutetonode, forceclose, updaterelayfee

* Initial version of createinvoice

* ShortChannelId: improved error handling and scaladoc

* addressed the PR comments

* parseinvoice, payinvoice, getsentinfo, getreceivedinfo, sendtonode, sendtoroute

* unit tests

* addressed the PR comments

* ws, usablebalances, channelstats, networkfees, getinvoice, listinvoices

* addressed PR comments

* change eclair URL

* cleanup

* addressed comments

* fidex compiler warnings

* Eclair 0.3.1

* scaladoc

* cleanup
2019-07-03 13:38:56 -05:00
Ramon Boss
bd12ca10b8 add comment about checking required range in apply 2019-07-03 11:55:15 +02:00
Ramon Boss
17aac6c111 remove redundant function checkResult 2019-07-03 11:48:47 +02:00
Chris Stewart
f7753fcaea
Add case for empty bloom filter (#561) 2019-07-02 10:39:22 -05:00
Torkel Rogstad
b56fbb9629
Merge pull request #534 from torkelrogstad/2019-06-17-wallet-transactions
Process incoming transactions
2019-07-02 11:19:57 +02:00
Ramon Boss
4267a982cc implement Ordered[T] instead of creating custom methods (#553)
* implement Ordered[T] instead of creating new methods for that

* remove new line

* implement Ordered in LnCurrencyUnit

* implement Ordered in MilliSatoshis

* implement Ordered in ScriptNumber
2019-06-27 09:02:34 -05:00
Torkel Rogstad
d00cfabb96 Rename HDCHain.toAddress 2019-06-27 15:28:08 +02:00
Torkel Rogstad
eb5ff1d9c2 DB loggers exposed in logging configuration 2019-06-27 15:28:08 +02:00
Torkel Rogstad
449e618007 Add toAddress on HDChain 2019-06-27 15:28:08 +02:00
Torkel Rogstad
d98592aeb8
Merge pull request #546 from torkelrogstad/2019-06-21-aes-cfb
Use key based encryption in AesCrypt
2019-06-27 12:16:53 +02:00
Torkel Rogstad
1defcc9ad6 Respond to code review from Chris 2019-06-26 17:24:50 +02:00
Torkel Rogstad
eab5975383
Merge pull request #431 from nkohen/coin-selection
Basic Coin Selection
2019-06-26 13:13:27 +02:00
Torkel Rogstad
ff0a7776bb Fix MatchError in TxBuilder 2019-06-26 11:47:36 +02:00
Torkel Rogstad
9ca607b401 Use explicit constructor for creating AesSalt
This fixes a stack overflow bug where calling
fromBytes called .apply(ByteVector) which called
fromBytes which etc...
2019-06-26 11:26:38 +02:00
Torkel Rogstad
9bd5e8cbd2
Merge pull request #547 from cwaldron97/2019-06-21_Siphashkey
SipHashKey
2019-06-25 18:59:31 +02:00
Torkel Rogstad
21f69158de Make AesSalt a factory object 2019-06-25 11:39:20 +02:00
Torkel Rogstad
01c5cad9c8 Add toBase64/fromBase64 to AesEncryptedData 2019-06-25 11:39:17 +02:00
Nadav Kohen
0b6f4074d6 Made GolombFilter extend NetworkElement (#549) 2019-06-24 14:43:04 -05:00
cwaldron97
39b1a44147 scalafmt 2019-06-24 14:12:47 -05:00
cwaldron97
cc9d331269 Changes applied from PR Review 2019-06-24 11:51:50 -05:00
Torkel Rogstad
e594ec416b Update wallet project to work new AES changes 2019-06-24 17:25:11 +02:00
Torkel Rogstad
163a47bd7b Update AesCrypt to work with keys
In this commit we update our AesCrypt
functionality to work with AES keys rather
than passphrases that are extended to keys.
This makes it easier to integrate with other
languages, as the key stretching introduces
a bunch of additional parameters to the
actual AES encryption.

We also include tests that verify that we're
able to encrypt/decrypt using Bitcoin-S,
Crypto-JS (JavaScript), pycrypto (Python)
and OpenSSL CLI.
2019-06-24 17:21:41 +02:00
cwaldron97
07dfdaef82 fixed all compiler errors and warning 2019-06-21 16:06:44 -05:00