Bitcoin Forum
April 30, 2024, 08:11:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »  All
  Print  
Author Topic: Electrum server discussion thread  (Read 61412 times)
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 22, 2012, 07:04:58 AM
 #41

In the server response to "blockchain.address.get_history" commands, a transaction's timestamp is set to the time it was included in a block (or 0 while it's in the mempool). This makes it impossible for a client to correctly sort transactions which occurred while the it wasn't connected to the server, and adds a lot of complexity to correctly sorting those which occur when it's connected.

Could the server be updated to report the time a transaction was first received, either instead of the current timestamp value (as the blockchain.info API does) or in another field?

I can provide a patch if you let me know which of these is preferred, ThomasV.

this is not possible. the time a tx was first received depends on the server.
the correct way to sort transactions is to look at their inputs and outputs.

Electrum: the convenience of a web wallet, without the risks
1714507892
Hero Member
*
Offline Offline

Posts: 1714507892

View Profile Personal Message (Offline)

Ignore
1714507892
Reply with quote  #2

1714507892
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714507892
Hero Member
*
Offline Offline

Posts: 1714507892

View Profile Personal Message (Offline)

Ignore
1714507892
Reply with quote  #2

1714507892
Report to moderator
1714507892
Hero Member
*
Offline Offline

Posts: 1714507892

View Profile Personal Message (Offline)

Ignore
1714507892
Reply with quote  #2

1714507892
Report to moderator
anfedorov
Newbie
*
Offline Offline

Activity: 44
Merit: 0


View Profile
June 22, 2012, 07:40:05 AM
 #42

this is not possible. the time a tx was first received depends on the server.
the correct way to sort transactions is to look at their inputs and outputs.

I think that's OK - in practice, transactions are spread fast enough that it won't differ by more than a few seconds, whereas blocks are often over 30 minutes apart.

I'm not sure if I understand how inputs/outputs can be used to sort transactions... could you expound?
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 22, 2012, 10:29:20 AM
 #43

this is not possible. the time a tx was first received depends on the server.
the correct way to sort transactions is to look at their inputs and outputs.

I think that's OK - in practice, transactions are spread fast enough that it won't differ by more than a few seconds, whereas blocks are often over 30 minutes apart.

no, there is no guarantee that different servers will configure their clock with the same time.

in addition, get_history will be extended, and it should be completely deterministic;
a hash of the history will be used to avoid the server resending the whole history everytime it changes.


Quote
I'm not sure if I understand how inputs/outputs can be used to sort transactions... could you expound?

when transactions are in the same block, they are logically ordered; you cannot spend coins before you receive them

Electrum: the convenience of a web wallet, without the risks
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 22, 2012, 11:11:03 AM
 #44

I made some changes to the server code this week:

- The server shuts itself down if it loses connection with the bitcoin daemon. This will prevent servers lagging in the past
- The server announces its version to clients. The current server version is tagged 0.1.
This version number will be used by future versions of the client; for example, the client will filter out servers that have not been upgraded after a critical bug has been fixed.

Electrum: the convenience of a web wallet, without the risks
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
June 22, 2012, 11:22:28 AM
 #45

Updated my server but go this while starting it back up.

Code:
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")
error: sql error: <OMITTED ADRESS>
Traceback (most recent call last):
  File "/home/animazing/src/electrum/server/backends/abe/__init__.py", line 87, in safe_sql
    ret = self.selectall(sql,params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 510, in _selectall
    store.sql(stmt, params)
  File "/usr/local/lib/python2.7/dist-packages/Abe/DataStore.py", line 412, in sql
    store.cursor.execute(cached, params)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'last_value' in 'field list'")

Edited out the addresses but other then that it is as is. It also looks like my client might be stuck synchronizing.

Should I worry about this?

Edit: I get the errors each time I want to connect to the server with my client.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 22, 2012, 11:27:17 AM
 #46

Updated my server but go this while starting it back up.

...

Edited out the addresses but other then that it is as is. It also looks like my client might be stuck synchronizing.

Should I worry about this?

Edit: I get the errors each time I want to connect to the server with my client.

I guess this is a schema change in abe
try to run the abe update script:

Code:
python -m Abe.abe --config your_abe_config_file

Electrum: the convenience of a web wallet, without the risks
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
June 22, 2012, 11:29:50 AM
 #47

I already updated Abe yesterday. Will give it a try though.

Edit: No dice, seems this commit might have something to do with it since it errors on this column.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 22, 2012, 11:57:22 AM
 #48

I already updated Abe yesterday. Will give it a try though.

Edit: No dice, seems this commit might have something to do with it since it errors on this column.

indeed. I removed the call to new_id() because it was creating a new id.
however, the request might not work on all databases. (I use postgresql)

Electrum: the convenience of a web wallet, without the risks
anfedorov
Newbie
*
Offline Offline

Activity: 44
Merit: 0


View Profile
June 22, 2012, 01:10:35 PM
Last edit: June 22, 2012, 03:46:25 PM by anfedorov
 #49

no, there is no guarantee that different servers will configure their clock with the same time.

Why not just use UTC?

in addition, get_history will be extended, and it should be completely deterministic;
a hash of the history will be used to avoid the server resending the whole history everytime it changes.

Then just remove the received time before hashing? Or just use the hash of the last block a client knows of to identify how much history is missing?

I'm not sure if I understand how inputs/outputs can be used to sort transactions... could you expound?

when transactions are in the same block, they are logically ordered; you cannot spend coins before you receive them

That's a very sparse ordering. Say I receive transactions from three different accounts 5 minutes apart. As of now, it's quite possible for me to see the oldest transaction at the top of my transaction list, with the newer transactions below it. If I'm expecting them and keeping an eye on the list as I'm receiving them, that's a really obvious and confusing bug, and a horrible UX.

Or say you need to send out several transactions in a row, there are a ton of use cases where seeing them in the same order you sent them might be important. Again, the current situation can lead to bad UX.

The blockchain.info API seems to provide the received time for transactions without much issue, why can't Electrum?

Edit: sorting by tx_id when transactions belong to the same block seems to partially mitigate the issue. It doesn't fix transactions which take time to be confirmed, however...
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
June 22, 2012, 01:51:08 PM
Last edit: June 22, 2012, 04:33:56 PM by Tachikoma
 #50

I already updated Abe yesterday. Will give it a try though.

Edit: No dice, seems this commit might have something to do with it since it errors on this column.

indeed. I removed the call to new_id() because it was creating a new id.
however, the request might not work on all databases. (I use postgresql)

There is no last_value on MySQL as far as I am aware. Would it be possible to replace:

Code:
        current_id = self.safe_sql("""SELECT last_value FROM tx_seq""")
        current_id = current_id[0][0]

With

Code:
        current_id = self.safe_sql("""SELECT * FROM tx_seq ORDER BY id DESC LIMIT 1""")
        current_id = current_id[0][0]

Since my server crashes I can't be sure what current_id is returning on Postgre.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
ajze
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
June 23, 2012, 02:00:36 AM
 #51

I already updated Abe yesterday. Will give it a try though.

Edit: No dice, seems this commit might have something to do with it since it errors on this column.

indeed. I removed the call to new_id() because it was creating a new id.
however, the request might not work on all databases. (I use postgresql)

There is no last_value on MySQL as far as I am aware. Would it be possible to replace:

Code:
        current_id = self.safe_sql("""SELECT last_value FROM tx_seq""")
        current_id = current_id[0][0]

With

Code:
        current_id = self.safe_sql("""SELECT * FROM tx_seq ORDER BY id DESC LIMIT 1""")
        current_id = current_id[0][0]

Since my server crashes I can't be sure what current_id is returning on Postgre.

This is the same bug I'm getting.  I didn't even realize that PostgreSQL was an option.  If you're trying to support several different databases, you might want to consider a database abstraction layer, such as ADOdb.  It will make things much easier for you.

As a temporary solution something like this should be compatible with both:

Code:
        current_id = self.safe_sql("""SELECT max(id) FROM tx_seq""");

If the table is indexed properly, it should be just as fast, too.  I'll try it on my node later and let you know how it works.
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
June 23, 2012, 07:04:01 AM
 #52


Code:
        current_id = self.safe_sql("""SELECT max(id) FROM tx_seq""");

If the table is indexed properly, it should be just as fast, too.  I'll try it on my node later and let you know how it works.


I tried that first but I got a tuple error of some kind. Let me know if you have more luck.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 23, 2012, 12:11:19 PM
 #53


...

What you are proposing is that Electrum servers store information that is not in the bitcoin blockchain.
There are more obvious uses to it than just sorting transactions. For example servers could store transaction labels.

This is beyond scope, at least for now.
It would involve an extra layer and infrastructure, and it would be a bad idea to mix such requests with the stratum commands.


Electrum: the convenience of a web wallet, without the risks
anfedorov
Newbie
*
Offline Offline

Activity: 44
Merit: 0


View Profile
June 23, 2012, 12:28:03 PM
 #54


...

What you are proposing is that Electrum servers store information that is not in the bitcoin blockchain.
There are more obvious uses to it than just sorting transactions. For example servers could store transaction labels.

This is beyond scope, at least for now.
It would involve an extra layer and infrastructure, and it would be a bad idea to mix such requests with the stratum commands.

That makes sense. Thanks for the thorough explanations.

I realize it's a bit of a hack, but do you see any practical drawbacks or issues in using tx_id fields for sorting transactions when their timestamp fields are equal? That seems to work well in addressing my UX concerns.
ThomasV (OP)
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
June 23, 2012, 12:38:29 PM
 #55


...

What you are proposing is that Electrum servers store information that is not in the bitcoin blockchain.
There are more obvious uses to it than just sorting transactions. For example servers could store transaction labels.

This is beyond scope, at least for now.
It would involve an extra layer and infrastructure, and it would be a bad idea to mix such requests with the stratum commands.

That makes sense. Thanks for the thorough explanations.

I realize it's a bit of a hack, but do you see any practical drawbacks or issues in using tx_id fields for sorting transactions when their timestamp fields are equal? That seems to work well in addressing my UX concerns.

tx_id is not part of the protocol and should not be sent at all by the server.
it is a field that is only returned by abe-based servers, not servers using libbitcoin

Electrum: the convenience of a web wallet, without the risks
bitfoo
Donator
Sr. Member
*
Offline Offline

Activity: 289
Merit: 250



View Profile
June 23, 2012, 08:59:40 PM
 #56


Code:
        current_id = self.safe_sql("""SELECT max(id) FROM tx_seq""");

If the table is indexed properly, it should be just as fast, too.  I'll try it on my node later and let you know how it works.


I tried that first but I got a tuple error of some kind. Let me know if you have more luck.

I can confirm that SELECT max(id) works for me on a MySQL server.

ajze
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
June 23, 2012, 10:34:49 PM
Last edit: June 24, 2012, 01:37:41 AM by ajze
 #57

Nevermind.  After accidentally trashing my db for the 10th time, I'm declaring the current solution of bitcoind+abe+electrum server [edit]annoying[/edit].  I'll come back when it's not a full time job just to get it to run.


Edit:
Sorry, I was very frustrated.  Now that I've calmed down, I'm going to try to help fix things instead of complaining Smiley
TehZomB
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
June 24, 2012, 01:16:26 AM
 #58

If I am running bitcoind daemon and an Electrum server, do both programs download the block chain separately?
ajze
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
June 24, 2012, 01:40:32 AM
 #59

If I am running bitcoind daemon and an Electrum server, do both programs download the block chain separately?

bitcoind downloads the blockchain, then Electrum server (with the help of Abe) reads it and puts it in an SQL database to make it easier to query.
anfedorov
Newbie
*
Offline Offline

Activity: 44
Merit: 0


View Profile
June 24, 2012, 04:15:44 AM
 #60


I realize it's a bit of a hack, but do you see any practical drawbacks or issues in using tx_id fields for sorting transactions when their timestamp fields are equal? That seems to work well in addressing my UX concerns.

tx_id is not part of the protocol and should not be sent at all by the server.
it is a field that is only returned by abe-based servers, not servers using libbitcoin

D'oh! Story of my life.

It would really help if it were possible to recover those protocol docs (the link you posted on another thread is still down). What is libbitcoin? It seems like it might help to document the different kinds of servers, as well...
Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!