<h3>Description</h3>
<p>Null pointer exception with ProcessPeerPublishedDelayedPayoutTxMessage when buyer initiates payment and then opens a dispute.</p>
<h4>Version</h4>
<p>release/v1.2.0 branch (commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/bisq-network/bisq/commit/05135a500001131cb6aa85360b3d89fc300b3e71/hovercard" href="https://github.com/bisq-network/bisq/commit/05135a500001131cb6aa85360b3d89fc300b3e71"><tt>05135a5</tt></a>)</p>
<h3>Steps to reproduce</h3>
<p>I ran into this issue while testing <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="512287161" data-permission-text="Issue title is private" data-url="https://github.com/bisq-network/bisq/issues/3464" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/3464/hovercard" href="https://github.com/bisq-network/bisq/pull/3464">#3464</a>, so the first few steps are identical to that issue.</p>
<p>Preconditions:</p>
<ul>
<li>Start with a fresh regtest environment (using the dao-setup.zip file)</li>
<li>Adjust the delay in MakerSetsLockTime to only 5 blocks to make testing easier</li>
<li>Change RECIPIENT_BTC_ADDRESS to an address of your local regtest Bitcoin Core node</li>
</ul>
<p>Steps:</p>
<ol>
<li>Alice creates a buy offer and Bob takes the offer (do not initiate payment).</li>
<li>Generate blocks until exceeding the timelock delay period.</li>
<li>Restart Bob's client.</li>
<li>Alice initiates payment and then opens a dispute.</li>
<li>Mediator closes both tickets (seller gets trade amount).</li>
<li>Bob clicks on the trade but the mediation result popup doesn't appear. In his log:</li>
</ol>
<pre><code>Oct-25 15:37:59.800 [JavaFX Application Thread] ERROR b.d.m.p.p.TradeSubView: Creating viewClass class bisq.desktop.main.portfolio.pendingtrades.steps.seller.SellerStep3View caused an error trade.getDelayedPayoutTx() must not be null at openMediationResultPopup 
java.lang.NullPointerException: trade.getDelayedPayoutTx() must not be null at openMediationResultPopup
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.openMediationResultPopup(TradeStepView.java:533)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.updateMediationResultState(TradeStepView.java:482)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.updateDisputeState(TradeStepView.java:427)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.lambda$registerSubscriptions$4(TradeStepView.java:214)
        at org.fxmisc.easybind.EasyBind.subscribe(EasyBind.java:262)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.registerSubscriptions(TradeStepView.java:212)
        at bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView.activate(TradeStepView.java:189)
        at bisq.desktop.main.portfolio.pendingtrades.steps.seller.SellerStep3View.activate(SellerStep3View.java:87)
        at bisq.desktop.main.portfolio.pendingtrades.TradeSubView.createAndAddTradeStepView(TradeSubView.java:147)
        at bisq.desktop.main.portfolio.pendingtrades.TradeSubView.showItem(TradeSubView.java:112)
        at bisq.desktop.main.portfolio.pendingtrades.SellerSubView.onViewStateChanged(SellerSubView.java:98)
        at org.fxmisc.easybind.EasyBind.subscribe(EasyBind.java:262)
        at bisq.desktop.main.portfolio.pendingtrades.SellerSubView.activate(SellerSubView.java:49)
        at bisq.desktop.main.portfolio.pendingtrades.PendingTradesView.lambda$activate$8(PendingTradesView.java:281)
        at org.fxmisc.easybind.EasyBind.subscribe(EasyBind.java:262)
        at bisq.desktop.main.portfolio.pendingtrades.PendingTradesView.activate(PendingTradesView.java:256)
        at bisq.desktop.common.view.ActivatableViewAndModel.lambda$prepareInitialize$0(ActivatableViewAndModel.java:43)
        at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
        at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
        at javafx.base/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:74)
        at javafx.base/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102)
        at javafx.graphics/javafx.scene.Node$ReadOnlyObjectWrapperManualFire.fireSuperValueChangedEvent(Node.java:1054)
        at javafx.graphics/javafx.scene.Node.invalidatedScenes(Node.java:1114)
        at javafx.graphics/javafx.scene.Node.setScenes(Node.java:1152)
        at javafx.graphics/javafx.scene.Parent.scenesChanged(Parent.java:776)
        at javafx.graphics/javafx.scene.Node.invalidatedScenes(Node.java:1076)
        at javafx.graphics/javafx.scene.Node.setScenes(Node.java:1152)
        at javafx.graphics/javafx.scene.Parent.scenesChanged(Parent.java:776)
        at javafx.graphics/javafx.scene.Node.invalidatedScenes(Node.java:1076)
        at javafx.graphics/javafx.scene.Node.setScenes(Node.java:1152)
        at javafx.graphics/javafx.scene.Parent.scenesChanged(Parent.java:776)
        at javafx.graphics/javafx.scene.Node.invalidatedScenes(Node.java:1076)
        at javafx.graphics/javafx.scene.Node.setScenes(Node.java:1152)
        at javafx.graphics/javafx.scene.Parent.scenesChanged(Parent.java:776)
        at javafx.graphics/javafx.scene.Node.invalidatedScenes(Node.java:1076)
        at javafx.graphics/javafx.scene.Node.setScenes(Node.java:1152)
        at javafx.graphics/javafx.scene.Parent$2.onChanged(Parent.java:376)
        at javafx.base/com.sun.javafx.collections.TrackableObservableList.lambda$new$0(TrackableObservableList.java:45)
        at javafx.base/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
        at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
        at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
        at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
        at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
        at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
        at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:90)
        at javafx.base/com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:116)
        at javafx.base/com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:108)
        at bisq.desktop.main.MainView.lambda$initialize$7(MainView.java:379)
        at bisq.desktop.Navigation.lambda$navigateTo$1(Navigation.java:140)
        at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:804)
        at java.base/java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:425)
        at bisq.desktop.Navigation.navigateTo(Navigation.java:140)
        at bisq.desktop.Navigation.navigateTo(Navigation.java:104)
        at bisq.desktop.main.MainView$NavButton.lambda$new$1(MainView.java:827)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
        at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
        at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8865)
        at javafx.controls/javafx.scene.control.ToggleButton.fire(ToggleButton.java:257)
        at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
        at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
        at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
        at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3876)
        at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Scene.java:3604)
        at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
        at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2613)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
        at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
        at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
        at java.base/java.lang.Thread.run(Thread.java:844)
</code></pre>
<ol start="7">
<li>Alice clicks on the trade and the mediation result popup appears for her.</li>
<li>Alice rejects mediators suggestion and payout is made to the donation address. No error message is shown to Alice, but in her log:</li>
</ol>
<pre><code>Oct-25 15:41:08.286 [JavaFX Application Thread] WARN b.c.t.protocol.TradeProtocol: Received AckMessage with error state for PeerPublishedDelayedPayoutTxMessage from localhost:7777 with tradeId 194360-e675db7a-c5be-465d-b45f-7924366bfc74-120 and errorMessage=An error occurred at task: ProcessPeerPublishedDelayedPayoutTxMessage
Exception: java.lang.NullPointerException 
</code></pre>
<p>Bob is presented with an error:<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/603793/67609210-78e8c880-f740-11e9-982c-a46df98cbc87.png"><img src="https://user-images.githubusercontent.com/603793/67609210-78e8c880-f740-11e9-982c-a46df98cbc87.png" alt="image" style="max-width:100%;"></a></p>
<p>And in his log:</p>
<pre><code>Oct-25 00:27:20.655 [JavaFX Application Thread] INFO b.common.taskrunner.TaskRunner: Run task: ProcessPeerPublishedDelayedPayoutTxMessage 
java.lang.NullPointerException
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
        at bisq.core.trade.protocol.tasks.ProcessPeerPublishedDelayedPayoutTxMessage.run(ProcessPeerPublishedDelayedPayoutTxMessage.java:54)
        at bisq.common.taskrunner.TaskRunner.next(TaskRunner.java:69)
        at bisq.common.taskrunner.TaskRunner.run(TaskRunner.java:60)
        at bisq.core.trade.protocol.TradeProtocol.handle(TradeProtocol.java:228)
        at bisq.core.trade.protocol.TradeProtocol.doHandleDecryptedMessage(TradeProtocol.java:242)
        at bisq.core.trade.protocol.SellerAsTakerProtocol.doHandleDecryptedMessage(SellerAsTakerProtocol.java:252)
        at bisq.core.trade.protocol.TradeProtocol.lambda$new$0(TradeProtocol.java:91)
        at bisq.network.p2p.P2PService.lambda$onMessage$8(P2PService.java:412)
        at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:804)
        at java.base/java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:425)
        at bisq.network.p2p.P2PService.onMessage(P2PService.java:411)
        at bisq.network.p2p.network.NetworkNode.lambda$onMessage$4(NetworkNode.java:357)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at bisq.network.p2p.network.NetworkNode.onMessage(NetworkNode.java:357)
        at bisq.network.p2p.network.Connection.lambda$onMessage$5(Connection.java:429)
        at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:804)
        at java.base/java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:425)
        at bisq.network.p2p.network.Connection.lambda$onMessage$6(Connection.java:429)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
        at java.base/java.lang.Thread.run(Thread.java:844)
</code></pre>
<h4>Device or machine</h4>
<p>Windows 10</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/issues/3473?email_source=notifications&email_token=AJFFTNVDCVCW4JQUTVGL4HLQQN3XHA5CNFSM4JFKOGEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUP7YXA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNXI5REUBCFAA5TR72TQQN3XHANCNFSM4JFKOGEA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUUXTKWTWTXQKEWB6DQQN3XHA5CNFSM4JFKOGEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUP7YXA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/issues/3473?email_source=notifications\u0026email_token=AJFFTNVDCVCW4JQUTVGL4HLQQN3XHA5CNFSM4JFKOGEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUP7YXA",
"url": "https://github.com/bisq-network/bisq/issues/3473?email_source=notifications\u0026email_token=AJFFTNVDCVCW4JQUTVGL4HLQQN3XHA5CNFSM4JFKOGEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUP7YXA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>