roke-to / roketo-contract

The Unlicense
4 stars 1 forks source link

Streaming: update total_incoming in process_change_receiver #22

Closed Kouprin closed 2 years ago

Kouprin commented 2 years ago

Account’s total_incoming is not properly handled.

When changing the stream receiver, both prev_receiver's total_incoming and the new_receiver's total_incoming are not updated in function process_change_receiver.

streaming/src/stream_ops.rs #Line 385-454

   let mut prev_receiver = self.extract_account(prev_receiver_id)?;

   assert!(prev_receiver.active_incoming_streams.remove(&stream_id));
   assert!(new_receiver.active_incoming_streams.insert(&stream_id));

   self.save_account(prev_receiver)?;
   self.save_account(new_receiver)?;

   stream.receiver_id = new_receiver_id;
   self.save_stream(stream)?;
   Ok(promises)
Kouprin commented 2 years ago

Fixed in 2d5f4647ef7dddaf311dc0e769705180a6420c18