Skip to content

Commit 7984e95

Browse files
authored
Merge pull request #6 from stellar-sharpy/fix/storage-ttl-extension
fix: extend storage TTL on every invoice save
2 parents cdc648d + 7467aee commit 7984e95

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Rust
22
target
3-
sharpy
4-
test_snapshots//
3+
/sharpy
4+
test_snapshots/
55
Cargo.lock
66
*.rlib
77
*.so

contracts/sharpy/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ fn load_invoice(env: &Env, id: u64) -> Invoice {
4343

4444
fn save_invoice(env: &Env, id: u64, invoice: &Invoice) {
4545
env.storage().persistent().set(&invoice_key(id), invoice);
46+
// Extend TTL to ~1 year (in ledgers at ~5s each: 365*24*3600/5 = 6_307_200)
47+
env.storage().persistent().extend_ttl(&invoice_key(id), 100_000, 6_307_200);
4648
}
4749

4850
fn append_audit(env: &Env, id: u64, action: Symbol, actor: &Address) {

0 commit comments

Comments
 (0)