Commit Graph

684 Commits

Author SHA1 Message Date
Chris Stewart
6cbbd8825d
2021 10 02 create contract info (#3713)
* WIP createcontractinfo

* Fix ordering issue

* Use existing contract descriptor serializer, begin fixing test case

* Get DLCRoutesSpec createcontrafctinfo passing again

* Finish implementing createcontractinfo

* Add doc

* Fix native image build by adding hard coded static private key for OracleAnnouncementV0TLV.dummy
2021-10-05 06:24:25 -05:00
Chris Stewart
466de3e46a
Update ConsoleCli endpoints, update docs (#3705)
* Update ConsoleCli endpoints, update docs

* Rename methods in DLCOracleApi from signAnnouncement -> createAttestation

* Fix dates on deprecation

* WIP, createattestation rpc not working for some reason

* Fix misspelling

* Rename endpoint from createattestation -> signenum

* Fix docs

* Fix use of deprecated method after rebase
2021-10-02 08:01:46 -05:00
Chris Stewart
3d725adc92
2021 09 29 delete announcement (#3701)
* Implement delete attestations

* Add DLCOracleApi.deleteAnnouncements()

* Make sure we don't have attestations before deleting announcements

* Add endpoint in OracleRoutes for delete announcement

* Add ConsoleCli implementation

* deleteattestations -> deleteattestation

* Document endpoints and add warnings

* Wire up ConsoleCli with deleteannouncement/deleteattestation

* Fix use of deprecated methods
2021-10-01 14:42:59 -05:00
Nadav Kohen
ba713bd98f
Fixed edge case of numeric range computation (#3707) 2021-10-01 13:10:05 -05:00
Chris Stewart
26d7f99173
2021 09 30 rename endpoints (#3703)
* Deprecate things with the Event suffix in DLCOracleApi

* Rename classes used in OracleRoutes

* Rename endpoints

* Update docs

* listevents -> listannouncements
2021-09-30 14:22:17 -05:00
rorp
698fe9e800
Add backupwallet and backuporacle endpoints (#3694)
* Add backupwallet and backuporacle endpoints

* respond to the PR comments
2021-09-28 07:46:33 -05:00
benthecarman
4f65022472
Fix signet parsing of LnInvoices (#3691) 2021-09-26 07:14:03 -05:00
Chris Stewart
48213d9b81
Implement MasterXPubDAO (#3451)
* Implement MasterXPubDAO

* Fix nits

* Add postgres migrations

* Make sure tables are getting cleaned on postgres

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

* Fix test case

* Fix more tests

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

* Get all walletTest passing

* Add unit test for wallet startup

* Fix rebase

* Get all sqlite tests passing

* Get postgres test cases passing locally

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

* Make KeyManagerAppConfig.externalEntropy private

* Fix MasterXpubDAO.existsOneXpub()

* Fix bug in migrating database for oralce project
2021-09-21 08:05:23 -05:00
benthecarman
85eb2d5eb4
Fix approximateUtxoSize calculation for p2wpkh (#3669) 2021-09-15 07:11:15 -05:00
benthecarman
f3da45c504
Add CurrencyUnits.fromLong (#3653) 2021-09-09 06:20:59 -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
515e85b1c5
Decode DLC messages cli commands (#3636)
* Decode DLC messages cli commands

* Move decoding to picklers, add contractInfo decoder

* Add decoding examples
2021-09-03 09:46:09 -05:00
benthecarman
ba21c24d6f
Give funding txid in DLC Signed state (#3640)
* Give funding txid in DLC Signed state

* Improve test
2021-09-02 08:17:20 -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
benthecarman
f2a2874177
Add new invalid BIP 32 test vectors (#3634)
* Add new invalid BIP 32 test vectors

* Make sure priv key isn't zero

* Add comments
2021-08-31 07:59:34 -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
benthecarman
479f8e249c
Remove unneeded CoreApi (#3599) 2021-08-24 14:17:04 -05:00
benthecarman
addb1254ee
Fix for if tor is already running (#3562) 2021-08-17 09:47:31 -05:00
Chris Stewart
e829d03249
Add better CETSignaturesV0TLV.toString so we don't accidentally DOS in the case of large amoutns of adaptor signatures (#3521) 2021-08-11 10:23:01 -05:00
rorp
3d4cf1fc91
Tor support for all sub-projects (#3506) 2021-08-10 08:07:12 -05:00
user411
e315fb0563
Move to GridPane wallet, dynamic sizing (#3492) 2021-08-05 17:42:04 -05:00
benthecarman
7cac44de4d
DLC P2P in AppServer and GUI (#3462) 2021-08-04 07:06:19 -05:00
rorp
ca40af5d94
Tor support for BTC RPC (#3470)
* Tor support for BTC RPC

* change config format
2021-08-03 11:07:05 -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
462ffc53e6
Give TLVs subtypes, add LnMessage utilities (#3437) 2021-07-21 15:50:51 -05:00
benthecarman
2597904019
Move DLCWalletApi to core module (#3438) 2021-07-21 15:25:18 -05:00
benthecarman
9aa9a424c2
Implement init message from BOLT 1 (#3407)
* Implement init message from BOLT 1

* fix compile
2021-07-19 12:39:44 -05:00
Shruthii RG
1c6d728197
Made relay flag in version message configurable (#3416)
* relay flag in version message made configurable

* modified test classes as well

* Update configuration.md

* reverted few files and cleaned up format

* fixed mistake
2021-07-19 09:59:43 -05:00
benthecarman
e098aba680
Create and implement OrderedAnnouncements type (#3356)
* Create and implement OrderedAnnouncements type

* Fix docs

* Update scaladoc
2021-07-06 07:58:58 -05:00
benthecarman
78e2fceb90
Use OrderedNonces type in DLC data types (#3352) 2021-06-30 06:35:02 -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
Chris Stewart
a9292fcad8
Add FutureUtil tests (#3126)
* Add FutureUtilTest for both FutureUtil.batchAndParallelExecute and FutureUtil.batchAndSyncExecute

* Make Vector same size as available processors as CI machines don't have as many processors as I have locally

* Try to fix test case

* Add processors to the log

* Replace java scheduler with a scalajs scheduler called monix

* Make asyncUtilsTest compatible with Scalajs, add them to the CI matrix

* Add more missing runs of asyncUtilsTestJS/test
2021-06-28 14:44:08 -05:00
benthecarman
d7b753a869
Add invariant and better error message for invalid numeric contract descriptor (#3338)
* Add invariant and better error message for invalid numeric contract descriptor

* Better error message

* Fix test name
2021-06-28 10:58:15 -05:00
benthecarman
639adf1181
Use PaymentHashTag type in LndRpcClient (#3333) 2021-06-28 08:26:25 -05:00
Nadav Kohen
5685371e11
Sorted and Ordered Vector Type Support (#3310)
* Implemented SortedVec class

* Added support for ordered vectors

* Made SortedVec an abstract class and introduced an OrderedNonces case class
2021-06-25 08:41:10 -05:00
benthecarman
05204e6235
Make it so table doesn't reorder on single update (#3321)
* Make it so table doesn't reorder on single update

* Default ordering by status

* Sort table on every update

* Secondary sort by evenId

* Sort by dlcId too

* Switch to contract Id

* Update instead of delete and replace

* move to function, use for updateDLCs
2021-06-23 18:14:43 -05:00
benthecarman
bd11c84462
Add ability to sweep wallet (#3274)
* Add ability to sweep wallet

* Respond to review

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

* Use fundRawTranaction() to make sure the utxo is reserved
2021-06-14 08:57:30 -05:00
benthecarman
a526ad14ee
Fix DLC Accounting errors (#3249) 2021-06-12 08:12:38 -05:00
Chris Stewart
9431be2f25
2021 06 07 dlc wallet pnl (#3229)
* WIP

* Add profit and loss and rate of return for entire wallet

* Fix rebase

* Address part 1 of code review from Ben

* Add unit test for wallet accounting
2021-06-08 15:05:40 -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
2269a052b1
Rework findDLC() (#3214)
* Rework findDLC(), break things out into separate objects to make things more testable and correct

* Address ben's code review

* Add caching of oracle outcomes we know are valid and broadcast
2021-06-01 14:54:00 -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
4b42b90784
Multi-threaded DLC CET signature verification (#3176) 2021-05-27 13:26:09 -05:00
benthecarman
3d728837ee
Add ability to enter contract info in offer dialogue (#3160) 2021-05-27 06:54:46 -05:00
benthecarman
be8e965367
DLC Wallet pulldown (#3138)
* DLC Wallet pulldown

* Respond to review
2021-05-25 17:31:01 -05:00
Nadav Kohen
eafaff9ee8
Made DLCTxSigner's async signing methods actually multi-threaded (#3122) 2021-05-21 18:36:09 -06:00
Nadav Kohen
87f353b08f
DLC Adaptor Point Computation Memoization (#3110)
* A first attempt

* Made memoization conditional on CryptoContext

* Added scaladocs

* Responded to review and added a unit test
2021-05-21 17:40:28 -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
Chris Stewart
7468cbec23
Optimize updateUtxoConfirmedStates() to fetch confirmations for blocks in parallel (#3094) 2021-05-16 17:10:58 -05:00
Chris Stewart
3205e4e275
Implement createCETsAndCETSigsAsync() to fix performance issue in test (#3089)
* Implement createCETsAndCETSigsAsync(), use this inside of TestDLCClient.setupDLCAccept()

* Switch to lazy val to cache sig point computation

* Add FutureUtil.batchAndParallelExecute() that does not take batchSize parameter, just compute it inside as a sane deafult

* Fix 2.12.x compiler error
2021-05-14 17:59:56 -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
benthecarman
2b8ac08cdc
Give oracle ability to sign messages with private key (#3070) 2021-05-12 10:09:34 -05:00
rorp
02c4505948
Initial Tor support (#3043)
* Initial Tor support

* cleanup
2021-05-07 06:43:39 -05:00
Nadav Kohen
6bc0943a62
Call decompression on public keys less (#2988)
* Removed type parameter from PublicKey

* Deduplicated call to public key decompression in isFullyValid

* Fixed FieldElement

* Added CurveCoordinate to replace FieldElement in places where it was being misused

* Added edge case tests
2021-05-07 02:05:10 -05:00
Nadav Kohen
78f4dfb8c6
Pubkey Refactor (#2936)
* Removed ExecutionContext from ECKey

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

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

* Made all ECKeys into case classes

* Successfully added isFullyValid invariant to ECPublicKey!

* Fixed docs

* Added scaladocs and fixed a RpcPsbtResult bug

* Reject private keys of length < 32 and fix WIF parsing bug
2021-05-06 13:19:52 -05:00
Nadav Kohen
63a6f9309d
Introduced AsyncAdaptorSign and AdaptorSign traits (#3037) 2021-05-05 09:34:03 -05:00
Nadav Kohen
aacba1c077
Pulled down core diff from adaptor-dlc (#3038) 2021-05-05 09:26:09 -05:00
Chris Stewart
a55a97ba6f
Optimize shift operations in Number (#3025)
* Optimize shift operations in Number

* Fix imports
2021-05-04 13:35:45 -05:00
benthecarman
f86f90dc32
Add getbalances cli command (#3022)
* Add getbalances cli command

* Add docs

* Locked -> reserved
2021-05-04 12:19:15 -05:00
benthecarman
6fbaf9f9ce Add estimate fee cli command (#2983) 2021-04-28 16:43:20 -05:00
Chris Stewart
279b93f9e0 Rework P2SHScriptSignature.isStandardNonP2SH() (#2963)
* Take ben's suggestion for parsing the entire tx hex

* Add assertion that the secondSPK is NOT a P2SHScriptPubKey, revert the classification of P2SHScriptPubKey in P2SHScriptSignature.isStandardNonP2SH()

* Revert conditionalSPK match logic

* Fixed ConditionalScriptPubKeyTest.scala (#32)

Co-authored-by: Nadav Kohen <nadavk25@gmail.com>
2021-04-26 12:46:50 -05:00
Chris Stewart
9ecea9f710 2021 04 24 bitcoin s scripts (#2961)
* Add new app/scripts project which is meant to store useful bitcoin-s scripts

* Add ScanBitcoind with an example of counting segwit txs between a range

* Fix bug of creating a new actor system everytime BitcoindRpcClient.apply(instance) is called

* Add BitcoindRpcClient.fromVersionNoSystem()

* Take ben's suggestions

* Fix compile

* Rework P2SHScriptSignature.isStandardNonP2SH() to account for nesting p2sh script inside of it

* fix compile on java8

* Enable app packaging in scripts project
2021-04-25 14:03:22 -05:00
Chris Stewart
0aa32916ab Implement workaround for spendinginfodb by rescanning to find missing spendingTxId (#2918)
* implement workaround for rescanning to find missing spendingTxId

* Add links to PR

* Fix compile bug
2021-04-20 06:41:11 -05:00
Chris Stewart
238c083aad 2021 04 18 wallet received txo state (#2914)
* Add invariant to spendingInfoDb to that requires if the spendinginfodb is in a TxoState.spentStates, the SpendingInfoDb.spendingTxIdOpt is defined

* Remove unused SpendingInfoDAO.updateTxoState()

* Tighten up TxoState -> ReceivedState types we are using in the wallet. The ensures we are talking specific class of states (receiving a txo) rather than accounting for the case of spending and receiving since there is different information required for the spending states

* Add TxoState.ImmatureCoinbase to ReceivedStates
2021-04-18 16:56:08 -05:00
Chris Stewart
a3954dbcae 2021 04 17 spendinfodb invariant (#2912)
* Add invariant to spendingInfoDb to that requires if the spendinginfodb is in a TxoState.spentStates, the SpendingInfoDb.spendingTxIdOpt is defined

* Remove unused SpendingInfoDAO.updateTxoState()

* Remove comment

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

* Fix github actions config

* Fix RoutesSpec test
2021-04-18 09:02:49 -05:00
benthecarman
8b8d5dcc0e Fix conversion from sats/vb to sats/kw (#2895)
* Fix conversion from sats/vbytes to sats/kw

* Add another test
2021-04-12 19:50:18 -05:00
Chris Stewart
85fb931cba Implement BIP32Path.fromHardenedString(). (#2886)
* Implement BIP32Path.fromHardenedString(). This will throw exceptions a non hardened path in the string exists

* Do what ben says rather than re-implementing BIP32Path.fromString
2021-04-09 13:19:11 -05:00
benthecarman
68a82deac3 Initial DLC Templates (#2847)
* Initial DLC Templates

* Respond to review

* Split up into ContractDescriptorTemplate

* Use match, add invariants
2021-04-07 10:28:44 -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
benthecarman
3dbeac276e Add ability to delete Oracle signatures (#2851)
* Add ability to delete Oracle signatures

* Respond to review
2021-04-02 13:55:47 -05:00
benthecarman
fa80f36d2f Get all of Core working with JS (#2826)
* core-test-js-json

* Add SigPointComputer cross compile
Co-authored-by: Nadav Kohen <nadavk25@gmail.com>

* Fix java.time for scalajs

* InetAddress for scalajs

* Fix linking errors in coreTestJS

* Easy fixes

* InetAddress Tests

* Update micropickle, fix exact functions

* Get BigSizeUIntTest working with upickle

* Fix exact funcs

* Update Base58Test with upickle

* Update ScriptSignatureTest with upickle

* Update TransactionTest with upickle

* Update BlockFilterTest with upickle

* Update ScriptInterpreterTest with upickle

* Update MnemonicCodeTest with upickle

* Add InetAddress unit tests

* Fix compile errors

* Get core tests running, not passing

* Sign with js

* Fix PSBTUnitTest

* Fix PBKDF2 for JS

* Use bcrypto's secp256k1 instead of ecdsa

* Fix 2.12.12 compile

* Core tests passing :)

* Test corejs
2021-03-31 15:04:30 -05:00
benthecarman
8cd481650d Fix potential unordered nonces in announcement (#2831) 2021-03-28 11:44:47 -05:00
Nadav Kohen
e6899b20b1 Made ECPrivateKey signing synchronous and got src compiling (#2652)
Fixed tests

De-futured tx buidling, finalizing and signing

Responded to review
2021-03-23 17:05:58 -05:00
benthecarman
7aa3ccd974 Attempt to find type name when parsing incorrect tlv type (#2820) 2021-03-23 13:21:43 -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
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
benthecarman
b0f7d6f26b Implement bech32m (#2572)
* Implement bech32m

* Respond to review
2021-03-18 18:04:38 -05:00
benthecarman
12bff309c2 Add Broadcast TxoState (#2735)
* Add broadcast TxoState

* Update scaladoc
2021-03-18 14:16: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
65cb0d1615 Move tests out of bitcoindRpcTest that belong in async-utils (#2796)
* Move tests out of bitcoindRpcTest that belong in async-utils

* Make AsyncUtilApi
2021-03-16 07:48:06 -05:00
benthecarman
4bf4f0a027 Add signed outcome to getevent rpc, fix other small api bugs (#2757)
* Add signed outcome to get event rpc, fix other small api bugs

* Create separate type for decomp DLCAttestationType

* Add DLCOutcomeType to Oracle Event

* Calculate dlcOutcome, add invariant

* Fix test
2021-03-08 10:55:47 -06:00
benthecarman
8b6c0652a2 Completely remove range event descriptors (#2764) 2021-03-04 15:18:33 -06:00
Chris Stewart
e59057483f Resturcutre cryptoTest & coreTest to work with scalajs build (#2731)
* Get cryptoTest,coreTest projects working with scala-js

Get build working, now moving onto compile

Move jvm specific cryptoTest's into the .jvm sub project

Rework build definition names to be more concise

Fix missing cryptoTest refactor

Move logback-test.xml into jvm specific resource folder so it doesn't get ignored

Make coreTest a crossProject

Rework ci matrix to work with new project structure

Try to fix CI matrix

CI fix part 2

* Apply commonSettings to all cross projects

* Address part of roman's code review, make coreJS, make cryptoTest.dependOn(crypto)

* WIP to share with scala-js community

* Fix scalac compiler settings to be additive in CommonSettings.settings

* Remove BCryptoTest
2021-03-03 16:52:03 -06:00
Chris Stewart
5ba7b553b0 2021 02 27 dersignatureutil mv (#2730)
* Move CryptoParams to shared crypto project, make BouncyCastleCryptoParams for bouncy castle specific things

* Rework build structure to work better with scalajs

* Add unit test to make sure CryptoParams & BouncyCastleCryptoParams are consistent
2021-02-28 07:09:22 -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
bf4afd63d1 Begin re-introducing parallelism in the wallet to make everything faster (#2705) 2021-02-24 07:10:46 -06:00
benthecarman
86566c575d Simplify oracle server RPC api (#2656) 2021-02-23 13:17:20 -06:00
Chris Stewart
f322a74ab0 2021 02 21 cheap redeemscript check (#2707)
* Add more cheap checks to see if a given script token is a redeemScript

* Make cheap witness version check before deserializing to a bytevector
2021-02-23 10:37:40 -06:00
Chris Stewart
63e44974f7 2021 02 20 number byte representation (#2703)
* Optimize unsigned numbers to use byte representation rather than hex representation

* Do the same thing with Int32/Int64

* Cleanup
2021-02-20 13:51:34 -06:00
benthecarman
b30fdf88ca Fix normalized string comparison (#2695)
* Fix normalized string comparison

* Add test
2021-02-19 12:09:55 -06:00
Nadav Kohen
bcd2df6051 Compute sigPoints eagerly but asynchronously (#2642)
* OracleOutcome sigPoints are now eagerly but asynchronously computed

* Increased the timeout for sigpoint computation just to be paranoid
2021-02-15 09:28:22 -06:00
Aris
85087b0f70 Refactoring chain (#2662) 2021-02-13 14:10:40 -06:00
benthecarman
e68ffb49da Use specific functions for Oracle Signing version (#2659) 2021-02-12 13:31:37 -06:00
saguywalker
d1cc5e0ade Refactor HDCoinType to be ADT (#2657) 2021-02-12 09:53:43 -06:00
Aris
f8694eb097 Fix/typos (#2633)
* Fix typos

* Collection minor fixes

Removes redundant .headOption on options
Replaces .exists(_ == ???) with .contains(???)
Replaces option == None with option.isEmpty
2021-02-07 15:00:25 -06:00
Chris Stewart
097fa24e58 Create ScriptFactory.isValidAsm() to standardize how check validity o… (#2629)
* Create ScriptFactory.isValidAsm() to standardize how check validity of a script

* Fix compile

* Fix docs
2021-02-06 08:43:17 -06:00
Chris Stewart
ea75d62571 Add number cache trait, use it in all number types (u8,u32,etc) and S… (#2627) 2021-02-05 17:59:48 -06:00
Chris Stewart
bbd1dbc15d Do cheap checks in predicates first before more expensive ones (#2628) 2021-02-05 17:59:19 -06:00
Nadav Kohen
0d38721b3d Added utilities to created linear approximations of Long => Long functions (#2537) 2021-02-05 13:24:33 -06:00
Nadav Kohen
e417ac94a4 Re-wrote CETCalculator.splitIntoRanges (#2621)
Added some docs

Responded to review
2021-02-05 13:24:24 -06:00
Chris Stewart
8f958bf5d9 Update scalafmt (#2619) 2021-02-03 16:37:12 -06:00
Chris Stewart
16cb38e876 Make contract info lazy so native image works (#2606) 2021-02-02 08:43:21 -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
546a8c55b3 Add better Block.toString that doesn't blow up logs (#2585)
* Add better Block.toString that doesn't blow up logs

* Use .toLong as ben suggested
2021-01-29 10:23:18 -06:00
benthecarman
fa27fb3fb1 Create BlockSyncState type (#2567) 2021-01-27 14:15:07 -06:00
benthecarman
33245b500e Bech32 address improvements (#2571)
* Bech32 address improvements

* Respond to review
2021-01-27 13:22:17 -06:00
benthecarman
e10e278aa4 Add walletinfo rpc (#2546)
* Add walletinfo rpc

* Move rootXpub to key manager obj

* Make configuration keys for getinfo the same as the ones in our configuration files

* Cleanup

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-01-22 13:55:21 -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
benthecarman
2291bf0eae Create isChange function for wallet (#2535)
* Create isChange function for wallet

* Scaladocs
2021-01-20 12:11:24 -06:00
Chris Stewart
1ec3092b2f 2021 01 15 dlc refactors (#2518)
* Kill DigitDecomp.isSigned

* Create TLVEndpoint, TLVMidpoint ADT. Also add helper method OutcomePayoutPoint.toTlvPoint
2021-01-16 07:55:42 -06:00
Chris Stewart
2048cc0bbb Make ChainApi.processHeaders() return a failed future in the case we … (#2436)
* Rename NodeUnitTest.confg -> NodeUnitTest.getFreshConfig()

* Rename CachedBitcoinSAppConfig.config -> CachedBitcoinSAppConfig.cachedConfig

* Make CachedChainAppConfig extend CachedBitcoinSAppConfig

* Make ChainApi.processHeaders() return a failed future in the case we have no valid headers

* Run scalafmt

* Fix test case to check if promise is completed yet

* WIP: Get something working that isn't network specific

Start putting things back in place

Add comment

Revert logback file

Remove BitcoinSLogger object

* Fix unused import

* Get rid of annoying diff

* Fix spacing nit
2021-01-12 06:11:19 -06:00
benthecarman
84cde975d8 Add createmultisig cli command (#2495) 2021-01-09 09:54:34 -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
72ee201c1f Make allFactories lazy so we don't hit NPE exceptions (#2491) 2021-01-08 14:35:55 -06:00
Chris Stewart
b4a1d31f5c Add explicit signing version associated with a EventDescriptor (#2487) 2021-01-07 11:31:00 -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
Nadav Kohen
680ed4b58a Modified rounding on DLCPayoutCurve interpolation to match spec (#2470) 2021-01-07 06:42:01 -06:00
benthecarman
be06fb13ab Update DLC Oracle Signing Algo (#2465) 2021-01-05 08:19:53 -06:00
benthecarman
b436f6cd2f Version Number in logs & Cli Command (#2467) 2021-01-05 07:27:40 -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
Nadav Kohen
20af4a3cda OutcomePayoutPoint now has the correct types and deffers rounding due to extra_precision in serialized points (#2441) 2020-12-29 13:55:39 -06:00
Nadav Kohen
493673c68b Outstanding DLC branch diff (#2432) 2020-12-23 18:13:57 -06:00
Ben Carman
f10bdce179 Add getblockheader cli command (#2424) 2020-12-23 07:15:35 -06:00
Nadav Kohen
d6f27f5bbe Made TLV serialization and deserialization uniform under a succinct and expressive API (#2420) 2020-12-23 02:42:30 -06:00
Nadav Kohen
1e394737c6 Added length prefixes to contract_info and cet_signatures TLVs (#2419) 2020-12-22 14:13:55 -06:00
Ben Carman
8996be43ec Add extra checks for RBF transactions (#2416)
* Add extra checks for RBF transactions

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

* Add bump fee integration tests
2020-12-21 07:04:01 -06:00
Ben Carman
fcfc3d076f Add wallet function to bump fee with RBF (#2392)
* Add wallet function to bump fee

* Bump sequence number

* Respond to review

* Fix test
2020-12-20 07:43:18 -06:00
Ben Carman
2c25057fd6 Add get transaction cli command (#2370)
* Add get transaction cli command

* Fix return, add to docs
2020-12-18 07:18:13 -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
3a7cded566 Require CJDNS starts with 0xFC (#2356) 2020-12-15 14:18:52 -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
Ben Carman
48579851d7 Add latest ProtocolVersion (#2332) 2020-12-08 08:13:42 -06:00
Ben Carman
9291d6ec3a Fix P2PClient parsing unknown messages (#2315)
* Fix P2PClient parsing unknown messages

* Use Vector, calculate correct checksum
2020-12-06 13:49:30 -06:00
Ben Carman
8cdddfecde Implement BIP 155 addrv2 messages (#2321)
* Implement BIP 155 addrv2 messages

* Add unit tests
2020-12-06 08:07:57 -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
Ben Carman
87e29a9ca9 Add function to validate OracleAnnouncementV0TLV's signature (#2308) 2020-12-02 06:59:44 -06:00
Chris Stewart
ccef8b46d4 trivial: Add a sha256 hash field on all TLV (#2300) 2020-11-30 12:47:10 -06:00
Chris Stewart
f586e25699 Get Scala 2.13.4 compiling (#2294)
* Get Scala 2.13.4 compiling

* Fix broken test case, in general use if() else() statements for Vectors rather than pattern match as I am unsure of how to correctly pattern match on Vector0,Vector1,...,Vector6()

* Bump CI to 2.13.4

* OVerride CurrencyUnit.equals() so that it works on Scala 2.13.4, not sure why there was a regression here between Scala versions 2.13.4/2.13.3

* Add explicit unit tests making sure bitcoin/satoshi currency units are equivalent
2020-11-28 07:36:07 -06:00
Chris Stewart
ad09d1a3df Move english word list to be represented by a Vector in memory (#2287)
* Move english word list to be represented by a Vector in memory

* rename to EnglishWordsBip39
2020-11-23 10:27:22 -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
Chris Stewart
a8b1945408 Add helper OracleEventTLVV0.maturation method (#2267) 2020-11-17 06:18:32 -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
c167bc04a0 Analyze PSBT function (#2240)
* Analyze PSBT function

* Add to tests

* Add docs

* Add more functions

* Fix compile issues

* Fix compile issue
2020-11-09 15:15:32 -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
Ben Carman
c8a0a0931a Decode PSBT function (#2237)
* Decode PSBT function

* Add test
2020-11-06 06:56:46 -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
Nadav Kohen
3cf6d3cb0a Fixed P2SH(Segwit) bug and brought down DLC-used PSBT functionality (#2140)
* Fixed P2SH(Segwit) bug and allowed redeem scripts when calling addFinalizedScriptWitnessToInput

* Add test

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-10-24 18:06:46 -05:00
Ben Carman
6b6167bdf0 Only Validate PSBT BIP143 vulnerability on signing (#2204) 2020-10-22 13:05:58 -05:00
Ben Carman
7dd7e2574d Pretty Fee Rate toStrings (#2210) 2020-10-22 07:38:24 -05:00
Ben Carman
c104bf11fb Make tx bytes functions lazy vals (#2180) 2020-10-14 14:18:24 -05:00
Ben Carman
913f705167 Add address descriptors (#2176) 2020-10-13 06:14:11 -05:00
Nadav Kohen
6c73ecf433 P2SHTxSigComponent constructor now detects witness data (#2169) 2020-10-09 22:34:50 -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
Ben Carman
e75b4ff4c9 Optimize GetHeadersMessage.fromBytes (#2131) 2020-10-06 06:35:29 -05:00
Chris Stewart
9b09b04230 Upgrade to scalac 2.13.3 (#2115) 2020-10-04 07:42:44 -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
09dfd5eb73 Add BIP45 Multisig Purpose (#2103)
* Add BIP45 Multisig Purpose

* Fix multisig purpose, add tests
2020-10-02 10:43:25 -05:00
Ben Carman
9817f84fef Allow any HDCoinType (#2097) 2020-10-02 10:42:59 -05:00
Ben Carman
88f6759f5d Make bitcoind extend chain api (#2087) 2020-10-02 06:19:56 -05:00
Ben Carman
ed5228310b Use SubtractFeeFromOutputsFinalizer when sending full utxos (#2072) 2020-10-01 17:32:24 -05:00
Ben Carman
e505da3651 Calculate HRP from network param instead of the inverse (#2079)
* Calculate HRP from network param instead of the inverse

* make hrp lazy

* Fix imports
2020-09-29 17:00:46 -05:00
Ben Carman
2a8a0ffe40 Create ExtPrivateKeyHardened (#2073) 2020-09-29 06:35:41 -05:00
Ben Carman
a694ef16b7 Add ability to fully spend utxos (#2063)
* Let RawTxSigner dummy sign transactions

* Add ability to fully spend utxos

* Fix NeutrinoNodeWithWalletTest

* Fix test, simplify call
2020-09-27 08:16:26 -05:00
Ben Carman
11e6b7d9eb Initial SigNet support (#2057) 2020-09-25 12:29:13 -05:00
Ben Carman
f874eb5848 Put fee in funding error message (#2050) 2020-09-23 12:17:23 -05:00
Ben Carman
795d62c041 Change requesting filters log to use big endian hashes (#2048) 2020-09-23 12:02:34 -05:00
Nadav Kohen
be7bd70805 Fixed PSBT.verifyFinalizedInput (#2040)
* Fixed PSBT.verifyFinalizedInput to allow NonWitnessUTXO to be set with a WitnessUTXO

* Added unit test

* Fixed bug where verifyFinalizedInput was also broken for P2SH(Segwit)
2020-09-21 17:01:27 -05:00
Ben Carman
21b269cf63 Have RawTxSigner use low R signing (#1722) 2020-09-21 11:30:15 -05:00
Ben Carman
3ec3b5d699 Merge pull request #2029
* Add more processing blocks tests

* Add immature coinbase txo state

* Test balance, add doc
2020-09-20 10:39:31 -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
334b4d0965 2020 09 18 btchrp stringfactory (#2031)
* Implement StringFactory on the companion object for BtcHumanReadablePart

* Make Bech32.checkHrpvalidity() take in a string rather than a Bech32HumanReadablePart as a parameter, now we check validity _just_ according to the bech32 standard, not specific applications light lightning / bitcoin

* Add missing override

* Overload Bech32.checkHrpValidity() to pass in a 'StringFactory' in cases where you know what HRP you expect

* Do nadav's suggestion on Bech32.splitToHrpAndData() -- allow a factory to be passed in parameterized with the type you expect
2020-09-18 13:45:32 -05:00
Chris Stewart
857b33f31f Make ChainApi.getHeadersBetween() be inclusive on the 'from' parameter (#2009)
* Make ChainApi.getHeadersBetween() be inclusive on the 'from' parameter

* Use ben's suggestion of comparing hashes
2020-09-12 11:13:03 -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
4f02ee15db Make BlockHeader, BlockHeaderDb have better toStrings (#2007)
* Make BlockHeader, BlockHeaderDb have better toStrings

* Address ben's code review
2020-09-11 13:46:26 -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
Ben Carman
e2163c99ff Create FeeUnitFactory and functions to calculate tx fee rates (#1990)
* Create FeeUnitFactory and functions to calculate tx fee rates

* Remove useless override, use factory

* doc

* Scaladocs + use vals

* Fix scaleFactor being set as default value
2020-09-10 06:45:25 -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
Ben Carman
279d64fafb Add chainHash to ChainParams (#1972)
* Add chainHash to ChainParams

* Rename to genesisHash
2020-09-04 12:15:06 -05:00
Chris Stewart
98236835a5 Rename ChainApi.nextHeaderBatchRange -> ChainApi.nextBlockHeaderBatchrnage (#1957) 2020-09-02 13:19:20 -05:00
Ben Carman
1670902e75 Fix max by for getBlockCount (#1951)
* Fix max by for getBlockCount

* Add helper func to package
2020-09-01 19:38:15 -05:00
Chris Stewart
e7993890cb Make sure both filter ehaders and filters are empty before sending fi… (#1936)
* Make sure both filter ehaders and filters are empty before sending first filterheader sync message

* Address nit
2020-08-31 06:32:01 -05:00
Ben Carman
8d47b68764 Fix rescans that are larger than the batch size (#1916)
* Fix rescans that are larger than the batch size

* Add test
2020-08-27 14:09:25 -05:00
Chris Stewart
13fbb3f889 Improve logging in DataMessageHandler (#1922)
* Improve logging in DataMessageHandler

* Make hashes in logs big endian

* One more big endian conversion i forgot
2020-08-27 12:39:45 -05:00
Chris Stewart
955978f635 Apply string factory to a bunch of easy things (#1891)
* Apply string factory to a bunch of easy things

* Refactor HDPath, ExtKey, and LnTagPrefix to use StringFactory

* Implemen StringFactory on LnHumanReadablePart, ScriptType, ServiceIdentifier

* Implement StringFactory on AesCrypt, NodeUri, AddressTag, PSBT, TxoState

* Fix failing tests, fix website compile

* Apply StringFactory to all ScriptOperations, ChannelState, Script Parsing
2020-08-25 10:48:37 -05:00
Ben Carman
a678230123 Add new hash preimage PSBTInput types (#1893) 2020-08-25 10:23:21 -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
Ben Carman
304896e171 Move WalletApi to Core (#1890) 2020-08-25 07:05:20 -05:00
Ben Carman
98164bc5e3 Move WalletApi necessities to core (#1886) 2020-08-24 17:26:58 -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
Ben Carman
c6ad90139a Move TransactionDb to Core (#1849)
* Move TransactionDb to Core

* Move to api package
2020-08-22 08:04:30 -05:00
Ben Carman
9e06b826e1 Move AddressTagDb to Core (#1850)
* Move AddressTagDb to Core

* Move to wallet api package
2020-08-21 16:31:30 -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
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
Chris Stewart
380adb5cdb Batch and execute headers for chain work calculation test case, this … (#1837) 2020-08-15 14:05:01 -05:00
Chris Stewart
c9f78a2a40 2020 08 14 issue 1829 (#1833)
* Fix O(n^2) behavior in BaseBlockchain.connectWalkBackwards, cache BlockHeader.hash after the first time it is called

* Revert a few files
2020-08-15 07:31:50 -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
Ben Carman
62e9e08cf6 Address Tagging/Labeling Support from CLI (#1790)
* Address Tagging/Labeling Support from CLI

* Scaladoc
2020-08-12 10:55:15 -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
Ben Carman
4932315cbc Send correct version message on node start up (#1793) 2020-08-11 09:11:04 -05:00
Chris Stewart
620fa7f3c9 Add synchronous version of StartStop (#1771)
* Add synchronous version of StartStop

* Use ben's suggestion of StartStopAsync extending StartStop
2020-08-06 18:24:12 -05:00
Ben Carman
b523a813d1 Allow NonWitness and Witness UTXOs in same InputPSBTMap (#1761) 2020-08-06 17:58:43 -05:00
Ben Carman
ce2601002e Have wallet shuffle inputs and outputs (#1721) 2020-08-05 16:03:27 -05:00
Ben Carman
0978256818 Have AppConfig use BitcoinNetwork.fromString (#1748) 2020-08-04 07:51:56 -05:00
Chris Stewart
d39613e9b0 2020 07 25 optimize recalc chainwork (#1697)
* Optimize recalc Chainwork

* Typo and warning fixes

* Rename force recalc cli option

* Always update gensis header

* Add config option

* Fix config option

* Add to example config

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-07-31 10:43:04 -05:00
Nadav Kohen
ce3667857d Improved block parsing time by approx. 33% (#1728) 2020-07-31 06:13:27 -05:00
Nadav Kohen
666d53d94a Add low R signing (#1342)
* Added signing with entropy to the JNI and implemented low R signing

* Added check for determinism of low R signing

* Cleaned up test

* Implemented signing with entropy in Bouncy Castle

* Added docs for signing with entropy

* Fixed things after rebase

* De-parallelized signLowR and added scaladoc warnings to signWithEntropy
2020-07-29 15:03:18 -05:00
Ben Carman
6e76600e3f Shuffle Finalizer Tests + bug fix (#1680) 2020-07-23 11:14:53 -05:00
Ben Carman
4935b513c7 Create ShuffleFinalizer (#1660) 2020-07-16 16:09:26 -05:00
Ben Carman
af67b9ada3 Create BIP 69 finalizer (#1661) 2020-07-16 11:37:43 -05:00
Ben Carman
f26909b356 Fix CoinSelector for KiloX fee rates (#1664) 2020-07-16 10:18:22 -05:00
Nadav Kohen
8a8817f8c8 Segwit Signing Bug Fix (#1670)
* Various signing improvements and a fix for badly rebuilt segwit scripts when signing

* Responded to review
2020-07-14 16:15:12 -05:00
Ben Carman
80f8abe852 Implemenet BitGo fee provider (#1662)
* Implemenet BitGo fee provider

* Add API docs link
2020-07-14 07:18:20 -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
rorp
43b6349758 Eclair RPC 0.4.1 (#1627)
* Eclair RPC 0.4.1

* channelstats

* remove the launch script editing code

* getinfo

* sendonchain, onchainbalance, onchaintransactions

* cleanup

* repond to the comments
2020-07-07 13:22:44 -07:00
Ben Carman
194370622d Move BIP 143 invariant for PSBTs to allow signed transactions (#1631)
* Move BIP143 invariant for PSBTs to allow signed transactions

* Fix RoutesSpec test

* Fix test
2020-07-07 14:36:03 -05:00
Ben Carman
16dd256716 Override correct equals functions (#1621)
* Override correct equals functions

* Remove no longer needed function
2020-07-06 06:37:19 -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
11af7f4498 scalafmt On Compile (#940)
* scalafmt On Compile

* Disable scalafmtOnCompile for all CI runs

* Make CI use travis default CI var
2020-06-23 14:34:18 -05:00
Nadav Kohen
26d2e81d15 Made P2SHScriptSignature.isP2SHScriptSig less forgiving (#1594)
* Made P2SHScriptSignature.isP2SHScriptSig less forgiving

* Allow P2SHScriptSig(UnassignedWitnessSPK) and P2SHScriptSig(NestingSPK(EmptyScriptPubKey))
2020-06-23 06:26:11 -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
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
Nadav Kohen
914c905bd7 Lots of misc. improvements from dlc branch (#1583) 2020-06-17 14:34:01 -05:00
Nadav Kohen
9c5d7645cf Added DLC json data structures (#1575) 2020-06-16 15:21:33 -05:00
Nadav Kohen
e5bd6e53a3 Added compile scope scalafmtCheck to travis runs (#1563) 2020-06-16 15:16:43 -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
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
Ben Carman
1731bd3163 Callback rework (#1542) 2020-06-15 17:30:08 -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
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
1656b9091f Implement BitcoindRpcClient as a FeeProvider (#1486)
* Implement BitcoindRpcClient as a FeeProvider

* Make FeeRateApi a trait
2020-05-30 09:03:08 -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