<p>We can cache an offer payload hash as soon as its <code>offerFeePaymentTxId</code>is set.  (The payload hash cannot be calculated until the object can be transformed into a protobuf message, which requires a non-null <code>offerFeePaymentTxId</code>.)</p>
<p>Another benefit is removal of the payload hash argument from the<code>OfferBookListItem</code> constructor.</p>
<p>Changes include</p>
<ul>
<li>
<p><code>OfferPayload</code> Added <code>transient byte[] hash</code> field + getter method (where hash is calculated and cached).</p>
</li>
<li>
<p><code>OfferBookService</code> Removed <code>P2PDataStorage.ByteArray hashOfPayload</code> parameter from <code>OfferBookChangedListener</code> listener methods <code>onAdded</code> & <code>onRemoved</code>.  (Hash is cached in <code>OfferPayload</code>.)</p>
</li>
<li>
<p><code>P2PDataStorage</code> Added null check to <code>ByteArray</code> class constructor.</p>
</li>
<li>
<p><code>OfferBook</code> Adjusted for change to <code>OfferBookChangedListener</code>, and removed redundant payload hash null checks.</p>
</li>
<li>
<p><code>TakeOfferDataModel</code> and <code>MarketAlerts</code> Adjusted for change to <code>OfferBookChangedListener</code>.</p>
</li>
<li>
<p><code>OfferBookListItem</code> Removed overloaded constructor with <code>@Nullable P2PDataStorage.ByteArray hashOfPayload</code> parameter.  (Field value is set from cached offer payload hash.)</p>
</li>
<li>
<p><code>OfferBookViewModelTest</code> and <code>OfferMaker</code>  Adjusted test and test fixture:  do not attempt to create offer payloads without an <code>offerFeePaymentTxId</code>.</p>
</li>
</ul>
<p><em>Follow up to the <a href="https://github.com/bisq-network/bisq/pull/5666" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/5666/hovercard">last PR in series</a>  to support API <code>editoffer</code> method.</em></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/5682'>https://github.com/bisq-network/bisq/pull/5682</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Reduce # of hash calculations in UI OfferBook view</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-0627a2f42073fe18d535206646c77be244e8965a0ee0ef0cb8b15acd5d2effe8">core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-84757b6093f3f1709fd2066f843d0342f0ebbf6d8ec0f5406fd6f6282f42042e">core/src/main/java/bisq/core/offer/OfferBookService.java</a>
    (17)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-0e130456e5fb2313c463d48b2112d64f0c71544eb136dfd2069f78daa405e032">core/src/main/java/bisq/core/offer/OfferPayload.java</a>
    (26)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-7d6cae9fee25a6cf61af1d755dba63c84d60e50c77c18a276c2618983a36310a">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java</a>
    (47)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-140495eef332912128cac981479058838937d7fcabef4498f9fffd08d1e2df39">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookListItem.java</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-e91ddc497f0b94a9a80cc234cbdcedaf05e8f40e6e1d5fc7e9c9794f97063495">desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-407e9498f14aced7e424484c01868c0286e2c89ec5eda72b213da81baa1efae1">desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-1eb1e71843154131009b180aece13a2cb3ed9b4ade9ea8ccfe57ccf9ae27b682">desktop/src/test/java/bisq/desktop/maker/OfferMaker.java</a>
    (112)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5682/files#diff-45fc34501c30dffd0b312454da94f2dd0c9df7b8135a4a5019606372c82c3959">p2p/src/main/java/bisq/network/p2p/storage/P2PDataStorage.java</a>
    (18)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/5682.patch'>https://github.com/bisq-network/bisq/pull/5682.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/5682.diff'>https://github.com/bisq-network/bisq/pull/5682.diff</a></li>
</ul>

<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/pull/5682">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVEPA4V6BH2AUZJ2K3T7ZZWJANCNFSM5DHEQPJA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AJFFTNTHDQQLBZQO7BGQLLTT7ZZWJA5CNFSM5DHEQPJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4OV5XN3Q.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/pull/5682",
"url": "https://github.com/bisq-network/bisq/pull/5682",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>