Commit Graph

270 Commits

Author SHA1 Message Date
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
Chris Stewart
87c2459c9f Cache numbers between 0 and 256 to make serialization/deserialization faster (#1482) 2020-05-29 05:00:15 -05:00
Nadav Kohen
bc5953b6c8 Rework Standard Finalizer (into pieces) (#1473)
* Made the standard non-interactive tx finalizer simple using composition of its (reusable) pieces

* Responded to code review and made minor improvements

* Fixed docs
2020-05-27 18:05:37 -05:00
Chris Stewart
b036aa3338 Add more optimizations, MultSignatureScriptPubKey.isMultiSignatureScr… (#1475)
* Add more optimizations, MultSignatureScriptPubKey.isMultiSignatureScriptPubKey() fails fast if it's not a valid multisig spk, also use more caching inside of Number's (UInt64, UInt32, etc)

* Fix shortChannelidTest

* Cache popular UInt64 numbers that are used in ScriptPubKey's. This reduces allocations which reduces memory usage
2020-05-27 15:47:20 -05:00
Nadav Kohen
4f2c8f73f1 CryptoContext Refactor (#1469)
* Moved logic to disable use of secp256k1 library into crypto project

* Fixed secp doc
2020-05-26 13:05:21 -05:00
Nadav Kohen
99459745db Fixed sequence computation for P2PKWithTimeout and RawTxFinalizer composition discovered during DLC rebase (#1461) 2020-05-26 07:54:54 -05:00
Ben Carman
f2d98514b7 Implement FeeUnit SatoshisPerKW (#1455) 2020-05-26 06:11:49 -05:00
Ben Carman
192cd49974 Fix fee rate calculation bugs, add tests (#1454)
* Fix fee rate calculation bugs, add tests

* Rounding issues

* Add link

* Change error message
2020-05-25 08:06:37 -05:00
Chris Stewart
40160d9c5f Attempt to optimize block tests more to avoid timeouts (#1459)
* Attempt to optimize block tests more to avoid timeouts

* Fix asm.tail bug

* Make parseRedeemScript just return a ScriptPubKey rather than a Try[ScriptPubKey]

* Make encoding a UInt64 to hex more efficient

* Cache Transaction.bytesSize so we don't need to serialize everything again to estimate the byteSize

* Refactor CryptoBytesUtil.addPadding() and it's usage in UInt64

* Use StringBuilder.append() rather than StringBuilder.addAll() which is not supported in scala 2.11 & 2.12

* Address nadav's code review
2020-05-22 11:15:17 -05:00
Nadav Kohen
dfd3353cc4 TxBuilder Refactor (#1426)
* Refactored Transaction

Created RawTxBuilder

Created RawTxFinalizer as layer on top of RawTxBuilder

Introduced RawTxSigner and replaced TxBuilder!

Deleted TxBuilder!

* fixed things after rebase

* Made RawTxBuilder compatible with older versions of scala

* Began responding to review

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

* Added composition for finalizers

* Ran scalafmt

* Updated txbuilder example documentation

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

* Added scaladocs
2020-05-21 09:47:08 -05:00
Ben Carman
11255390d2 Small optimization for ScriptOperationFactory.operations (#1450)
* Small optimization for ScriptOperationFactory.operations

* Make operations a val
2020-05-20 10:26:00 -05:00
Ben Carman
4942315c9f Fix allowing BytesToPushOntoStack(0) (#1448) 2020-05-19 16:52:58 -05:00
Chris Stewart
bc600c230e 2020 05 17 optimizations (#1435)
* Make ScriptOperationFactory subclasses use a val to cache operaetions rather than operations

* Make ScriptOperation's use a Vector rather than Seq. Seq is a trait that can sometimes be backed by a List which can have some O(n) behavior

* Remove BlockTest benchamarking test case

* Put popular opcodes at beginning of ScriptOperations.operations for an optimization

* Remove Try() allocation on ECPublicKey.isFullyValid()

* Fix how CompactSizeUInt was serialized to be more efficient, move isMultiSig() and isLocktimeSPK() to be inline so we don't evaluate it unless we absolutely need to

* Use Map inside of ScriptOperation.fromByte()

* Update map to look up script operation rather than iterating
2020-05-18 20:23:12 -05:00
Chris Stewart
0ac3328d4b Remove the clause in Transction.fromHex() where we throw in the case … (#1431)
* Remove the clause in Transction.fromHex() where we throw in the case of a witness transaction, do something smarter and look at bytes in the byte vector

* WIP add test case

* Add back try/catch as it's still necessary for cases of unsigned base transactions

* Add permalink to example test case
2020-05-18 14:28:00 -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