Commit Graph

69 Commits

Author SHA1 Message Date
Chris Stewart
f75a52b521
Refactor TransactionProcessing.processTransaction() to use BlockHashWithConfs (#5744)
* Refactor TransactionProcessing.processTransaction() to use BlockHashWithConfs

Create WalletUtil.getBlockHashWithConfs(), use it in various places through the codebase

* Fix docs
2024-10-28 12:52:53 -05:00
Chris Stewart
4471f74ccf
Add error field toImportDescriptorResult, move BitcoindException to app-commons (#5705)
* Add error field to ImportDescriptorResult, move BitcoindException to app-commons

* Fix docs
2024-10-12 09:49:42 -05:00
Chris Stewart
52c0625ba9
2024 09 30 dlcwallet has a wallet (#5692)
* refactor: Rework codebase so that DLCWallet has-a instance of Wallet rather than is-a via inheritance

* Fix cast

* Fix RescanHandling in DLCWallet

* Remove default implementation of WalletApi.broadcastTransaction()

* fix broadcast callback for DLCWallet

* Add DLCWalletDAOs.fromDLCAppConfig()

* Fix scaladoc for AddressHandlingApi.getUnusedAddress
2024-10-01 13:29:58 -05:00
Chris Stewart
13a895efe9
2024 09 24 simplify wallet (#5685)
* WIP: Simplify wallet

# Conflicts:
#	fee-provider/src/main/scala/org/bitcoins/feeprovider/FeeProviderFactory.scala

# Conflicts:
#	wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala

* Get walletTest/test passing

* Remove WalletApi.{start(),stop()}

 Conflicts:
	core/src/main/scala/org/bitcoins/core/api/wallet/WalletApi.scala
	wallet/src/main/scala/org/bitcoins/wallet/Wallet.scala
	wallet/src/main/scala/org/bitcoins/wallet/WalletHolder.scala

* Cleanup RescanDLCTest

* Move checkRootAccount into AccountHandling.scala

* Fix rebase

* Fix docs
2024-09-27 13:40:29 -05:00
Chris Stewart
7caea21b6a
refactor: Move more methods out of WalletApi (#5681)
Remove more methods out of WalletApi

refactor: move getTransactionsToBroadcast to SendFundsHandlingApi
2024-09-26 16:22:30 -05:00
Chris Stewart
d17934f17f
Add SendFundsHandlingApi, remove HDWalletApi (#5680)
* Begin moving methods out of HDWalletApi

* Add SendFundsHandlingApi, remove HDWalletApi

* Fix docs

* Move makeOpReturnCommitment() to SendFundsHandlingApi

* Remove MockWalletApi

* Cleanup

* Fix RoutesSpec

* Revert logback-test.xml
2024-09-22 09:32:01 -05:00
Chris Stewart
8c5d685953
Refactor codebase to have has-a relationship with RescanHandling rather than is-a (#5675)
* Refactor codebase to have has-a relationship with RescanHandling rather than is-a

get everything compiling

Get all tests passing

* Revert and clean up files

* Fix docs
2024-09-19 09:46:56 -05:00
Chris Stewart
d13e12afae
2024 05 11 wallet xsource3 (#5588)
* Add -Xsource:3 to chain/

* -quickfix chainTest

* Add -Xsource:3 to wallet/ wallet-test/ dlc-wallet/ dlc-wallet-test/
2024-05-11 09:49:10 -05:00
Scala Steward
afddf73c48
Update scalafmt-core to 3.8.1 (#5501)
* Update scalafmt-core to 3.8.1

* Update .scalafmt.conf settings to be factory default settings

* Fix typo

* scalafmt

* Empty commit to re-run CI

* Revert some scalafmt back to original scalafmt.conf

---------

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2024-04-20 19:55:49 -05:00
Chris Stewart
b252c2d6a2
2023 10 16 Implement WalletCallbackStreamManager, DLCWalletCallbackStreamManager (#5263)
* WIP: Implement WalletCallbackStreamManager

* Implement stopping of WalletCallbackStreamManager in WalletAppConfig

* WIP: DLCWalletCallbackStreamManager

* Refactor DLCWalletCallbacks to be a trait

* Integrate DLCWalletCallbackStreamManager into WebsocketUtil

* Use  java.util.concurrent.atomic.AtomicBoolean rather than monix

* Remove logger param from dlc callbacks

* fix docs

* Call super.stop() in DLCappConfig

* Empty commit to run CI

* Try to debug

* Empty commit to run CI

* Revert things
2023-10-19 11:52:07 -05:00
Scala Steward
d7037ede28
Update scala-library to 2.13.12 (#5235)
* Update scala-library to 2.13.12

* Fix compiler errors on scala 2.13.12

---------

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2023-09-12 10:45:17 -05:00
benthecarman
1d1af1d52e
Add generate helper function for bitcoind (#4852) 2022-10-19 14:22:30 -05:00
Chris Stewart
62081a43ec
2022 10 05 Delete legacy DLCSerializationVersion.Alpha DLCs for a cleaner upgrade to v0 spec (#4817)
* Delete alpha DLCs

* Get alpha migration working
2022-10-07 07:13:32 -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
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
rorp
34c10c6c65
Fix WalletDLCSetupTest (#4623)
* Fix WalletDLCSetupTest

* scalafmt
2022-08-18 07:23:54 -05:00
Chris Stewart
46502496c1
Update DLCClientIntegrationTest to use the newest bitcoind (#4596) 2022-08-10 09:34:35 -05:00
Chris Stewart
2cd8c80f67
Refactor so we don't create multiple WalletAppConfig in testkit (#4548)
* Refactor so we don't create multiple WalletAppConfig in testkit

Fix buildBip39PasswordConfig

* Remove bip39Password argument from dlcWalletTest fixtures

* Fix allowExternalDLCAddresses config in tests

* Remove unnecessary overrides of BitcoinSWalletTest.getFreshConfig, fix docs

* Add DLCExecutionBackendTest.afterAll()

* Fix nodeTest bip39Password usage

* Fix bug where we weren't using correct config inside of getFreshConfig

* Fix DLCExecutionBitcoindBackendtest.afterAll()

* Fix RescanDLCTest
2022-07-30 17:20:18 -05:00
Chris Stewart
b69e487d04
Move MockChainQueryApi/MockNodeApi out of BaseWalletTest (#4542)
* Move MockChainQueryApi/NodeApi out of BaseWalletTest

* fix docs

* Move wallet configurations out of BaseWalletTest

* Move helper methods out of BitcoinSFixture trait into companion object to simplify the hierarchy

* Refactor usage of WalletWithBitcoind to allow parameterization of the BitcoindRpcClient type
2022-07-27 10:18:22 -05:00
benthecarman
64183568fe
Allow creation of TaprootTxSigComponent (#4445)
* Allow creation of TaprootTxSigComponent

* PreviousOutputMap using MapWrapper
2022-07-04 08:46:10 -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
Nadav Kohen
b80bf4649e
Add HashType to ECDigitalSignature API (#4320)
* HashType now uses Int instead of Int32

* Moved HashType from core to crypto

* Added HashType helper functions to ECDigitalSignature

* Added tests

* Fixed compile
2022-05-29 18:25:22 -05:00
rorp
f680ab8691
Persist whether wallet is rescanning in the database (#4326)
* Persist whether wallet is rescanning in the database

* fix cli

* fix build

* fix unit tests

* fix postgres tests

* remove wallet_state table

* fix rescan bug

* cleanup

* revert Cancellable's

* Cleanup

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-05-23 19:03:02 -05:00
Chris Stewart
37da24b94b
Add SignDbState to fix rescan exception (#4246)
* Add SignDbState to fix rescan exception

* Cleanup

* Add test, doesn't pass

* Add unit tests, add invariants

* Add unit test to appServerTest

* Fix handling so an exception is not thrown internally when a contractId does not exist
2022-04-11 08:06:53 -05:00
Chris Stewart
ddabc91294
2022 04 02 fix walletdlcsetup test (#4237)
* WIP

* Fix test case so it passes
2022-04-02 11:40:33 -05:00
Chris Stewart
b5bfcbc009
Increase amount so test fails more consistently (#4233) 2022-03-31 10:09:39 -05:00
Chris Stewart
f2fa56221d
2022 03 31 collateral invariant (#4232)
* DLCMessage.totalCollateral -> DLCMessage.collateral

* Fix bad names of {DLCOfferTLV,DLCAcceptTLV}.totalCollateralSatoshis, its not the total collateral, rather the collateral being contributed by the offerer and acceptor

* Fix rebase

* Fix appServerTest

* Fix docs
2022-03-31 09:48:08 -05:00
Chris Stewart
8081772b57
Allow acceptor to upsert same outpoint multiple times for different offers (#4230)
* Allow acceptor to upsert same outpoint multiple times for different offers

* Remove extra log

* Revert DLCOffer invariant

* Fix OP_RETURN tests
2022-03-31 07:47:10 -05:00
Chris Stewart
3f18f7b04c
Only allow executing a DLC if it is in the Broadcast or Confirmed state (#4185)
* Only allow executing a DLC if it is in the Broadcast or Confirmed state

* Only throw if DLC is setup, not if its already executed
2022-03-13 14:08:47 -05:00
rorp
ffd7d921a8
Database support for incoming offers (#4105)
* Database support for incoming offers

* fix tests
2022-02-18 14:03:05 -06:00
rorp
5777ec1c31
Add an ability to set custom payout and change addresses (#4101)
* Add an ability to set custom payout and change addresses

* config changes

* formatting

* respond to the comments
2022-02-18 09:29:00 -06:00
rorp
6cfbf67812
Prevent DB state corruption while accepting the same offer multiple times (#4067)
* Prevent db state corruption while accepting the same offer multiple times

* cleanup
2022-02-11 12:23:17 -06:00
rorp
bce58ba33d
Validate announcement signatures on create/accept offer (#4071)
* Validate announcement signatures on create/accept offer

* unit tests
2022-02-11 06:50:45 -06:00
Chris Stewart
9de4b0272a
2022 01 31 issue 4030 (#4066)
* WIP

* WIP

* Get basic unit test passing for new adaptor sig states

* Fix compile
2022-02-09 13:15:44 -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
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
e802254a20
2022 01 24 rm appconfig varargs (#4011)
* Get things compiling

* Get tests passing

* Fix docs
2022-01-25 07:25:05 -06:00
Chris Stewart
52dcf51e82
Automatically download binaries if they are used in test suite (#4005)
* Remove download binary scripts from CI, try to make binary downloads contingent on tests being run in a project

* Cleanup docs to remove unecessary downloadBitcoind
2022-01-23 17:43:30 -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
rorp
8a881b37f4
Add DLC callback for refunded DLC (#3989) 2022-01-18 12:29:19 -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
4ca586ca46
2021 12 19 dlc callbacks (#3923)
* Implement DLC wallet callbacks

Add callbacks and tests for Claimed/RemoteClaimed

Add unit test for confirmed state

* Add some docs

* Address ben's code review

* Fix scalafmt
2021-12-20 14:28:52 -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
Chris Stewart
31e8324522
Make sure exception is caught by Future inside of UtxoHandling.unmarkUTXOsAsReserved() (#3816) 2021-11-11 15:22:45 -06: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
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