@@ -138,6 +138,55 @@ suite "Aristo TxFrame":
138138 tx3.kMap.len () == 0
139139 tx2.fetchStateRoot () == tx3.fetchStateRoot ()
140140
141+ test " Frames using moveParentHashKeys parameter with snapshots" :
142+ let
143+ tx0 = db.txFrameBegin (db.baseTxFrame ())
144+ tx1 = db.txFrameBegin (tx0)
145+
146+ check:
147+ tx0.mergeAccountRecord (acc1[0 ], acc1[1 ]).isOk ()
148+ tx1.mergeAccountRecord (acc2[0 ], acc2[1 ]).isOk ()
149+ tx0.fetchStateRoot () != tx1.fetchStateRoot ()
150+ tx0.kMap.len () == 0
151+ tx1.kMap.len () == 1
152+ tx1.checkpoint (1 , skipSnapshot = false )
153+
154+ let tx2 = db.txFrameBegin (tx1, moveParentHashKeys = true )
155+ tx2.checkpoint (2 , skipSnapshot = false )
156+
157+ block :
158+ var hashKey: HashKey
159+ for v in tx2.kMap.values ():
160+ if v.isValid ():
161+ hashKey = v
162+ check hashKey != default (HashKey )
163+ var snapshotContainsHashKey = false
164+ for k, v in tx2.snapshot.vtx:
165+ if v[1 ] == hashKey:
166+ snapshotContainsHashKey = true
167+
168+ check:
169+ snapshotContainsHashKey
170+ tx1.fetchStateRoot () == tx2.fetchStateRoot ()
171+
172+ let tx3 = db.txFrameBegin (tx2, moveParentHashKeys = false )
173+ tx3.checkpoint (3 , skipSnapshot = false )
174+
175+ block :
176+ var hashKey: HashKey
177+ for v in tx2.kMap.values ():
178+ if v.isValid ():
179+ hashKey = v
180+ check hashKey != default (HashKey )
181+ var snapshotContainsHashKey = false
182+ for k, v in tx3.snapshot.vtx:
183+ if v[1 ] == hashKey:
184+ snapshotContainsHashKey = true
185+
186+ check:
187+ snapshotContainsHashKey
188+ tx2.fetchStateRoot () == tx3.fetchStateRoot ()
189+
141190 test " Frames using moveParentHashKeys parameter - moved from persist" :
142191 let
143192 tx0 = db.txFrameBegin (db.baseTxFrame ())
0 commit comments