Commit Graph

732 Commits

Author SHA1 Message Date
Chris Stewart
1602852419
2023 09 29 waitingdisconnection nodestate (#5251)
* Move waitingForDisconnection into NodeState

* Remove PeerManager.waitingForDisconnection

* Remove mutable _waitingForDisconnection

* Fix compile
2023-10-03 15:35:46 -05:00
Chris Stewart
4972d0a368
Move NodeState to core (#5249) 2023-09-29 12:06:24 -05:00
Chris Stewart
3e6ff52194
2023 09 27 issue 5139 (#5247)
* Add test case for reorg on bitcoin network for NeutrinoNodeTest

* Get unit tests passing

* Refactor findNextHeader() to not take an Option[BlockHeaderDb], not it just takes BlockHeaderDb

* Explicity return None in the case where we don't need sync filter headers

* Fix off by one bug when starting filter header sync
2023-09-29 07:35:26 -05:00
Chris Stewart
9b85838823
Implement logic to restart PeerManager in inactivity checks when we have 0 peers (#5171)
* Implement logic to restart PeerManager in inactivity checks when we have 0 peers

* Revert logback-test.xml

* cleanup
2023-08-01 10:07:40 -05:00
Chris Stewart
99ca1b7abf
Add PeerManagerApi.peers (#5170) 2023-07-28 10:51:10 -05:00
Chris Stewart
ef2c96cc99
Add PeerManagerApi (#5164) 2023-07-25 14:34:32 -05:00
Chris Stewart
b1e6488bb7
Move Socks5ProxyParams, Credentials into core (#5138) 2023-07-08 13:57:44 -05:00
Chris Stewart
08a76fb040
Fix bug in DataMessageHandler.isFiltersSynced() (#5118)
* Fix bug in DataMessageHandler.isFiltersSynced()

* Try alternative implementation to fix bug

* Fix valid states for CompactFilterMessage, revert PeerFinder delay
2023-06-27 14:24:26 -05:00
Chris Stewart
1d82ed04a7
2023 06 18 implement tcp connection using akka streams (#5111)
* WIP: Try to move byte streaming/parsing of p2p messages out of P2PClient

* WIP2: Work on killing the actor, replace it with a steram

* Get basic ability to send/receive version message working

* Transition PeerMessageReceiverState to Initializing inside of PeerMessagesender.connect()

* Refactor things out of PeerMessageSender.connect(), add some flow logs

* Get NeutrinoNodeTest be able to sync passing

* Fix some bugs, create ConnectionGraph helper class

* Use killswitch rather than Source.maybe to disconnect peer

* WIP: Debug

* Switch halfClose to false on Tcp.outgoingConnection() to not keep lingering connections

* Delete P2PClientActorTest

* Delete all P2PClient stuff

* Attempt implementing reconnection logic in PeerMessageSender

* remove supervisor

* Empty commit to re-run CI

* Small cleanups

* Implement sendResponseTimeout()

* Restore logback-test.xml

* Add callback to log error message on reconnect

* Increase queueSize/maxConcurrentOffers size
2023-06-24 07:53:44 -05:00
Chris Stewart
3740b4fc35
Implement batchAndParallelExecute with Future.traverse rather than Future.sequence (#5051) 2023-04-20 17:59:09 -05:00
Chris Stewart
447c6d03de
Implement getconnectioncount rpc (#5048)
* Implement getconnectioncount rpc

* Reduce waits in test, add documentation

* Fix docs

* Empty commit to re-run CI
2023-04-19 16:47:54 -05:00
Chris Stewart
3728b9a9d9
Refactor HDPath pattern matching to be safer. (#5046)
* Refactor hd path pattern matching to be safer. Also avoids warnings in scala3

* Allow single element bip32 path
2023-04-19 08:41:10 -05:00
Chris Stewart
dc0e3645d0
2023 03 24 is tip stale (#5024)
* WIP

* Fix test

* Add more tests for stale header

* remove uncessary comments
2023-03-26 08:20:27 -05:00
benthecarman
5e6cb0d514
Fix MilliSatoshis.toSatoshis for large values (#5016) 2023-03-20 09:26:32 -05:00
Chris Stewart
875a67a73c
2023 03 03 rm DataMessageHandler filter params (#5009)
* Remove DataMessageHandler filter params, tests not passing

* Adjust logging levels

* WIP

* Get tests passing

* Cleanup

* Fix logging level

* Invert isSynced flag

* Rework BaseBlockchain.toString

* Fix BlockchainTest

* Fix syncing of compact filters when walletCreationTime is passed into dmh

* Cleanup
2023-03-14 11:45:21 -05:00
rorp
2799d8276a
Update Eclair RPC to v0.8.0 (#4994)
* Update Eclair RPC to v0.8.0

* update unit tests
2023-03-04 09:02:36 -06:00
Chris Stewart
0577b8c1fe
Improve Inventory toString messages (#4997)
* Improve Inventory toString messages

* Add individual counts rather than showing each service identifier

* Add peer= prefix to peer
2023-02-23 14:12:53 -06:00
benthecarman
8bd10d0f40
Correctly handle witness v1+ spks in fallback addresses (#4949) 2023-01-12 11:39:56 -06:00
Chris Stewart
d297311814
Catch non RescanTerminatedEarly errors when rescan is terminated with an exception (#4939) 2023-01-05 12:40:50 -06:00
benthecarman
7a3c6aef36
Fix isLocalhost for 127.0.0.1 (#4900) 2022-11-27 11:29:45 -06:00
benthecarman
cc8d327ea5
Support bip32 paths with 'h' instead of an apostrophe (#4881) 2022-11-12 12:49:38 -06:00
Chris Stewart
4fa31b1bc2
Add OrderedDLCPayoutCurvePieces (#4875) 2022-11-03 10:18:01 -05:00
Chris Stewart
92613709aa
Add OrderedTLVPoints as this is an invariant in the codebase in DLCPayoutCurve (#4874) 2022-11-02 17:20:55 -05:00
Chris Stewart
994ee25733
Fix empty witness from companion object to case class (#4823) 2022-10-12 08:59:31 -05:00
rorp
de43dadf52
Network notifications (#4774)
* Network notifications

* add more tests

* don't drop futures on the floor

* Improve logging, don't drop futures on floor

* scalafmt

* add error messages to the failure notifications

* update unit tests

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-10-09 07:46:13 -05:00
benthecarman
6d0c768975
Compare bytes when comparing ScriptWitnesses (#4521) 2022-10-02 19:19:18 -05:00
Chris Stewart
e8ebcf55cd
Fix bug where signatures were out of order from what was posted in the announcement (#4809) 2022-09-30 14:00:14 -05:00
Chris Stewart
34e023e93f
2022 09 29 handle unordered sigs (#4807)
* Get unit tests passing for unordered nonces/signatures

* Get v0 oracle announcements working again on listannouncements

* Add unit test to make sure we can still validate signatures for attestments with nonces out of order
2022-09-29 11:43:50 -05:00
Chris Stewart
8d91abd678
Add signature ordering to ClaimedDLCStatus.oracleSigs (#4804)
* Add signature ordering to ClaimedDLCStatus.oracleSigs

* fix bug
2022-09-27 09:43:37 -05:00
Chris Stewart
9c506b639f
Add OrderedSchnorrSignatures, use it in OracleAttestment (#4803)
* Add OrderedSchnorrSignatures, use it in OracleAttestment, propagate it threw the codebase

* Small cleanups

* Add SortedVecFactory

* Fix test case with out of order nonces
2022-09-26 19:35:04 -05:00
Chris Stewart
4cb47c4ef4
Remove event descriptor parameter from SigningVersion.calcOutcomeHash() (#4796) 2022-09-23 06:17:38 -05:00
benthecarman
75b034d6e0
Add socket address to NodeUri (#4794) 2022-09-20 16:35:04 -05:00
Chris Stewart
bcddb015ae
2022 09 12 Filter header and filter websocket events (#4777)
* implement chain callbacks for compact filter headers / compact filters

* Wire it up through the websocket

* Fix type for compactfilterprocessed

* Fix bug to write json rather than write a string
2022-09-15 20:05:54 -05:00
benthecarman
2f18f622ab
Give BitcoinNetworks.knownNetworks proper type (#4766) 2022-09-11 13:14:03 -05:00
rorp
16893f999e
DLC connection checks and notifications (#4720)
* DLC connection checks and notifications

* asynchronous connection checks
2022-09-09 14:09:38 -05:00
Chris Stewart
26595ab3ac
Fix bug where no exception was thrown if the acceptor did not have enough money (#4728)
* Fix bug where no exception was thrown if the acceptor did not have enough money

* Revert ContractInfo.max definition, fix bug in acceptDLCOffer

* Fix incorrect usages of ContractInfo.max

* Refactor ContractInfo.max -> ContractInfo.maxOfferorPayout

* Fix dlc.md
2022-09-07 19:08:27 -05:00
Chris Stewart
328e1653a9
Drop support for scalac 2.12.x (#4704)
* Drop support for scalac 2.12.x

* Turn logging level OFF

* Remove more 2.12.x files
2022-09-03 10:16:22 -05:00
rorp
a5186cd1da
Change default DLC peer alias (#4663) 2022-08-25 06:57:16 -05:00
Chris Stewart
a0eb0824a2
Fix some bugs around resetting rescan state when a rescan fails (#4642)
* Fix some bugs around resetting rescan state when a rescan fails

* Add test case

* Use .fail() method
2022-08-22 12:55:18 -05:00
Chris Stewart
86463231d6
2022 08 18 Add configuration to only emit websocket events when IBD is done (#4627)
* Implement isinitialblockdownload flag in databaes

* Change to IsInitialBlockDownload to be less confusing

* Fix missing refactors, add ChainApi.isIBD()

* Implement logic for ChainApi.isIBD(), add configuration flag to toggle whether to emit websocket events while IBD is ongoing or not, add isinitialblockdownload field to getinfo endpoint

* Remove confusing ChainApi.isIBD() that didn't accurately account for the case where IBD wasn't set in the database

* Fix bug around emitting the websocket events

* Add some documentation
2022-08-22 10:09:00 -05:00
benthecarman
825937ea5f
Add more JSON serializers (#4628)
* Add more JSON serializers

* use PicklerKeys for consistent field names across codebase

* scalafmt

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-21 08:38:02 -05:00
Chris Stewart
1b19872ac4
Implement exportstakingaddresswif (#4617)
* Implement exportstakingaddresswif

* Add documentation

* Add unit test
2022-08-16 12:37:58 -05:00
benthecarman
26492d2449
Add descriptor for TaprootScriptPubKey (#4595) 2022-08-10 07:10:23 -05:00
Chris Stewart
326cb9845e
Implement listDLCs(state), use it in getWalletAccounting() (#4591) 2022-08-09 11:02:45 -05:00
benthecarman
b04a34ad02
Use FutureUtil.makeAsync where we are attmepting to create async Futures (#4583) 2022-08-08 15:22:32 -05:00
benthecarman
6119a334fa
Make fundRawTransactionInternal use DBIOActions (#4575)
* Make fundRawTransactionInternal use DBIOActions

* Fix to correctly use callback

* Move reservedUTXOsCallbackF to FundRawTxHelper
2022-08-06 17:14:02 -05:00
Chris Stewart
c03b158f94
Implement RescanTerminatedEarly exception to terminate the stream, implement ArgumentSource (#4574)
* Implement RescanTerminatedEarly exception to terminate the stream, implement ArgumentSource to understand where arguments passed into bitcoin-s are coming from

* Bump timeout
2022-08-04 14:11:07 -05:00
Chris Stewart
a02e25b0ce
Refactor WalletRoutes to take DLCWalletLoaderApi as a paramete (#4565)
* Refactor WalletRoutes to take DLCWalletLoaderApi as a parameter, use the walletHolder inside of DLCWalletLoaderApi to fulfill requests

Fix rebase

Reduce parallelism in fetchFiltersFlow to 1 to reduce chance of hitting akka's max open requests

* Try fix loader test by catching RejectedExecutionException

* Add println to see if catching excpetion gets hit

* WIP: Try to fix recursive rescan

* Don't map on recursiveRescan so we don't block on it
2022-08-04 09:16:46 -05:00
Chris Stewart
8cb45e8208
Add unit tests for loader rescans (#4570)
* Add unit tests for loader rescans

* Move common methods into super class to be DRY

* Cleanup
2022-08-03 13:16:52 -05:00
Chris Stewart
936a65edd4
2022 07 21 Modify helper methods in BitcoindRpcBackendUtil to not materialize streams eagerly. (#4526)
* Refactor syncWalletToBitcoind impl to be completely stream based

* Add getParallelism, refactor usages in BitcoindRpcBackendUtil to use it

* Fix compile

* Replace usages of 'WalletApi with NeutrinoWalletApi' with NeutrinoHDWalletApi

* Revert wallet sync height logic

* Refactor to make things cleaner
2022-07-31 12:16:26 -05:00
Chris Stewart
4b83286922
2022 07 25 wallet api refactor (#4545)
* Move MockChainQueryApi/NodeApi out of BaseWalletTest

* refactor BitcoinSServerMain.start() to return WalletHolder

* Add walletConfig to WalletWithBitcoind

* Move findOutputsBeingSpent into WalletApi

* Add WalletApi.clearAllAddresses(), HDWalletApi.{findAccount, getnewaddress(account)}

* Add HDWalletApi.fundRawTransaction() with an account as parameter

* Add WalletApi.findByScriptPubKey()

* Fix lots of tests in WalletIntegrationTest

* Create WalletApi.processOurTransaction()

* Get things compiling

* Fix tag integration test

* Refactor AnyDLCHDWalletApi -> DLCNeutrinoHDWalletApi

* Fix docs

* Get postgres tests passing locally

* Move initBalance map before calling callback in CallBackUtilTest

* Get compile working, rename to destroyOnlyWalletWithBitcoindCached

* Fix docs

* Fix missing destroyWalletAppConfig

* Fix scalafmt

* Fix bug in dlcWalletTest where wallet db thread pools weren't being shutdown after unit test completes

* Empty commit
2022-07-31 08:04:39 -05:00
Chris Stewart
17ef1dcdd9
Fix rescan flag getting set, add unit test (#4554) 2022-07-29 15:17:48 -05:00
Chris Stewart
f608c5d5e4
Create a helper case class called FundRawTxHelper (#4544)
* Create a helper case class called FundRawTxHelper to encapsulate the values returned by fundRawTransactionInternal

* Return FundRawTxHelper[ShufflingNonInteractiveFinalizer]

* make FundRawTxHelper.signedTx be a lazy val
2022-07-27 17:12:42 -05:00
Chris Stewart
6c76639ba3
Move processBlock into WalletApi (#4543) 2022-07-27 09:32:22 -05:00
Chris Stewart
44e09270d9
Move getNewAddress(account) to HDWalletApi (#4540) 2022-07-25 10:48:02 -05:00
Chris Stewart
b905afa65e
2022 07 20 wallet rescan stream (#4530)
* Implement rescan with akka streams

Get basic stream working with rescan

Fix bug where we weren't using rescan specific threadpool

Implement killswitch for rescan

* WIP: Expose promise to allow external completion of rescan stream

* Rework RescanStarted.RescanStarted to contain a promise to complete the stream early, and a future that represents the completed streams materialized value

* Comment cleanup

* Fix compile errors, remove killswitch

* Fix 2.12.x compile

* Introduce ActorSystem into wallet, refactor rescans to use that ActorSystem

* Fix import

* Fix bug where we were prepending instead appending to batched Vector

* Propogate RescanState upwards into WalletRoutes

* Refactor fetching of filters to be a Flow
2022-07-24 12:26:21 -05:00
Chris Stewart
d4210fad65
Pull over changes from loadwallet branch (#4527) 2022-07-21 12:12:32 -05:00
benthecarman
c210052640
Refactor coin selection to be not be bitcoin-s specific (#4496)
* Refactor coin selection to be not be bitcoin-s specific

* Add to CoinSelectorUtxo
2022-07-20 08:40:11 -05:00
Chris Stewart
5c9092889b
Add abillity to clear callbacks (#4512)
Fix missing clearCallbacks()

Add some tests

Remove uncessary code from test
2022-07-17 09:10:57 -05:00
rorp
e90e372e54
Add sync JSON field to the getinfo endpoint output (#4452)
* Add `sync` JSON field to the `getinfo` endpoint output

* improve test coverage

* update docs

* rename sync flag

* WebSocket notifications

* fix unit tests

* fix unit tests

* increase test timout
2022-07-12 14:41:43 -05:00
Chris Stewart
9412170f09
2022 07 11 fix invalid csa neg (#4495)
* Implement incorrect signature handling correctly for OP_CHECKSIGADD

* Revert tests

* scalafmt
2022-07-12 06:58:09 -05:00
benthecarman
f8f4facdd1
Correctly parse TaprootKeyPath how they are represented (#4494) 2022-07-11 19:45:59 -05:00
Chris Stewart
1b169d8fa0
Implement torstarted websocket callback (#4476)
* Implement tor started websocket callback

* Implement tor callbacks when tor is provided
2022-07-11 10:26:30 -05:00
Chris Stewart
b16a8ca6aa
Fix bug where we weren't checking if a TaprootKeyPath w/ annex has two stack elements (#4491) 2022-07-11 09:17:52 -05:00
benthecarman
59732809d0
Represent and handle SIGHASH_DEFAULT correctly in TaprootKeyPath (#4488)
* Represent and handle SIGHASH_DEFAULT correctly in TaprootKeyPath

* Prevent construction of invalid TaprootKeyPath, fix tests

* Have SIGHASH_DEFAULT be SIGHASH_ALL in preTaproot cases
2022-07-11 07:22:08 -05:00
benthecarman
ef50becf1b
Enforce MAX_PUSH_SIZE for taproot (#4486) 2022-07-11 06:41:37 -05:00
benthecarman
db63b286b3
Fix hashtype check to correctly handle scala's conversion (#4487) 2022-07-11 06:40:40 -05:00
benthecarman
91a1c84a6f
Enforce minimalif for tapscripts (#4484) 2022-07-10 19:03:51 -05:00
benthecarman
990e344a49
Disallow OP_CMS in taproot (#4485) 2022-07-10 18:47:31 -05:00
benthecarman
cc45924ed8
Validate max ScriptNumber bytes in OP_CHECKSIGADD (#4483)
* Validate max ScriptNumber bytes in OP_CHECKSIGADD

* Use correct error

* Fix so we check stack length before getting sig bytes
2022-07-10 17:55:44 -05:00
Chris Stewart
3892fa23ef
Restrict hash types allowed by taproot signature verification (#4481)
* Restrict hash types allowed by taproot signature verification

* Comment and small refactor

* Re-ignore taproot tx tests failures

* scalafmt

* Address ben's code review

* Calculate hash after doing cheap checks
2022-07-10 16:49:05 -05:00
benthecarman
3821060e68
Schnorr sig parsing checks (#4482) 2022-07-10 16:00:38 -05:00
Chris Stewart
ec599a5c3d
Fix containsOpSuccess implementation (#4480)
* Fix containsOpSuccess implementation

* Cache opSuccessBytes
2022-07-10 13:54:47 -05:00
benthecarman
0397ca6c78
tapscript/sigopsratio_3 failing correctly (#4461) 2022-07-10 08:11:57 -05:00
rorp
414557effb
Add imported flag to the seed JSON (#4459)
* Add `imported` flag to the seed JSON

* scalafmt

* update `walletinfo`

* fix docs

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-07-08 18:55:47 -05:00
benthecarman
5df5bf6741
Add support for taproot keyspend PSBTs (#4462) 2022-07-08 09:08:19 -05:00
Chris Stewart
211339f344
Add static test vectors for Taproot (#3769)
* Add static test vectors for Taproot and the ability to parse those test cases

Add TaprootWitness data structure, get parsing working for first static test case

WIP: Distinguish between TaprootKeyPath and TaprootScriptPath

Remove invariants and make val to method in TaprootScriptPath so we can parse test cases

Add TaprootTestCase.{txSigComponents, programs} methods

Try to run test case

WIP

Wrap failure case in Try

Get first test case passing

Fix building of sig component for p2sh

WIP test case legacy/pk-wrongkey

Get more test cases passing

Move where MAX_PUSH_SIZE is checked for segwit

Get another test case passing

Add links to bitcoin core in test case

Fix stack parsing for witness

Get success test cases passing (without signature verification?)

Add failure test cases

Fix basic compile failures except in javascript projects

Get basic TaprootKeyPath parsing working from ScriptWitness

Get invariants implemented correctly for TaprootScriptPath

WIP

WIP

Get first taproot signature serialization test working

Get tagged hash working correctly

Rework test framework, get 2nd success test case passing

Get compile working with rebase

Implement computeTapleafHash with a unit test case

Add scaffolding of computing merkle root test case

Implement computeTaprootMerkleRoot() with a unit test

Implement computeTapTweakHash() with a unit test

WIP: checkTapTweak()

WIP

Implement computeTapTweakHash() unit test

Rebase onto master

Get verifyTaprootCommitment() passing unit test

Refactors to be more readable

* WIP: Tapscript signature checking

* Get taproot script path signature serialization working for unit test

* Add carve out for unknown public key types

* WIP: OP_CHECKSIGADD

* Add test case to detect annex and compute its hash

* Get test case passing when using upgradable public keys with an annex on the stack

* Fix missing pattern match

* Fix bug with tapscript SIGHASH_ALL and add test case

* Add check if taproot flag is enabled

* Get signature verification working with annex hash

* Implement correct handling of fail case for OP_CHECKSIGADD

* Get test case passing

* DRY

* Fix bug, now we only allow tapscript sig checking when pubkey is 32 bytes in size

* Refactor evalChecksigTapscript to use XOnlyPubKey

* Get signature serialization working with OP_CODESEPARATOR

* Get SIGHASH_ANYONECANPAY|SINGLE example working

* Fix bug in BIP342 impl where we don't count op codes if the version is taproot

* Fix OP_CODESEPARATOR bug

* Implement calculating of OP_CODESEPARATOR idx relative to other opcodes, not push operations

* Fix OP_CHECKSIG tapscript bug where we didn't push OP_FALSE onto stack in case of signature validation failure

* Add annex to TaprootKeyPath

* Get signature chcking working with tapscript keypath annex

* Cleanup test framework code a bit to avoid casting exceptions

* Implement handling of OP_SUCCESS

* WIP: Segwit v0 serialization with nonstandard sighash flag

* Fix hash bug in segwit v0 serialization

* WIP

* Fix bug where we weren't defaulting to SIGHASH_DEFAULT when using tapscript

* Add disabled opcodes to OP_SUCCESS case

* Fix parsing for witnesses in test case

* Get a SIGHASH_SINGLE test case working

* Clean up rebase

* Fix default hash type in TaprootKeyPath

* Implement opCodeSeparator counting that does NOT work when OP_CODESEPARATOR is is not executed inside of an OP_IF, otherwise is very simple for the base case

* Cherry-pick ben's commits & rebase

* Remove script size limit for tap scripts

* Fix incorrect handling of unassigned spk

* Fix invariant

* get correct test case failing

* WIP: SIGHASH_ALL_ANYONECANPAY test case

* Cleanup logging/println

* Refactors & fix regressions in some simple unit tests

* Remove logback in core to get the entire project compiling again

* Make TapscriptPath.hasAnnex() more robust against exceptions

* Add validation of XOnlyPubKey to control block

* Implement known leaf versions in the control block

* Add TaprootUnknownPath and UnknownControlBlock

* Fix rebase

* Fix interpreter bug where v0 segwit wasn't failing when a wrong program was used

* Cleanup println

* Clean up println pt2

* Re-enable -Xfatal-warnings

* Turn off logback-test.xml

* Parallelize taproot success test cases

* Try to bump timeout

* Optimization: Reduce number of intersections in ScriptInterpreter.run()

* Ben's code review

* Take ben's clean stack bugfix

Co-authored-by: benthecarman <benthecarman@live.com>
2022-07-07 14:53:28 -05:00
benthecarman
000e7a7930
Have FutureUtil.makeAsync handle thrown exceptions (#4458) 2022-07-07 14:26:38 -05:00
Chris Stewart
83cff9a44c
2022 07 07 issue 4455 (#4457)
* Get simple serialization symmetry working for taproot keypath

* Implement generators for TaprootScriptPath, check serialization symmetry

* Make sure bytes are symmetrical too

* Add check in TaprootScriptPath.hasAnnex() to make sure therer is more than one stack element

* Cleanup

* Address ben's review

* Fix pattern match
2022-07-07 12:04:16 -05:00
benthecarman
eae16a52f8
Allow creating input info of simple OP_TRUE script pub key (#4450) 2022-07-06 10:52:06 -05:00
Chris Stewart
11f6c8f024
2022 07 05 UnknownControlBlock (#4449)
* Add TaprootUnknownPath and UnknownControlBlock

* Fix small bugs and make validation more resilient against exceptions

* Take ben's suggestion and use abstract class

* Fix bug in TaprootKeyPath's default hash type

* Fix comment
2022-07-05 19:26:28 -05:00
Chris Stewart
6f6315c1e7
Fix taproot SIGHASH_SINGLE taproot annex hash bug (#4448) 2022-07-04 16:16:57 -05:00
benthecarman
64183568fe
Allow creation of TaprootTxSigComponent (#4445)
* Allow creation of TaprootTxSigComponent

* PreviousOutputMap using MapWrapper
2022-07-04 08:46:10 -05:00
benthecarman
5f93096c5a
Fix Taproot keyspend serialization (#4443) 2022-07-02 05:05:36 -05:00
benthecarman
93302fea01
Fix TaprootKeyPath.isValid for 64 byte sigs (#4444) 2022-07-02 05:02:47 -05:00
Chris Stewart
0c14fc961b
Add test case for SIGHASH_ALL_ANYONECANPAY in taproot (#4442)
* Add test case for SIGHASH_ALL_ANYONECANPAY in taproot

* Remove spendingTx comment
2022-07-01 16:45:41 -05:00
Chris Stewart
3122e1d0f8
Fix bug in taproot SIGHASH_ANYONECANPAY_SINGLE impl (#4440) 2022-07-01 10:24:09 -05:00
Chris Stewart
38d8f8cdf0
2022 06 30 OP_CODESEPARATOR impl compatible with taproot (#4439)
* Implement OP_CODESEPARATOR index checking

* Remove taproot serialization options

* Refactor name

Co-authored-by: benthecarman <benthecarman@live.com>
2022-06-30 13:59:14 -05:00
Shreyansh
42564bc810
Find and switch peers (#4408)
* add support to find and switch peers

* fix compile on 2.12

* allow empty config peers in regtest

* fix test

* minor fixes

changes timeouts, fix issue with ipv6 dns seeds, initDisconnect when disconnected bug, dbPeers order fix

* fix: not removing peers on initialization timeout

* fix: query again when previous failed

* fix: wrong condition for deferred peers

* restore log levels

* clean up

* add PeerStack to allow trying peers based on priority values

* fix migrations

* changes from comments

* use StartStopAsync

* changes from comments

* fix switch if peer down test

* changes from comments
2022-06-28 10:19:13 -05:00
Chris Stewart
a97be26586
Get a SIGHASH_SINGLE test case working (#4431)
* Get a SIGHASH_SINGLE test case working

* Remove println
2022-06-27 15:23:49 -05:00
benthecarman
c4fd7035be
Add Taproot PSBT fields (#4420) 2022-06-27 08:55:30 -05:00
Chris Stewart
124cbe4b67
Add annex to TaprootKeyPath (#4416)
* Add annex to TaprootKeyPath

* Add TaprootWitness.annexHashOpt

* Fix duplicate method
2022-06-23 12:12:38 -05:00
Chris Stewart
5115d8d076
Move lastCodeSeparator to StartedScriptProgram (#4414) 2022-06-22 09:41:30 -05:00
Chris Stewart
a680f03c04
Implement BIP341 (#4409)
* Implement BIP341

Get coreTest working

* REmove logger

* scalafmt

* Cleanup

* Make checkSigTapScrip() take a SchnorrPublicKey

* Address ben's code review

* Adjust error type on WitenssVersionV1.rebuild()
2022-06-22 09:36:55 -05:00
Chris Stewart
9769fbcbb6
Add TaprootWitness, new methods to XOnlyPubKey (#4394)
* Add TaprootWitness, new methods to XOnlyPubKey

* Address codereview
2022-06-14 20:27:01 -05:00
Chris Stewart
acd1d227cf
Rework WitnessVersion.rebuild() to take WitnessScriptPubKey as a parameter (#4393)
* Rework WitnessVersion.rebuild() to take WitnessScriptPubKey as a parameter rather than the raw asm

* Fix bug when calculating witness program length

* Fix witnessProgram bug in ScriptInterpreter.rebuildV0()

* remove invariant, fix type
2022-06-14 20:08:13 -05:00
Nadav Kohen
ad8802164c
ECPublicKey.tweakMultiply -> multiply and Added CryptoParams.getG (#4391)
* Renamed ECPublicKey.tweakMultiply to just multiply and added CryptoParams.getG

* Used decompressed G in FieldElement.G

* Removed G from FieldElement altogether
2022-06-14 13:11:21 -05:00
rorp
fdf281b469
DLC <-> contact mapping (#4346)
* DLC <-> contact mapping

* updated docs

* populate dlc/contact mapping automatically

* typo

* respond to the PR comments

* rename `contact` to `peer`

* fix unit tests

* create a contact when an incoming offers gets created

* drop dlc_contact_mapping table

* fix build

* update the docs

* Revert "update the docs"

This reverts commit 2386adadcd.

* revert dlc-contact-* endpoints
t Please enter the commit message for your changes. Lines starting
2022-06-14 08:14:28 -05:00
Chris Stewart
ddbdde495d
2022 06 13 taprootspk xonlypubkey (#4388)
* Implement XOnlyPubKey inside of TaprootScriptPubKey

* Add ECPrivateKey.toXOnly

* Address code review
2022-06-13 18:43:43 -05:00
GreyMcCarthy
5f82307e27
Added Compute Contract Id test Vectors (#4385)
* Testing contract id calculation

* Added implicit json reader imports
2022-06-13 14:13:48 -05:00