-
-
Notifications
You must be signed in to change notification settings - Fork 1
Create collateralization with p2 parent #28
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
Conversation
| let p2_parent_hash = P2ParentCoin::inner_puzzle_hash(Some(DIG_COIN_ASSET_ID)); | ||
| let p2_parent_puzzle_hash = P2ParentCoin::puzzle_hash(Some(DIG_COIN_ASSET_ID)); | ||
|
|
||
| let mut ctx = SpendContext::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have Vec, don't you already have a ctx? If so, pass it to the function (ctx: &mut SpendContext) to avoid weird allocator errors. You can then return Result<(), WalletError> and just keep the spends in the context (you'd call ctx.take() when you need it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, in the current use case for this function, the calling function does not have a ctx. My plan here is to have the driver encapsulate the logic to create the coin spends then return them to the caller. in this case the caller will create, sign and broadcast the spend bundle,
src/wallet.rs
Outdated
|
|
||
| pub async fn prove_dig_cat_coin( | ||
| peer: &Peer, | ||
| allocator: &mut Allocator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be possible to take a ctx: &mut SpendContext here? SpendContext is essentially Allocator + a lot of utilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can make that change but, this function isn't actually specifically for use when spending. I use it for that, but i also use it for non-spending purposes, like getting the wallet $DIG balance.
its just a generic utility to answer the question "is this coin a $DIG CAT"
i should probably move the allocator instantiation into the function. that would make more sense
feat: add function for parsing $DIG collateral coin
This PR adds driver functions related to creation, retrieval, and spend of store collateral coins locking $DIG