Bitcoin Forum
May 08, 2024, 12:57:44 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [PULL] spent per txout  (Read 1785 times)
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
April 02, 2011, 09:53:10 PM
Merited by ABCbits (6)
 #1

Hello,

this pull request has been waiting for some time, so maybe i should start a forum thread about it:
https://github.com/bitcoin/bitcoin/pull/123

The problem

Bitcoin currently only works for many things "per transaction", transactions as a whole are spent or not, and as a whole give a certain amount of available credits. However, when multiple outputs of a single transaction are available, it is sometimes useful to not use all of them. See http://bitcointalk.org/index.php?topic=3759.0

The problem with this is that bitcoin's wallet database only keeps a single boolean per transaction to indicate "spentness".

The patch

This patch adds an (optional) array of booleans per tx to the wallet format, while keeping the old single boolean updated according to "at least one output spent". Calculation of available coins is updated to only count the specifically available ones, and selection of coins for new transactions is done per-txout instead of per-tx (fixing the linked issue).

Backward compatibility

When you load an updated wallet (with partially-spent transactions) into an old client, it will show you a lower balance than the actual one, since it cannot cope with the available partial outputs. The transaction list is accurate though, and switching back to the new client fixes the issue.

I do Bitcoin stuff.
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
Report to moderator
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
Report to moderator
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
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.
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
Report to moderator
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
Report to moderator
1715173064
Hero Member
*
Offline Offline

Posts: 1715173064

View Profile Personal Message (Offline)

Ignore
1715173064
Reply with quote  #2

1715173064
Report to moderator
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
April 02, 2011, 10:13:08 PM
 #2


It is likely this will go into 0.3.21.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Hal
VIP
Sr. Member
*
expert
Offline Offline

Activity: 314
Merit: 3853



View Profile
April 03, 2011, 07:07:44 PM
 #3

This is good because without it, someone can test whether 2 addresses are in the same wallet, by sending a payment to both of them. Then you can't spend one without the other.

Hal Finney
Hal
VIP
Sr. Member
*
expert
Offline Offline

Activity: 314
Merit: 3853



View Profile
April 03, 2011, 08:31:00 PM
 #4

Trying to review the diff - looks like UpdateSpent() could return fReturn uninitialized if it's false.

Hal Finney
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
April 03, 2011, 08:52:36 PM
Last edit: April 03, 2011, 09:02:58 PM by sipa
 #5

Trying to review the diff - looks like UpdateSpent() could return fReturn uninitialized if it's false.

You were right - fixed.

I do Bitcoin stuff.
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
April 06, 2011, 01:43:38 PM
 #6

I added a comment to the PULL request-- I ran into an issue when sanity testing this (a testnet wallet that reports an impossibly high balance after conversion).

How often do you get the chance to work on a potentially world-changing project?
khal
Hero Member
*****
Offline Offline

Activity: 540
Merit: 500



View Profile WWW
April 08, 2011, 08:55:11 AM
Last edit: April 08, 2011, 12:29:33 PM by khal
 #7

Good job ! I'm waiting for this to be in the official client.

This will allow everybody (with another patch, to add possibility to select the from address) to send a transaction with the same address from and to, to prove the ownership of public addresses (needed here for example) by sending specified amount at specified time (more decimal precision than current 2 digits would be better... But this will be for later :p).
Pages: [1]
  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!