Bitcoin Forum
December 17, 2017, 04:38:48 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Bitcoin Qt: lockunspent broken?  (Read 1107 times)
Hans0
Member
**
Offline Offline

Activity: 91


View Profile
February 28, 2014, 01:12:39 PM
 #1

In Bitcoin Qt, I tried to lock unspent outputs. My intention was to lock all but one to force a particular output to be selected for a transaction.

I understand it should work like this:

  • call lockunspent with a list of outputs
  • call listlockunspent and observe that all specified outputs are actually locked

Unfortunately, none are locked in my testing. What am I doing wrong? There was no error message. I entered the command in the debug window.

Edit: I reviewed the source code and I did not find any obvious usage errors on my part. Debugging the client is beyond my abilities, though.
1513528728
Hero Member
*
Offline Offline

Posts: 1513528728

View Profile Personal Message (Offline)

Ignore
1513528728
Reply with quote  #2

1513528728
Report to moderator
1513528728
Hero Member
*
Offline Offline

Posts: 1513528728

View Profile Personal Message (Offline)

Ignore
1513528728
Reply with quote  #2

1513528728
Report to moderator
1513528728
Hero Member
*
Offline Offline

Posts: 1513528728

View Profile Personal Message (Offline)

Ignore
1513528728
Reply with quote  #2

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

Activity: 2002



View Profile
February 28, 2014, 03:42:39 PM
 #2

In Bitcoin Qt, I tried to lock unspent outputs. My intention was to lock all but one to force a particular output to be selected for a transaction.

I understand it should work like this:

  • call lockunspent with a list of outputs
  • call listlockunspent and observe that all specified outputs are actually locked

Unfortunately, none are locked in my testing. What am I doing wrong? There was no error message. I entered the command in the debug window.

Edit: I reviewed the source code and I did not find any obvious usage errors on my part. Debugging the client is beyond my abilities, though.

I haven't used it yet, but don't you need to pass a parameter of "true" when calling lockunspent?

Code:
lockunspent true [list of outputs]

Where list of outputs is in the format:

{"txid":txid,"vout":n},...

Hans0
Member
**
Offline Offline

Activity: 91


View Profile
February 28, 2014, 04:32:45 PM
 #3

Yes, I did this. When I initially left it out I received an error. After filling it in the error went away.
btcseptember
Newbie
*
Offline Offline

Activity: 5


View Profile
March 17, 2014, 07:53:21 AM
 #4

I got this:
Code:
Error: Error parsing JSON:ture
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2366



View Profile
March 17, 2014, 08:05:46 AM
 #5

Works fine here:


[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
]
[gmaxwell@helmholtz tmp]$ bitcoin-cli lockunspent false '[{"txid":"76a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac","vout":0}]'
true
[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
    {
        "txid" : "0000000000000076a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac",
        "vout" : 0
    }
]
[gmaxwell@helmholtz tmp]$ bitcoin-cli lockunspent true '[{"txid":"76a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac","vout":0}]'
true
[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
]
[gmaxwell@helmholtz tmp]$

Bitcoin will not be compromised
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
March 17, 2014, 08:14:58 AM
 #6

Rather confusing command syntax might be the problem - try a "false" rather than a "true" by the looks of it.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Hans0
Member
**
Offline Offline

Activity: 91


View Profile
March 17, 2014, 11:04:05 AM
 #7

Looks like I passed in true instead of false. With your example I tested it to work. Thanks!

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1484


View Profile
March 17, 2014, 09:14:32 PM
 #8

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.

If you need to send from a specific output, easiest to use coin control or raw transaction API.

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

Activity: 91


View Profile
March 17, 2014, 10:51:51 PM
 #9

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.

If you need to send from a specific output, easiest to use coin control or raw transaction API.

Googling for "coin control" it seems that this is a non-standard feature not available in the official Bitcoin-qt. I do not like to trust other clients or branches. I'd like to have that feature available, though. Better than locking outputs.

Raw transactions seem error-prone to me. One mistake and the coins are gone.
Hans0
Member
**
Offline Offline

Activity: 91


View Profile
March 17, 2014, 11:21:00 PM
 #10

Doing further research it seems that 0.9 seems to have coin control. That's great news!
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!