Browse Source
Fix commit transaction publication
1. Finalize with correct descriptor (of lock tx)
2. Restart fix: Allow retrieving the commit tx in state `PendingCommit` so we can re-publish in that state.
3. Update cfd feed after state transition to `PendingCommit` to see updated state in UI.
upload-correct-windows-binary
Daniel Karzel
3 years ago
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E
3 changed files with
11 additions and
4 deletions
daemon/src/maker_cfd.rs
daemon/src/model/cfd.rs
daemon/src/taker_cfd.rs
@ -445,6 +445,9 @@ impl Actor {
let new_state = cfd . handle ( CfdStateChangeEvent ::CommitTxSent ) ? ;
insert_new_cfd_state_by_order_id ( cfd . order . id , new_state , & mut conn ) . await ? ;
self . cfd_feed_actor_inbox
. send ( load_all_cfds ( & mut conn ) . await ? ) ? ;
Ok ( ( ) )
}
@ -322,7 +322,7 @@ impl Display for CfdState {
write ! ( f , "Open" )
}
CfdState ::PendingCommit { . . } = > {
write ! ( f , "Pending Committ " )
write ! ( f , "Pending Commit" )
}
CfdState ::OpenCommitted { . . } = > {
write ! ( f , "Open Committed" )
@ -624,8 +624,9 @@ impl Cfd {
}
pub fn commit_tx ( & self ) -> Result < Transaction > {
let dlc = if let CfdState ::Open { dlc , . . } | CfdState ::PendingOpen { dlc , . . } =
self . state . clone ( )
let dlc = if let CfdState ::Open { dlc , . . }
| CfdState ::PendingOpen { dlc , . . }
| CfdState ::PendingCommit { dlc , . . } = self . state . clone ( )
{
dlc
} else {
@ -652,7 +653,7 @@ impl Cfd {
let signed_commit_tx = finalize_spend_transaction (
dlc . commit . 0 ,
& dlc . commit . 2 ,
& dlc . lock . 1 ,
( our_pubkey , our_sig ) ,
( counterparty_pubkey , counterparty_sig ) ,
) ? ;
@ -370,6 +370,9 @@ impl Actor {
let new_state = cfd . handle ( CfdStateChangeEvent ::CommitTxSent ) ? ;
insert_new_cfd_state_by_order_id ( cfd . order . id , new_state , & mut conn ) . await ? ;
self . cfd_feed_actor_inbox
. send ( load_all_cfds ( & mut conn ) . await ? ) ? ;
Ok ( ( ) )
}