Bitcoin Forum
December 14, 2017, 04:01:24 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: listtransactions output is not in order  (Read 2026 times)
burnside
Legendary
*
Offline Offline

Activity: 1008



View Profile WWW
May 15, 2013, 12:42:22 AM
 #1

I have an issue where the output of listtransactions is not in chronological order.  I depend on it somewhat to be able to give people updates on their deposits.  It's been broken for some time, no idea how it got screwed up and I initially fixed it in our web application's code just by pulling 10k records, but performance has been poor and I'd much prefer to just get this fixed.

I'm guessing this code is not returning them oldest to newest:  (bitcoind 0.8.1, rpcwallet.cpp around line 1047)

Code:
   CWallet::TxItems txOrdered = pwalletMain->OrderedTxItems(acentries, strAccount);

    // iterate backwards until we have nCount items to return:
    for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
    {
        CWalletTx *const pwtx = (*it).second.first;
        if (pwtx != 0)
            ListTransactions(*pwtx, strAccount, 0, true, ret);
        CAccountingEntry *const pacentry = (*it).second.second;
        if (pacentry != 0)
            AcentryToJSON(*pacentry, strAccount, ret);

        if ((int)ret.size() >= (nCount+nFrom)) break;
    }
    // ret is newest to oldest

Because what comes out of here is not oldest to newest:

Code:
std::reverse(ret.begin(), ret.end()); // Return oldest to newest

I tried to add the following above the std::reverse():

Code:
std::stable_sort(ret.begin(), ret.end());

But with that in there it doesn't compile.

Can any C++ guys out there lend a hand?

I'm not a Coinbase fan -- I placed a buy order, they took the funds out of my account, then a week later the price went up and they canceled the buy and closed my account.  You've been warned.  Use a different exchange.
1513267284
Hero Member
*
Offline Offline

Posts: 1513267284

View Profile Personal Message (Offline)

Ignore
1513267284
Reply with quote  #2

1513267284
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
burnside
Legendary
*
Offline Offline

Activity: 1008



View Profile WWW
May 16, 2013, 11:24:35 PM
 #2

anyone?

I'm not a Coinbase fan -- I placed a buy order, they took the funds out of my account, then a week later the price went up and they canceled the buy and closed my account.  You've been warned.  Use a different exchange.
nixoid
Jr. Member
*
Offline Offline

Activity: 45



View Profile WWW
July 24, 2013, 08:26:29 AM
 #3

I've submitted this bug to github: https://github.com/bitcoin/bitcoin/issues/2853

www.orderbook.io - Decentralized Ethereum token exchange
www.ambisafe.co - Ethereum Asset Platform
burnside
Legendary
*
Offline Offline

Activity: 1008



View Profile WWW
July 24, 2013, 09:01:34 AM
 #4

Thank you.  Wink

Quoting Luke:

Quote
"Chronological order" is a bit ambiguous when it comes to Bitcoin transactions, which don't have timestamps! Where is this documentation?
listtransactions should stick to the order transactions were seen in, and try to guess a reasonable time partially based on that.

It's not displaying them in the order they were seen in.  The transactions displayed right now are months old on a wallet that sees thousands of transactions a day.  I can take the timestamp epoch and converted it is clear it's months old.  Plus it's been the same ones it displays since I first reported it.  If I list them all on a certain account, new transactions are showing up somewhere in the middle of the bunch.

I did work around this issue with the since last block call, and I'll iterate on that when I upgrade to use the new ability to call a local script when a new transaction is detected.

Still.... would be nice if things worked as described.  Wink

Cheers.

I'm not a Coinbase fan -- I placed a buy order, they took the funds out of my account, then a week later the price went up and they canceled the buy and closed my account.  You've been warned.  Use a different exchange.
nixoid
Jr. Member
*
Offline Offline

Activity: 45



View Profile WWW
July 30, 2013, 09:06:51 AM
 #5

I've already figured outworkaround:
listtransactions "*" 1000 0
instead of
listtransactions "" 1000 0

in this case it works as expected

www.orderbook.io - Decentralized Ethereum token exchange
www.ambisafe.co - Ethereum Asset Platform
elbandi
Hero Member
*****
Offline Offline

Activity: 495


View Profile
December 22, 2015, 05:47:37 PM
 #6

I've already figured outworkaround:
listtransactions "*" 1000 0
instead of
listtransactions "" 1000 0

in this case it works as expected
it doesnt work for me.

$ callrpc listtransactions "" 99999999 0 |wc -l
36767
$ callrpclisttransactions "*" 99999999 0 |wc -l
1067733

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!