@@ -32,7 +32,9 @@ impl SCELedgerEntry {
32
32
}
33
33
34
34
// module
35
- self . opt_module = update. update_opt_module . clone ( ) ;
35
+ if let Some ( opt_module) = & update. update_opt_module {
36
+ self . opt_module = opt_module. clone ( ) ;
37
+ }
36
38
37
39
// data
38
40
for ( data_key, data_update) in update. update_data . iter ( ) {
@@ -198,7 +200,7 @@ impl DeserializeCompact for SCELedgerEntry {
198
200
#[ derive( Debug , Clone , Default ) ]
199
201
pub struct SCELedgerEntryUpdate {
200
202
pub update_balance : Option < Amount > ,
201
- pub update_opt_module : Option < Bytecode > ,
203
+ pub update_opt_module : Option < Option < Bytecode > > ,
202
204
pub update_data : HHashMap < Hash , Option < Vec < u8 > > > , // None for row deletion
203
205
}
204
206
@@ -503,7 +505,11 @@ impl SCELedgerStep {
503
505
match changes. 0 . get ( addr) {
504
506
Some ( SCELedgerChange :: Delete ) => return None ,
505
507
Some ( SCELedgerChange :: Set ( new_entry) ) => return new_entry. opt_module . clone ( ) ,
506
- Some ( SCELedgerChange :: Update ( update) ) => return update. update_opt_module . clone ( ) ,
508
+ Some ( SCELedgerChange :: Update ( update) ) => {
509
+ if let Some ( updates_opt_module) = & update. update_opt_module {
510
+ return updates_opt_module. clone ( ) ;
511
+ }
512
+ }
507
513
None => { }
508
514
}
509
515
}
@@ -550,9 +556,9 @@ impl SCELedgerStep {
550
556
. apply_change ( addr, & SCELedgerChange :: Update ( update) ) ;
551
557
}
552
558
553
- pub fn set_module ( & mut self , addr : Address , module : Vec < u8 > ) {
559
+ pub fn set_module ( & mut self , addr : Address , opt_module : Option < Vec < u8 > > ) {
554
560
let update = SCELedgerEntryUpdate {
555
- update_opt_module : Some ( module ) ,
561
+ update_opt_module : Some ( opt_module ) ,
556
562
..Default :: default ( )
557
563
} ;
558
564
self . caused_changes
0 commit comments