Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction.updatedAt is not set at new block #1507

Open
ManfredKarrer opened this issue Jan 26, 2018 · 2 comments
Open

Transaction.updatedAt is not set at new block #1507

ManfredKarrer opened this issue Jan 26, 2018 · 2 comments

Comments

@ManfredKarrer
Copy link
Contributor

We need the block time when a tx is confirmed.
The code in Transaction.setBlockAppearance does not set the updatedAt if it was set before.
As Wallet.commit sets the updatedAt the update never happes.

See: https://groups.google.com/d/msg/bitcoinj/05TJbxAwKXs/D6CYV1byAgAJ

See also: bisq-network#11

@schildbach
Copy link
Member

Thanks for the catch! Sounds like an oversight to me. Would you like to propose a fix?

@ManfredKarrer
Copy link
Contributor Author

I am not familiar enough with BitcoinJ to feel comfortable to make a PR. My assumptions are described in the comments but would be great if you could have a look to it to make sure it covers the re-org cases correctly.

Here is what I changed in our fork.

// 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);
}

Here is the current version:
if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) {
updatedAt = new Date(blockTime);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants