-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds custom transaction funding by note hash (#3830)
* adds custom transaction funding by note hash supporting custom transaction funding will allow users and developers to choose the notes to spend in a transaction using whatever note selection algorithm they choose. adds optional 'spendNoteHashes' parameter to 'wallet/createTransaction' rpc endpoint to accept a list of hex string note hashes to use to fund a transaction. implements 'fundWithNoteHashes' to load decrypted notes from the specified hashes and use them to build the spends for a raw transaction. ensures that the specified notes have enough value to fund the transaction. requires that notes have an index so that a witness can be created. does not check whether the notes have already been spent. this is intentional to support use cases like 'canceling' or 'speeding up' a transaction by creating a transaction that spends the same notes but offers a higher fee. adds unit tests for wallet and rpc transaction creation methods. * adds error messages to assertions in 'fundFromNoteHashes' * supports partial funding from notes passed to createTransaction if the notes passed to createTransaction do not cover the amount needed, the wallet will fund the rest of the transaction using available unspent notes. refactors fund to optionally take a list of notes. renames 'createSpendsForAsset' to 'addSpendsForAsset' and modifies to take a set of notes already spent and an amount already spent. removes unneeded code: 'checkNoteSpentOnChainAndRepair', 'createSpends' renames 'spendNoteHashes' to 'notes' in RPC and createTransaction method * iterate over amounts needed map entries instead of keys avoid defaulting to 0 if the key is missing. * defaults notes to [] in fund, unindents
- Loading branch information
Showing
6 changed files
with
677 additions
and
343 deletions.
There are no files selected for viewing
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
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
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
Oops, something went wrong.