-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Atomic bsq trades #5729
Closed
Closed
[WIP] Atomic bsq trades #5729
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Broaden type requirement
Let Offer handle all OfferPayload data access.
An interface for OfferPayload currently only used by OfferPayload. Some features won't be available for newer payload types but to fit this into the Offer and Trade framework it's necessary to hack it a bit.
Offer protobuf has oneof FeeTxOfferPayload and AtomicOfferPayload. This is backwards compatible since the wire format is the same for the old Offer and the new one with offer_payload set since the index is the same.
Add a hidden account type that's automatically used for BSQ trades. This means old orders not using AtomicAccount can still complete the trades as per normal and new offers placed with AtomicAccount can be taken by anyone with an upgraded client, but won't be possible to take by users with older clients. The atomic account is added on startup if not already added. There is no data associated with the account, a new BSQ address will be chosen automatically during the atomic trade process.
Copy paste of normal take offer code with extra steps removed Added AtomicTxBuilder prototype as a way to build the atomic tx, verify inputs and gather input requirements. Only the input requirement is used during the take offer process.
This prepares for letting TradeManager handle AtomicTrade that is a Tradable
Add atomic trade tab under portfolio
Set txid when parsing AtomicTrade from protobuf
- Add offers service protos: GetAtomicOffer, GetMyAtomicOffer, GetAtomicOffers, GetMyAtomicOffers, CreateAtomicOffer. - Add proto message AtomicOfferInfo. - Add bool tradeAtomic field to CreateCryptoCurrencyPaymentAccountRequest. - Add trades service protos: GetAtomicTrade, TakeAtomicOffer. - Add proto message AtomicTradeInfo.
We will need that to know if its a segwit input or not. Add constructors for converting a TransactionInput to RawTransactionInput. Handle bitcoinSerialize according to segwit flag. This change should not break anything as we only add a field to protobuf and RawTransactionInput is not used in cases where we depend on the hash of the payload like in offers.
Don't change old behaviour for normal trade protocol methods where we use segwit=false for serialisation.
transactionInput.hasWitness would only work for signed inputs but we need to do the fee calculation before the signing. Adjust fee calculation values using vbytes according to https://bitcoin.stackexchange.com/questions/87275/how-to-calculate-segwit-transaction-fee-in-bytes
This need to be tested further...
at process input task and reuse that value in next task
If available funds is < dust it will add the dust change to miner fee If the If available funds is > dust but the additional change output would produce another dust change it will also add it to miner fees. In that case the added amount is > dust.
Cleanup, make constructors private and add deprecated annotation
Verify also sum of input values from DAO state data
Add comments
Complete trade protocol
Closing as superseded and merged by #5775 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #5121, #5127
Major refactoring of OfferPayload to accommodate offers with no maker fee tx.
A lot of copy paste and remove extra stuff to place and take atomic offers.
Trade domain refactoring to allow for atomic trades.