This repository was archived by the owner on Feb 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,8 @@ pub enum ActivityItem {
175175 OnChain ( TransactionDetails ) ,
176176 Lightning ( Box < MutinyInvoice > ) ,
177177 ChannelClosed ( ChannelClosure ) ,
178+ // /// A payjoin proposal is posted to the directory but not yet broadcast from the sender
179+ // PendingPayjoin,
178180}
179181
180182impl ActivityItem {
Original file line number Diff line number Diff line change @@ -334,15 +334,15 @@ impl<S: MutinyStorage> OnChainWallet<S> {
334334
335335 // Outputs may be substituted for e.g. batching at this stage
336336 // We're not doing this yet.
337-
337+ let mut wallet = self
338+ . wallet
339+ . try_write ( )
340+ . map_err ( |_| Error :: Server ( MutinyError :: WalletSigningFailed . into ( ) ) ) ?;
338341 let payjoin_proposal = provisional_payjoin. finalize_proposal (
339342 |psbt : & payjoin:: bitcoin:: psbt:: Psbt | {
340343 // convert from payjoin::bitcoin 30.0
341344 let mut psbt = PartiallySignedTransaction :: from_str ( & psbt. to_string ( ) ) . unwrap ( ) ;
342- let wallet = self
343- . wallet
344- . try_read ( )
345- . map_err ( |_| Error :: Server ( MutinyError :: WalletSigningFailed . into ( ) ) ) ?;
345+
346346 wallet
347347 . sign ( & mut psbt, SignOptions :: default ( ) )
348348 . map_err ( |_| Error :: Server ( MutinyError :: WalletSigningFailed . into ( ) ) ) ?;
@@ -354,6 +354,15 @@ impl<S: MutinyStorage> OnChainWallet<S> {
354354 Some ( payjoin:: bitcoin:: FeeRate :: MIN ) ,
355355 ) ?;
356356 let payjoin_proposal_psbt = payjoin_proposal. psbt ( ) ;
357+ let proposal_psbt_29 =
358+ bitcoin:: psbt:: PartiallySignedTransaction :: from_str ( & payjoin_proposal_psbt. to_string ( ) )
359+ . map_err ( |_| Error :: Server ( MutinyError :: WalletOperationFailed . into ( ) ) ) ?;
360+ wallet
361+ . insert_tx (
362+ proposal_psbt_29. extract_tx ( ) ,
363+ ConfirmationTime :: unconfirmed ( crate :: utils:: now ( ) . as_secs ( ) ) ,
364+ )
365+ . map_err ( |_| Error :: Server ( MutinyError :: WalletOperationFailed . into ( ) ) ) ?;
357366 log:: debug!(
358367 "Receiver's Payjoin proposal PSBT Rsponse: {:#?}" ,
359368 payjoin_proposal_psbt
You can’t perform that action at this time.
0 commit comments