@@ -40,48 +40,53 @@ protected void run() {
40
40
// check connection
41
41
trade .verifyDaemonConnection ();
42
42
43
- // handle first time preparation
44
- if (trade .getArbitrator (). getPaymentReceivedMessage () == null ) {
43
+ // process payout tx if unpublished
44
+ if (! trade .isPayoutPublished () ) {
45
45
46
- // synchronize on lock for wallet operations
47
- synchronized (trade .getWalletLock ()) {
48
- synchronized (HavenoUtils .getWalletFunctionLock ()) {
46
+ // handle first time preparation
47
+ if (trade .getArbitrator ().getPaymentReceivedMessage () == null ) {
49
48
50
- // import multisig hex unless already signed
51
- if (trade .getPayoutTxHex () == null ) {
52
- trade .importMultisigHex ();
53
- }
49
+ // synchronize on lock for wallet operations
50
+ synchronized (trade .getWalletLock ()) {
51
+ synchronized (HavenoUtils .getWalletFunctionLock ()) {
52
+
53
+ // import multisig hex unless already signed
54
+ if (trade .getPayoutTxHex () == null ) {
55
+ trade .importMultisigHex ();
56
+ }
54
57
55
- // verify, sign, and publish payout tx if given
56
- if (trade .getBuyer ().getPaymentSentMessage ().getPayoutTxHex () != null && !trade .getProcessModel ().isPaymentSentPayoutTxStale ()) {
57
- try {
58
- if (trade .getPayoutTxHex () == null ) {
59
- log .info ("Seller verifying, signing, and publishing payout tx for trade {}" , trade .getId ());
60
- trade .processPayoutTx (trade .getBuyer ().getPaymentSentMessage ().getPayoutTxHex (), true , true );
61
- } else {
62
- log .warn ("Seller publishing previously signed payout tx for trade {}" , trade .getId ());
63
- trade .processPayoutTx (trade .getPayoutTxHex (), false , true );
58
+ // verify, sign, and publish payout tx if given
59
+ if (trade .getBuyer ().getPaymentSentMessage ().getPayoutTxHex () != null && !trade .getProcessModel ().isPaymentSentPayoutTxStale ()) {
60
+ try {
61
+ if (trade .getPayoutTxHex () == null ) {
62
+ log .info ("Seller verifying, signing, and publishing payout tx for trade {}" , trade .getId ());
63
+ if (true ) throw new IllegalArgumentException ("Actually lets create the transaction anew" );
64
+ trade .processPayoutTx (trade .getBuyer ().getPaymentSentMessage ().getPayoutTxHex (), true , true );
65
+ } else {
66
+ log .warn ("Seller publishing previously signed payout tx for trade {}" , trade .getId ());
67
+ trade .processPayoutTx (trade .getPayoutTxHex (), false , true );
68
+ }
69
+ } catch (IllegalArgumentException | IllegalStateException e ) {
70
+ log .warn ("Illegal state or argument verifying, signing, and publishing payout tx for {} {}. Creating new unsigned payout tx. error={}. " , trade .getClass ().getSimpleName (), trade .getId (), e .getMessage (), e );
71
+ createUnsignedPayoutTx ();
72
+ } catch (Exception e ) {
73
+ log .warn ("Error verifying, signing, and publishing payout tx for trade {}: {}" , trade .getId (), e .getMessage (), e );
74
+ throw e ;
64
75
}
65
- } catch (IllegalArgumentException | IllegalStateException e ) {
66
- log .warn ("Illegal state or argument verifying, signing, and publishing payout tx for {} {}. Creating new unsigned payout tx. error={}. " , trade .getClass ().getSimpleName (), trade .getId (), e .getMessage (), e );
76
+ }
77
+
78
+ // otherwise create unsigned payout tx
79
+ else if (trade .getSelf ().getUnsignedPayoutTxHex () == null ) {
67
80
createUnsignedPayoutTx ();
68
- } catch (Exception e ) {
69
- log .warn ("Error verifying, signing, and publishing payout tx for trade {}: {}" , trade .getId (), e .getMessage (), e );
70
- throw e ;
71
81
}
72
82
}
73
-
74
- // otherwise create unsigned payout tx
75
- else if (trade .getSelf ().getUnsignedPayoutTxHex () == null ) {
76
- createUnsignedPayoutTx ();
77
- }
78
83
}
79
- }
80
- } else if (trade .getArbitrator ().getPaymentReceivedMessage ().getSignedPayoutTxHex () != null && !trade .isPayoutPublished ()) {
84
+ } else if (trade .getArbitrator ().getPaymentReceivedMessage ().getSignedPayoutTxHex () != null ) {
81
85
82
- // republish payout tx from previous message
83
- log .info ("Seller re-verifying and publishing signed payout tx for trade {}" , trade .getId ());
84
- trade .processPayoutTx (trade .getArbitrator ().getPaymentReceivedMessage ().getSignedPayoutTxHex (), false , true );
86
+ // republish payout tx from previous message
87
+ log .info ("Seller re-verifying and publishing signed payout tx for trade {}" , trade .getId ());
88
+ trade .processPayoutTx (trade .getArbitrator ().getPaymentReceivedMessage ().getSignedPayoutTxHex (), false , true );
89
+ }
85
90
}
86
91
87
92
// close open disputes
0 commit comments