Commit Graph

7 Commits

Author SHA1 Message Date
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
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
14f2ae793a Implemented (lax) signature parsing in Bitcoin-S (#1446)
* Implemented parseDERLax signature parsing and bumped bouncy castle version to most recent

* implemented using iterators

* Factored out common functionality and added comments, it is readable now! Deleted C-like version in place of this one after property based tests showed them to be equivalent

* Made compatible with scala 2.12

* Make compatible with scala 2.11

* Added tests for lax DER signatures
2020-05-21 15:13: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
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
Nadav Kohen
a503441619 Crypto Project Refactor (#1380)
* Added crypto project and decoupled BitcoinSLogger from NetworkElement

Decoupled BitcoinSLogger from Factory

Moved NetworkElement into crypto project

Moved Factory and BitcoinSUtil (renamed to BytesUtil) to crypto project

Moved MaskedToString to crypto project

Added BytesUtil to imports and cleaned up CryptoUtil.recoverPoint

Moved the rest of crypto stuff to the crypto project

Moved crypto tests to crypto-test project

* Added documentation for crypto project
2020-04-30 12:34:53 -05:00