keeper: only add mango acocunt once if self trade

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-12-15 11:24:55 +01:00
parent 309f218c6e
commit a8f3179323
1 changed files with 20 additions and 12 deletions

View File

@ -71,9 +71,9 @@ pub async fn runner(
.collect::<Vec<_>>();
futures::join!(
futures::future::join_all(handles1),
// futures::future::join_all(handles1),
futures::future::join_all(handles2),
futures::future::join_all(handles3),
// futures::future::join_all(handles3),
debugging_handle
);
@ -198,16 +198,24 @@ pub async fn loop_consume_events(
match EventType::try_from(event.event_type)? {
EventType::Fill => {
let fill: &FillEvent = cast_ref(event);
ams_.push(AccountMeta {
pubkey: fill.maker,
is_signer: false,
is_writable: true,
});
ams_.push(AccountMeta {
pubkey: fill.taker,
is_signer: false,
is_writable: true,
});
if fill.maker == fill.taker {
ams_.push(AccountMeta {
pubkey: fill.maker,
is_signer: false,
is_writable: true,
});
} else {
ams_.push(AccountMeta {
pubkey: fill.maker,
is_signer: false,
is_writable: true,
});
ams_.push(AccountMeta {
pubkey: fill.taker,
is_signer: false,
is_writable: true,
});
}
}
EventType::Out => {
let out: &OutEvent = cast_ref(event);