From 6ebcdd5016e45c9a594ed503dbbca4808ce61b5e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Thu, 29 Mar 2018 11:14:47 -0500 Subject: [PATCH] Wallet: Use local variable for blockHeight Cherry pick https://github.com/bisq-network/bitcoinj/commit/f43606fd9298b5f985c4906e4438facd00e48b2f --- core/src/main/java/org/bitcoinj/wallet/Wallet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/wallet/Wallet.java b/core/src/main/java/org/bitcoinj/wallet/Wallet.java index aea2707921c..3ca67caa424 100644 --- a/core/src/main/java/org/bitcoinj/wallet/Wallet.java +++ b/core/src/main/java/org/bitcoinj/wallet/Wallet.java @@ -2107,7 +2107,8 @@ public void notifyNewBestBlock(StoredBlock block) throws VerificationException { try { // Store the new block hash. setLastBlockSeenHash(newBlockHash); - setLastBlockSeenHeight(block.getHeight()); + final int blockHeight = block.getHeight(); + setLastBlockSeenHeight(blockHeight); setLastBlockSeenTimeSecs(block.getHeader().getTimeSeconds()); // Notify all the BUILDING transactions of the new block. // This is so that they can update their depth. @@ -2127,7 +2128,7 @@ public void notifyNewBestBlock(StoredBlock block) throws VerificationException { // included once again. We could have a separate was-in-chain-and-now-isn't confidence type // but this way is backwards compatible with existing software, and the new state probably // wouldn't mean anything different to just remembering peers anyway. - if (confidence.incrementDepthInBlocks(block.getHeight()) > context.getEventHorizon()) + if (confidence.incrementDepthInBlocks(blockHeight) > context.getEventHorizon()) confidence.clearBroadcastBy(); confidenceChanged.put(tx, TransactionConfidence.Listener.ChangeReason.DEPTH); }