Skip to content

Commit

Permalink
v. 0.14.4.5. Fix issue: Transaction.updatedAt is not set at new block #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Jan 26, 2018
1 parent 63c9a91 commit 0967942
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.14.4.4</version>
<version>0.14.4.5</version>
</parent>

<artifactId>bitcoinj-core</artifactId>
Expand Down
11 changes: 9 additions & 2 deletions core/src/main/java/org/bitcoinj/core/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* Whether to trust a transaction is something that needs to be decided on a case by case basis - a rule that makes
* sense for selling MP3s might not make sense for selling cars, or accepting payments from a family member. If you
* are building a wallet, how to present confidence to your users is something to consider carefully.</p>
*
*
* <p>Instances of this class are not safe for use by multiple threads.</p>
*/
public class Transaction extends ChildMessage {
Expand Down Expand Up @@ -323,7 +323,14 @@ public boolean isPending() {
*/
public void setBlockAppearance(StoredBlock block, boolean bestChain, int relativityOffset) {
long blockTime = block.getHeader().getTimeSeconds() * 1000;
if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) {

/* if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) {
updatedAt = new Date(blockTime);
}*/
// We removed for the checks to not overwrite updatedAt in cases for re-orgs.
// updatedAt is set by wallet.commit and thus the new block would never set the value.
// If there is a re-org the best block is called last as stated in the doc above so the values will be correct.
if (bestChain) {
updatedAt = new Date(blockTime);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.14.4.4</version>
<version>0.14.4.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.14.4.4</version>
<version>0.14.4.5</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.14.4.4</version>
<version>0.14.4.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion wallettemplate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.14.4.4</version>
<version>0.14.4.5</version>
</parent>

<artifactId>wallettemplate</artifactId>
Expand Down

0 comments on commit 0967942

Please sign in to comment.