-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add spv_refundhtlcall #686
Conversation
// Sort by Bitcoin address | ||
std::sort(htlcTransactions.begin(), htlcTransactions.end(), [](const std::pair<BRTransaction*, size_t>& lhs, const std::pair<BRTransaction*, size_t>& rhs){ | ||
return strcmp(lhs.first->outputs[lhs.second].address, rhs.first->outputs[rhs.second].address) < 0; | ||
}); | ||
|
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.
Why sorting? And why not in BRListHTLCReceived
?
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.
Will still need to be sorted in BRListHTLCReceived in the same way. I was thinking of adding later an option for the user to specify sort order, like TXID, time, address and so on. I could have used all three in testing but address order sufficed.
src/spv/spv_rpc.cpp
Outdated
CWallet* const pwallet = GetWallet(request); | ||
|
||
RPCHelpMan{"spv_refundhtlcall", | ||
"\nGets all HTLC contracts stored in wallet and creates refunds transactions for a that have expired\n", |
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.
The help message reads not correct.
* Add spv_refundhtlcall * sendmessage only populated on failure * sendmessage only populated on error * Set block heights in test to meet refund requirement * Fix lints * Update help test Co-authored-by: Prasanna Loganathar <[email protected]>
* Add spv_refundhtlcall * sendmessage only populated on failure * sendmessage only populated on error * Set block heights in test to meet refund requirement * Fix lints * Update help test Co-authored-by: Prasanna Loganathar <[email protected]>
* Add spv_refundhtlcall * sendmessage only populated on failure * sendmessage only populated on error * Set block heights in test to meet refund requirement * Fix lints * Update help test Co-authored-by: Prasanna Loganathar <[email protected]>
* Add spv_refundhtlcall * sendmessage only populated on failure * sendmessage only populated on error * Set block heights in test to meet refund requirement * Fix lints * Update help test Co-authored-by: Prasanna Loganathar <[email protected]>
Adds a call to refund all HTLCs in the wallet for which the correct private key is known and has enough confirmations.
Fixes issue where only one HTLC output in a TX could be seen or spent.
Fixes issue where HTLC refund will try to spend output without the required confirmations.
Only shows sendmessage RPC response text when there's an error on send, otherwise this will always display that an unknown error has occured.