@@ -155,8 +155,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
155155 }
156156 } ) ,
157157 }
158- // these fields are immutable and should not be updated
159- delete symbolToData [ product . metadata . symbol ] . metadata . symbol
158+ // this field is immutable and should not be updated
160159 delete symbolToData [ product . metadata . symbol ] . metadata . price_account
161160 } )
162161 setExistingSymbols ( new Set ( Object . keys ( symbolToData ) ) )
@@ -211,8 +210,8 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
211210 changes [ symbol ] = { new : { } }
212211 changes [ symbol ] . new = { ...fileDataParsed [ symbol ] }
213212 changes [ symbol ] . new . metadata = {
214- ...changes [ symbol ] . new . metadata ,
215213 symbol,
214+ ...changes [ symbol ] . new . metadata ,
216215 }
217216 // these fields are generated deterministically and should not be updated
218217 delete changes [ symbol ] . new . address
@@ -448,6 +447,25 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
448447 . instruction ( )
449448 )
450449 }
450+
451+ // If maxLatency is set and is not 0, create update maxLatency instruction
452+ if (
453+ newChanges . priceAccounts [ 0 ] . maxLatency !== undefined &&
454+ newChanges . priceAccounts [ 0 ] . maxLatency !== 0
455+ ) {
456+ instructions . push (
457+ await pythProgramClient . methods
458+ . setMaxLatency (
459+ newChanges . priceAccounts [ 0 ] . maxLatency ,
460+ [ 0 , 0 , 0 ]
461+ )
462+ . accounts ( {
463+ priceAccount : priceAccountKey ,
464+ fundingAccount,
465+ } )
466+ . instruction ( )
467+ )
468+ }
451469 } else if ( ! newChanges ) {
452470 const priceAccount = new PublicKey ( prev . priceAccounts [ 0 ] . address )
453471
0 commit comments