Commit Graph

530 Commits

Author SHA1 Message Date
rorp
e2b9c458e4
Change DLCUtil.buildOracleSignatures (#4061) 2022-02-07 19:50:53 -06:00
Chris Stewart
7f344ad3ff
2022 02 06 announcement creation logging (#4055)
* Add logs for creating announcements

* Add attestation logs

* scalafmt
2022-02-06 17:30:42 -06:00
Chris Stewart
590cd9c72e
2022 02 06 remoteclaimed refactor (#4054)
* Small refactors to make things more readable

* Add invariants to make sure things are defined when doing the RemoteClaimed flow

* Move where we update DLCDb state to RemoteClaimed so its atomic with the rest of the db updates

* Consoldiate uses of updatedDlcDb

* Add logs

* scalafmt
2022-02-06 16:31:13 -06:00
Chris Stewart
7a6f0430d6
2022 02 03 issue 4032 (#4042)
* get all dlcWalletTest/test passing

* Get dlcTest/test working with ignored test cases

* WIP

* Rework match oracleSignatures

* Refactor checkSingleContractInfoOracleSigs to use matchOracleSignatures

* Clean up checkOracleSignaturesAgainstContract for disjoint, still doesn't pass test cases

* Some DRY in numeric test cases

* Add test case for enum contracts

* Fix disjoint union contract bug

* Refactor matching of oracle announcements and oracle signatures into DLCUtil

* Fix compile on on 2.12.x

* Address parts of code review
2022-02-05 09:04:04 -06:00
rorp
2066447cdc
Add isEndpoint to numeric contract descriptor serialization (#4033)
* Add isEndpoint to numeric contract descriptor serialization

* Fix compile

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-02-01 09:42:21 -06:00
Chris Stewart
71711ca582
Add invariant to make sure spendingTxId is different than the txid (#4019) 2022-01-27 09:52:12 -06:00
Chris Stewart
b918cf78b7
Fix bugs where we were building internally inconsistent SpendingInfoDb (#4016)
* Fix bugs where we were building internally inconsistent SpendingInfoDb

* Fix error message
2022-01-27 07:22:09 -06:00
Chris Stewart
bd5bcfef3a
2022 01 18 issue 3969 Add serialization_version to global_dlc_data (#3992)
* Get refactor working where we decouple CETSignatures and the partial refund signature

* WIP

* Implement migration to specify serialization_version on global_dlc_data table

* Fix migrations test

* WIP

* implement contractid computation

* Get migration working for wallet on testnet

* Add check to make sure we only try to migrate old wallets

* Refactor DLCDataManagement.getOfferAndAcceptWithoutSigs to not use DLCTxBuilder

* WIP

* Bubble up Option[] into DLCWallet, trivially assert on it and then use .get. We will have to do the refactor of DLCWallet sometime in the future

* Change global_dlc_data serializationVersion at database level to not have an Option

* Add DLCDbState, propogate it through the codebase

* Remove log

* Remove invariant for making sure all DLCs are defined on migraiton, add log for the case of issue 4001

* Add filter on ALPHA serialization DLCs. We dont need to migrate DLCs that are using the beta serialization

* Rebase onto 4004

* Refactor to use the refund signature in the accept/sign message

* Add output index to the return of DLCTxBuilder.buildFundingTransaction()

* Fix compile

* Remove log
2022-01-26 14:57:45 -06:00
Chris Stewart
d983ad14f3
Fix contractid computation (#4012) 2022-01-26 05:30:29 -06:00
Chris Stewart
dbfd58da86
Add log txids inside of inventories in big endian rather than little endian (#4013) 2022-01-25 10:50:58 -06:00
Chris Stewart
21de609ed8
2022 01 22 cetsignatures refactor (#4004)
* Get refactor working where we decouple CETSignatures and the partial refund signature

* Add DLCAcceptWithCetSigs() for the case where we have a refund sig, but no cet signatures

* Fix bugs

* Fix sighash parsing bugs
2022-01-23 16:13:36 -06:00
Chris Stewart
7ee1f0f406
Implement batching of database calls for our chain callback (#4003) 2022-01-23 07:39:10 -06:00
Chris Stewart
ee0d62c5b8
2022 01 14 DLCDataManagement refactor (#3982)
* WIP

* Finish refactor, get unit tests working

* Remove log
2022-01-18 08:12:27 -06:00
Chris Stewart
214213b59d
2022 01 16 issue 3983 (#3987)
* Add test case

* Add check that the pubkey is valid in WitnessScriptPubKeyV1.isValidAsm()
2022-01-17 14:38:51 -06:00
Chris Stewart
bf8b165fe9
Implement recovery for when we cannot receive a fee rate from a FeeRateApi (#3975)
* Implement recovery for when we cannot receive a fee rate from a FeeRateApi. Now we return -1 sats/vbyte if we cannot get the fee rate from a fee provider rather than throwing an internal server error

* Fix compile
2022-01-12 14:09:15 -06:00
Chris Stewart
9dd126bb9f
Modify estimatefee endpoint to return a number rather than a string (#3973)
* Modify estimatefee endpoint to return a number rather than a string

* Fix compile

* Fix infinite loop on converting to sats/vb, add tests
2022-01-12 12:17:04 -06:00
Shreyansh
a58ef1cd02
Storing peers in database (#3773)
* rebase

* fix

* fix

* remove unwanted diffs

* fix

* formatting

* changes from comments

* Revert "changes from comments"

This reverts commit eb8a795718dc590802a19c7ce4cce4501bd2de1f.

* changes from comments

* add PeerManager

* add sha3-256

* add NetworkUtilTest

* formatting
2022-01-09 07:21:59 -06:00
Chris Stewart
93c5121632
2021 01 06 tlv invariants (#3965)
* Add invariant to CETSignaturesTLV so we don't have empty adaptor sigs

* Add invariant to make sure FundingSignaturesTLV witnesses are not empty

* Add invariant that contractOraclePairs aren't empty

* Add fundingInputs and ordered announcement invariants

* fix docs

* Move invaraints from TLVs to in memory data structures

* WIP

* WIP2

* Modify return type of DLCDataManagement.executorAndSetupFromDb() to return an Option. The None case represents when we have pruned CET signatures from the database

* Add some comments, clean up a bit

* more cleanup
2022-01-08 16:21:58 -06:00
Chris Stewart
8857af2b66
Address ben's code review on #3854 (#3962)
* Address ben's code review

* Rename DLCSerializationVersion

* Scalafmt and bug fix'

* Fix docs
2022-01-05 08:49:23 -06:00
benthecarman
b342f373ae
Make ContractDescriptorTemplate an unsealed trait (#3963) 2022-01-05 08:49:11 -06:00
Chris Stewart
8c5288d758
Implemented general payout curves (#3854)
* Implemented general payout curves including hyperbola curve piece support

WIP

Get GUI compiling

* WIP

* Get backward compatible serialization working, everything is equivalent except for in memory Scala data structures

* Get numeric contracts backward compatible

* Get rest of codebase compiling

* Add test case for old contract info

* Add sanity test vector for old enum contract descriptors

* Fix docs

* Remove comment

* Scalafmt

* Add DLCSerializationVersion, replace isOldSerialization

* Remove ValueIterator.takeNoSkip()

* Fix docs

Co-authored-by: nkohen <nadavk25@gmail.com>
2022-01-05 07:07:22 -06:00
benthecarman
c3d1b2ee12
Give DLCOracle to filter events by pending/completed (#3953) 2021-12-30 06:33:16 -06:00
Nadav Kohen
6652448f99
Added constructor for p2pkh for decompressed public keys (#3944) 2021-12-27 15:23:38 -06:00
Chris Stewart
50bec2abc6
2021 12 14 websockets (#3906)
* WIP

* Get basic websocket working (sort of)

* Push websocket fixes

* WIP: Implementing SpendingInfoDb json serializer

* Implement onreserved callbacks, add json serializers for SpendingInfoDb

* Get first unit test working for websockets when a address is generated

* Rework WalletNotification to have case classes, get unit test working for receiving addresses over the websocket

* WIP

* Add websocket callback for when a wallet processes a block

* Cleanup

* basic updates to unit test

* Fix compile

* Fix submodule

* Fix compile

* Get both unit tests passing when run by themselves

* Fix so both test cases can be run

* Implement unit tests for blockpressed and reservedutxos websockets

* Fix RoutesSpec get a block header test

* Implement configuration for wsbind and wsport via bitcoin-s.conf

* Add some nonblocking sleeps on all WebsocketTests

* Add documentation

* Properly close the server with .terminate() rather than .unbind()

* Add BitcoinSServerMainBitcoindFixture.afterAll()

* Add println

* Add more println

* Try to downgrade bitcoind version

* Fix datadir bug

* Cleanup callbacks so they don't have nested futures

* Fix SpendingInfoDb.apply() pattern match

* Add spendingInfoDb json serializer test, does not pass

* Fix SpendingInfoDb json serializer

* Make small refactors

* Fix compile

* Add maxBufferSize, change overflow strategy to OverflowStrategy.dropHead

* Address Nadav's code review

* Address ben's code review
2021-12-25 11:11:04 -06:00
rorp
41b96c4c7e
Add rescan field to walletinfo response (#3933) 2021-12-23 14:30:26 -08:00
rorp
4b07629d56
Add getmediantimepast RPC call (#3921)
* Add `getmediantimepast` RPC call

* update docs

* respond to the PR comments
2021-12-22 16:15:30 -06:00
Chris Stewart
3cd57d37f5
Remove backupwallet / backup oracle (#3920)
* Remove backupwallet / backup oracle

* Add zipdatadir documentation

* Fix submodule
2021-12-20 08:19:46 -06:00
benthecarman
d66afe9e43
Add satoshisRounded to Bitcoins (#3904) 2021-12-14 17:20:57 -06:00
Chris Stewart
0d37c4b54f
2021 12 08 block parsing bug caused by 65 byte taproot signatures (#3887)
* Add block  0000000000000000000593310d3b0cdc082af49f38b8a1611239072aef8433a8 test vector

* Add test cases

* wip

* Fix bug where we were classifying taproot txs as P2WPKHWitnessV0

* revert logging level

* Some cleanup

* Add logback.xml for scripts, remove scheduler in scan bitcoind

* Fix imports

* Take ben's suggestion and add check to CryptoUtil.isValidPubKey
2021-12-09 06:38:25 -06:00
Chris Stewart
d393848cc2
2021 11 30 issue 3847 (#3862)
* Start pulling over accept serializers from dlc message spec PR

* Get sign tlv json serialization working

* Implement decodeaccept,decodesign in CoreRoutes

* Move messages to DLCTestUtil, add documentation
2021-12-01 13:30:18 -06:00
Chris Stewart
f71d3567ed
2021 11 23 crud action (#3851)
* WIP

* Finish implementing {CRUD,CRUDAction}.createAllAction()

* Try to make database inserts more atomic

* Consolidate more database calls in DLCWallet.initDLCForAccept()

* WIP2

* More refactor and using actions

* Add DLCIdDaoUtilNoPK for querying when dlcId is not a primary key

* Add DLCDataManagement.deleteDLC()

* make DLCWalletApi.createDLCOffer() use actions

* Rework DLCWallet.createNewDLCAccept() to use DBIOAction

* Use actions in DLCWallet.registerDLCAccept() a bit

* Create DLCActionBuilder, move actions to there

* Move more actions into ActionBuilder

* Implement transactionally on database writes for actions
2021-11-30 12:38:55 -06:00
Chris Stewart
8765c2f845
Disjoint union dlc (#3839)
* Implemented Disjoint Union DLC related data structures with dlcTest passing

Broke DLCClientTest up into multiple test files

Optimized DLC execution unit tests by checking all outcomes on a single setup DLC

Refactored DLCTest to allow for Disjoint Union DLC construction and validation, added tests

Responded to review

Fixed after cherry-pick

Fixed docs

* Fixed things after rebase

* Rebase

* Fix json serializer

* Finish fixing compile

* Start trying to make APIs better for multi oracle contract infos

* Clean things up in the GUI, try to make failures on disjoint union contracts as explicit as possible

* Use less numDigits as optimization for non secp CI test cases

* Fix compile

* Refactor BroadcastDLCDialog

* Fix test case optimization

* Clean up comment

Co-authored-by: nkohen <nadavk25@gmail.com>
2021-11-29 19:26:00 -06:00
benthecarman
90e01d7fc6
Fix broadcasting witness vs legacy txs (#3841)
* Fix broadcasting witness vs legacy txs

* Fix version test
2021-11-22 07:25:58 -06:00
benthecarman
079fa62073
Lnd v0.14.0 (#3835) 2021-11-19 06:55:56 -06:00
benthecarman
422aea2242
Fix TypeIdentifier fromBytes (#3832) 2021-11-17 06:26:07 -06:00
Chris Stewart
1d7529236f
2021 11 13 scan bitcoind witspkv1 mempool (#3825)
* Add script to count witness spk v1 txs

* more fixes and information

* Clean up
2021-11-16 13:06:51 -06:00
benthecarman
0b3654f020
Remove scientific notation from Bitcoins.toString() (#3811) 2021-11-10 12:55:44 -06:00
Nadav Kohen
09c2562675
Added WitnessScriptPubKeyV1 for sending to Taproot addresses (#3737)
* Added WitnessScriptPubKeyV1 for sending to taproot addresses

* Add basic serialization test case

* Add basic unit tests around constructing a WitnessScriptPubKeyV1

* Add a generator for witSPKV1

* Add override

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2021-11-05 12:35:52 -05:00
Chris Stewart
aa748c012f
2021 11 03 protocol version (#3793)
* ProtocolVersion WIP

* Start incorporating protocol version into DLC Offer

* Fix doc
2021-11-03 15:13:19 -05:00
Chris Stewart
18726c10bb
Move ValueIterator out of TLVFactory trait (#3794) 2021-11-03 12:13:44 -05:00
Chris Stewart
92cf042ccb
Expose MnemonicCode.toEntropy() and MnemonicCode.toEntropyWithChecksum() methods (#3786) 2021-10-29 19:34:42 -05:00
rorp
d71208cf0f
Support Eclair v0.6.2 (#3765)
* Support Eclair v0.6.2

* cleanup
2021-10-19 11:46:54 -05:00
benthecarman
6d43d443ba
Initial c-lightning rpc support (#3755)
* Initial c-lightning support

* Respond to review
2021-10-19 10:58:29 -05:00
benthecarman
92ab9faa45
Decide which coin selection solution to use based on waste metric (#3646)
* Decide which coin selection solution to use based on waste metric

* Fix test

* Fix NeutrinoNodeWithWalletTest
2021-10-19 09:47:28 -05:00
rorp
5a5f1e00c7
Store oracle name in the database (#3748)
* Store oracle name in the database

* fix pg tests

* respond to the PR comments
2021-10-14 09:35:11 -05:00
Shreyansh
ebdf1e2382
add ControlMessageHandler (#3732) 2021-10-08 16:34:33 -05:00
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