Fixup: API and Operations
This commit is contained in:
parent
492851edfc
commit
d14fad500b
1 changed files with 18 additions and 5 deletions
23
bsip-0044.md
23
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
|
Validate: transaction signed by requisite `authority` for `fee_paying_account` // any account may attempt to redeem
|
||||||
Get: get_htlc(id)
|
Get: get_htlc(id)
|
||||||
Validate: `fee_paying_account` account has requisite `quantity` of BTS for `htlc_redeem_fee` and `htlc_kb_fee`
|
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
|
// Evaluate: timelock
|
||||||
if now() < `timeout_threshold` then return error // "timeout exceeded"
|
if now() < `timeout_threshold` then return error // "timeout exceeded"
|
||||||
Update: balance of `fee_paying_account` based on total fees
|
|
||||||
// Evaluate: hashlock
|
// Evaluate: hashlock
|
||||||
if length(preimage) != `id.preimage_length` then return error // "preimage length mismatch"
|
if length(preimage) != `id.preimage_length` then return error // "preimage length mismatch"
|
||||||
Calculate: `preimage_hash` = hash(preimage)
|
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
|
Add: transaction to mempool
|
||||||
Set: `id.preimage_tx_id` = `transaction_id`
|
Set: `id.preimage_tx_id` = `transaction_id`
|
||||||
Cleanup: memory allocated to this htlc
|
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
|
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)
|
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
|
Validate: `timeout_threshold` < now() + GRAPHENE_HTLC_MAXIMUM_DURRATION
|
||||||
Calculate: `required_fee` = GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days)
|
Calculate: `required_fee` = GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days)
|
||||||
Validate: `depositor` account has requisite `quantity` of BTS for `required_fee`
|
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
|
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**
|
### **htlc_prepare**
|
||||||
|
|
||||||
|
@ -260,6 +269,10 @@ transaction_obj htlc_extend_expiry(depositor, id, timeout_threshold, htlc_extent
|
||||||
|
|
||||||
### **htlc_extend_expiry**
|
### **htlc_extend_expiry**
|
||||||
|
|
||||||
|
## **witness_node APIs**
|
||||||
|
|
||||||
|
### **get_htlc**
|
||||||
|
|
||||||
# **Discussion**
|
# **Discussion**
|
||||||
|
|
||||||
https://github.com/bitshares/bsips/pull/104
|
https://github.com/bitshares/bsips/pull/104
|
||||||
|
@ -274,4 +287,4 @@ This document is placed in the public domain.
|
||||||
|
|
||||||
# **See Also**
|
# **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)
|
Loading…
Reference in a new issue