Fixup: API and Operations

This commit is contained in:
ryanRfox 2018-09-06 16:42:59 -04:00
parent 492851edfc
commit d14fad500b

View file

@ -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)