Skip to content

Use block time for wallet transactions found in rescan#1159

Closed
sipa wants to merge 1 commit into
bitcoin:masterfrom
sipa:rescantime
Closed

Use block time for wallet transactions found in rescan#1159
sipa wants to merge 1 commit into
bitcoin:masterfrom
sipa:rescantime

Conversation

@sipa

@sipa sipa commented Apr 28, 2012

Copy link
Copy Markdown
Member

Instead of rescan time.

@luke-jr

luke-jr commented Apr 28, 2012

Copy link
Copy Markdown
Member

During normal 24/7 operation, the first-seen time is still used, right?

@sipa

sipa commented Apr 28, 2012

Copy link
Copy Markdown
Member Author

the behaviour with this patch would be: transactions first seen in a "tx" message or self-generated get clock time, transactions first seen in a block or found by rescanning: block time.

@luke-jr

luke-jr commented Apr 28, 2012

Copy link
Copy Markdown
Member

It's problematic if transactions can be "timed" older than the most recent wallet transaction, or in the future. Doing so would make "listtransactions" out of order (or worse, reordered).

@gmaxwell

Copy link
Copy Markdown
Contributor

In general I prefer this behavior to the current one... though txn appearing 'out of order' in the transaction history is unfortunate. ... but traditional banking sites do that all the time and people seem to survive.

@luke-jr

luke-jr commented Apr 28, 2012

Copy link
Copy Markdown
Member

I'd mind less if they actually appeared out of order, but I'm pretty sure they're sorted by time, so they'll reorder. :/

I care less, if listtransactions shows all 3 times (seen, block, and "best guess") and sorts by seen time...

@laanwj

laanwj commented Apr 29, 2012

Copy link
Copy Markdown
Member

I think it's fine for the JSON call to show all the different times, as people may need them for different purposes.

On the other hand, @sipa's change is great for the GUI.

@ghost

ghost commented May 9, 2012

Copy link
Copy Markdown

Why not do it this way, without changing function args list:

diff --git a/src/wallet.cpp b/src/wallet.cpp
index 9989098..defab00 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -322,7 +322,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
         CWalletTx& wtx = (*ret.first).second;
         wtx.BindWallet(this);
         bool fInsertedNew = ret.second;
-        if (fInsertedNew)
+        if (fInsertedNew && wtx.nTimeReceived == 0)
             wtx.nTimeReceived = GetAdjustedTime();

         bool fUpdated = false;
@@ -397,6 +397,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
         if (fExisted || IsMine(tx) || IsFromMe(tx))
         {
             CWalletTx wtx(this,tx);
+            wtx.nTimeReceived = pblock->GetBlockTime();
             // Get merkle branch if transaction was found in a block
             if (pblock)
                 wtx.SetMerkleBranch(pblock);

@gmaxwell

Copy link
Copy Markdown
Contributor

Can we get some more discussion here? Agreement on this would be nice.

@luke-jr

luke-jr commented May 18, 2012

Copy link
Copy Markdown
Member

We discussed this a bit back in December. I think having all 3 times (received, block, and "smart") in JSON-RPC and just the smart times in Bitcoin-Qt is the best solution.

"time": smart timestamp,
"receivetime": timestamp,
"blocktime": timestamp,

@gmaxwell

Copy link
Copy Markdown
Contributor

Thats sounds good to me— perhaps a later commit can make a tooltip show the three times in the gui? I assume that recievetime would be a sent time for txn you sent (being that you received them the same instant)?

@luke-jr

luke-jr commented May 18, 2012

Copy link
Copy Markdown
Member

Yes, the smart time would also logically be the sent time as well.

@laanwj

laanwj commented May 18, 2012

Copy link
Copy Markdown
Member

Right, we can put all the times in the "transaction details" window.

@jgarzik

jgarzik commented Aug 1, 2012

Copy link
Copy Markdown
Contributor

I'm officially -ENOCARE. Code appears correct to my minimal scan. @gavinandresen ?

@gmaxwell based on your comments, it sounds like you ACK this code?

@gavinandresen

Copy link
Copy Markdown
Contributor

ACK. Looks obviously better than the current behavior.

@luke-jr

luke-jr commented Aug 1, 2012

Copy link
Copy Markdown
Member

This is NACK since it breaks listtransactions. #1393

@sipa

sipa commented Aug 1, 2012

Copy link
Copy Markdown
Member Author

I'm very unsure myself whether I want this merged. Luke's version is more complex but probably behaves as expected in more use cases.

I'm not sure either should be merged without some testing...

@gmaxwell gmaxwell closed this Aug 23, 2012
@gmaxwell

Copy link
Copy Markdown
Contributor

(Obsoleted by Luke's version.)

lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
test_bitcoin_fuzzy: Further updates
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Dec 25, 2019
…llet is unlocked for staking only

9253412 [GUI][Trivial] Rewording of Error message while trying to send with the transaction with wallet unlocked for staking only (NoobieDev12)

Pull request description:

  Not sure if this is good or it needs to be:

  > Error: The wallet is unlocked for anonymization and staking only.**\n**Unlock the wallet to send the transaction.

  ![check](https://user-images.githubusercontent.com/57232689/69903529-c50bd600-139a-11ea-96db-45c83cd19e3c.JPG)

ACKs for top commit:
  random-zebra:
    Text updated. ACK 9253412
  furszy:
    utACK 9253412

Tree-SHA512: 32862256a34fd644aaa987296d2a190c288697481b2063b67cad93104bc5baf3712aad42fb7c418c38db4f7e1c96add61863eab0871a21f9250fe99fdee15ff7
dexX7 added a commit to dexX7/bitcoin that referenced this pull request Aug 20, 2020
…est framework

3e22efd [tests] Convert bash test scripts to functional test framework (Peter Bushnell)
da477a6 [rpc] Correction to help info (Peter Bushnell)

Pull request description:

  There are several bash scripts that cover functionality that is not covered by CI. These tests are ported here to the Python functional test framework and will now be run by CI. Minor correction was made to an RPC calls help info as this came up during porting.

Tree-SHA512: d947a59aeec9ee50a1af3cff82b1d5de8bbebbae160565f31e2dbdfad300edda9726bbbaf23a53d4d9c9e75de5f6829d8860ff2b845f6fee6931908fba302b80
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants