From d14fad500b975c125039aa3258b8586f9c582fc2 Mon Sep 17 00:00:00 2001 From: ryanRfox Date: Thu, 6 Sep 2018 16:42:59 -0400 Subject: [PATCH] Fixup: API and Operations --- bsip-0044.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/bsip-0044.md b/bsip-0044.md index 6f30e4f..e9beda7 100644 --- a/bsip-0044.md +++ b/bsip-0044.md @@ -223,9 +223,9 @@ transaction_obj htlc_redeem(fee_paying_account, id, preimage, htlc_redemption_fe Validate: transaction signed by requisite `authority` for `fee_paying_account` // any account may attempt to redeem Get: get_htlc(id) Validate: `fee_paying_account` account has requisite `quantity` of BTS for `htlc_redeem_fee` and `htlc_kb_fee` + Update: balance of `fee_paying_account` based on total fees // Evaluate: timelock if now() < `timeout_threshold` then return error // "timeout exceeded" - Update: balance of `fee_paying_account` based on total fees // Evaluate: hashlock if length(preimage) != `id.preimage_length` then return error // "preimage length mismatch" Calculate: `preimage_hash` = hash(preimage) @@ -234,6 +234,8 @@ transaction_obj htlc_redeem(fee_paying_account, id, preimage, htlc_redemption_fe Add: transaction to mempool Set: `id.preimage_tx_id` = `transaction_id` Cleanup: memory allocated to this htlc + Virtual Operation: Update account history for `depositor` to reflect redemption as by default the above operation will only appear for `redeemer` + return: results ``` @@ -241,7 +243,7 @@ transaction_obj htlc_redeem(fee_paying_account, id, preimage, htlc_redemption_fe ``` transaction_obj htlc_extend_expiry(depositor, id, timeout_threshold, htlc_extention_fee) - Validate: transaction signed by requisite `authority` for `depositor` account + Validate: 'depositor' = get_htlc(id).depositor Validate: `timeout_threshold` < now() + GRAPHENE_HTLC_MAXIMUM_DURRATION Calculate: `required_fee` = GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days) Validate: `depositor` account has requisite `quantity` of BTS for `required_fee` @@ -250,9 +252,16 @@ transaction_obj htlc_extend_expiry(depositor, id, timeout_threshold, htlc_extent return results ``` -## **APIs** +### **At Expiry** -### **get_htlc** +``` + Get: get_htlc(id) + Update: balance of `depositor` add asset `id.symbol` of quantity `id.quantity` + Cleanup: memory allocated to this htlc + Virtual Operation: Update account history for `depositor` to reflect expiry without redemption. +``` + +## **cli_wallet APIs** ### **htlc_prepare** @@ -260,6 +269,10 @@ transaction_obj htlc_extend_expiry(depositor, id, timeout_threshold, htlc_extent ### **htlc_extend_expiry** +## **witness_node APIs** + +### **get_htlc** + # **Discussion** https://github.com/bitshares/bsips/pull/104 @@ -274,4 +287,4 @@ This document is placed in the public domain. # **See Also** -A description of [Hashed Timelock Contracts](https://en.bitcoinwiki.org/wiki/Hashed_Timelock_Contracts) +A description of [Hashed Timelock Contracts](https://en.bitcoinwiki.org/wiki/Hashed_Timelock_Contracts) \ No newline at end of file