Bitcoin Forum
December 04, 2016, 12:13:01 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [PULL] spent per txout  (Read 1510 times)
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
April 02, 2011, 09:53:10 PM
 #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.

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
1480810381
Hero Member
*
Offline Offline

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

1480810381
Report to moderator
1480810381
Hero Member
*
Offline Offline

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

1480810381
Report to moderator
1480810381
Hero Member
*
Offline Offline

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

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

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

1480810381
Report to moderator
1480810381
Hero Member
*
Offline Offline

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

1480810381
Report to moderator
1480810381
Hero Member
*
Offline Offline

Posts: 1480810381

View Profile Personal Message (Offline)

Ignore
1480810381
Reply with quote  #2

1480810381
Report to moderator
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1470


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


It is likely this will go into 0.3.21.


Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Hal
VIP
Sr. Member
*
expert
Offline Offline

Activity: 314



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



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
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
April 03, 2011, 08:52:36 PM
 #5

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

You were right - fixed.

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


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: 538


NamecoinID: id/khal


View Profile WWW
April 08, 2011, 08:55:11 AM
 #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).

NMC: N1KHAL5C1CRzy58NdJwp1tbLze3XrkFxx9 | NamecoinID: id/khal | Register .bit domain
BTC: 1KHAL8bUjnkMRMg9yd2dNrYnJgZGH8Nj6T | My bitcoin Identity: send messages to bitcoin users
Free bitcoins: Surf4Bitcoin.com | Charity Ad: Make a good deed without paying a cent
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!