Skip to content

Commit 0e7ce7e

Browse files
Fixed storage inconsistency #1176 (#1294)
1 parent 5811ffb commit 0e7ce7e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

docs/build/smart-contracts/getting-started/storing-data.mdx

+3-6
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,12 @@ pub struct IncrementContract;
5353
impl IncrementContract {
5454
/// Increment increments an internal counter, and returns the value.
5555
pub fn increment(env: Env) -> u32 {
56-
let mut count: u32 = env.storage().instance().get(&COUNTER).unwrap_or(0); // If no value set, assume 0.
57-
58-
count += 1;
59-
56+
let mut count: u32 = env.storage().instance().get(&COUNTER).unwrap_or(0);
6057
log!(&env, "count: {}", count);
6158

59+
count += 1;
6260
env.storage().instance().set(&COUNTER, &count);
63-
64-
env.storage().instance().extend_ttl(100, 100);
61+
env.storage().instance().extend_ttl(50, 100);
6562

6663
count
6764
}

0 commit comments

Comments
 (0)