Browse Source
367: Remove pending roll over proposal upon rejection r=da-kami a=da-kami
fixes #359
too me a bit to figure out how easy the fix is 😅
Co-authored-by: Daniel Karzel <daniel@comit.network>
debug-statements
bors[bot]
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
9 deletions
daemon/src/maker_cfd.rs
daemon/src/taker_cfd.rs
@ -73,9 +73,6 @@ pub struct Actor<O, M, T> {
oracle_actor : Address < O > ,
// Maker needs to also store TakerId to be able to send a reply back
current_pending_proposals : HashMap < OrderId , ( UpdateCfdProposal , TakerId ) > ,
// TODO: Persist instead of using an in-memory hashmap for resiliency?
// (not a huge deal, as in the worst case taker will fall back to
// noncollaborative settlement)
current_agreed_proposals : HashMap < OrderId , ( SettlementProposal , TakerId ) > ,
}
@ -746,8 +743,6 @@ where
let dlc = cfd . open_dlc ( ) . context ( "CFD was in wrong state" ) ? ;
// TODO: do we want to store in the db that we rolled over?
let oracle_event_id =
oracle ::next_announcement_after ( time ::OffsetDateTime ::now_utc ( ) + Order ::TERM ) ? ;
let announcement = self
@ -222,11 +222,10 @@ impl<O, M> Actor<O, M> {
}
async fn handle_roll_over_rejected ( & mut self , order_id : OrderId ) -> Result < ( ) > {
tracing ::debug ! ( % order_id , "Roll over request rejected" ) ;
// TODO: tell UI that roll over was rejected
tracing ::info ! ( % order_id , "Roll over proposal got rejected" ) ;
// this is not too bad as we are still monitoring for the CFD to expiry
// the taker can just try to ask again :)
self . remove_pending_proposal ( & order_id )
. context ( "rejected settlement" ) ? ;
Ok ( ( ) )
}