Add preset lock condition "refund after one week" on transfer form
On the transfer form, add a selector to choose between preset lock conditions:
- Receiver signature (default)
- Receiver signature (or issuer after one week)
Receiver signature (default)
Add the basic condition of the receiver signature:
SIG(receiver)
Receiver signature (or issuer after one week)
The receiver can always spend the transaction, but the sender can spend it too after one week. It is useful if the receiver account is not accessible (credentials lost, error in public key, etc).
Add this script to tx output condition :
SIG(receiver) || (SIG(sender) && CSV(604800))
tx history
- Display with underline tx with special condition that we can spend
- Add action "Send as source" in context menu on tx with special condition that are in sources
- Add action "Send as source" in context menu on all tx and dividend in sources (only expert mode)
transfer window
- Display source tx identifier and noffset if send from source
- Display button to check condition lock errors ,disabled if condition unlocked
Code
We need to have two recursive functions on condition grammar objects:
- find_signature_in_condition(Condition, pubkey): to add source only if condition is spendable
- evaluate_condition(): to check if condition script succeed