@@ -53,16 +53,19 @@ internal override ContractTask OnPersistAsync(ApplicationEngine engine)
53
53
{
54
54
// It's possible that there are previously saved malicious conflict records for this transaction.
55
55
// If so, then remove it and store the relevant transaction itself.
56
- engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , tx . Transaction . Hash ) , ( ) => new StorageItem ( new TransactionState ( ) ) ) . FromReplica ( new StorageItem ( tx ) ) ;
56
+ engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , tx . Transaction . Hash ) , ( ) => new StorageItem ( new TransactionState ( ) ) )
57
+ . FromReplica ( new StorageItem ( tx ) ) ;
57
58
58
59
// Store transaction's conflicits.
59
60
var conflictingSigners = tx . Transaction . Signers . Select ( s => s . Account ) ;
60
61
foreach ( var attr in tx . Transaction . GetAttributes < Conflicts > ( ) )
61
62
{
62
- engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , attr . Hash ) , ( ) => new StorageItem ( new TransactionState ( ) ) ) . FromReplica ( new StorageItem ( new TransactionState ( ) { BlockIndex = engine . PersistingBlock . Index } ) ) ;
63
+ engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , attr . Hash ) , ( ) => new StorageItem ( new TransactionState ( ) ) )
64
+ . FromReplica ( new StorageItem ( new TransactionState ( ) { BlockIndex = engine . PersistingBlock . Index } ) ) ;
63
65
foreach ( var signer in conflictingSigners )
64
66
{
65
- engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , attr . Hash , signer ) , ( ) => new StorageItem ( new TransactionState ( ) ) ) . FromReplica ( new StorageItem ( new TransactionState ( ) { BlockIndex = engine . PersistingBlock . Index } ) ) ;
67
+ engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_Transaction , attr . Hash , signer ) , ( ) => new StorageItem ( new TransactionState ( ) ) )
68
+ . FromReplica ( new StorageItem ( new TransactionState ( ) { BlockIndex = engine . PersistingBlock . Index } ) ) ;
66
69
}
67
70
}
68
71
}
@@ -73,7 +76,9 @@ internal override ContractTask OnPersistAsync(ApplicationEngine engine)
73
76
74
77
internal override ContractTask PostPersistAsync ( ApplicationEngine engine )
75
78
{
76
- HashIndexState state = engine . SnapshotCache . GetAndChange ( _currentBlock , ( ) => new StorageItem ( new HashIndexState ( ) ) ) . GetInteroperable < HashIndexState > ( ) ;
79
+ var state = engine . SnapshotCache . GetAndChange ( _currentBlock , ( ) => new StorageItem ( new HashIndexState ( ) ) )
80
+ // Don't need to seal because the size is fixed and it can't grow
81
+ . GetInteroperable < HashIndexState > ( ) ;
77
82
state . Hash = engine . PersistingBlock . Hash ;
78
83
state . Index = engine . PersistingBlock . Index ;
79
84
return ContractTask . CompletedTask ;
0 commit comments