What does "vout" : -1 mean in preparelockunspent output?

+2 votes

Hello,

what does "vout" : -1 mean in preparelockunspent output?
I keep getting alternately -1 and 0 and I don’t understand why.

The method I used is the following:

preparelockunspent '{"asset1":1}'

I have got more than 300 units of asset1.

Thank you very much.


 

asked Nov 5, 2018 by multichain_user123

1 Answer

0 votes
 
Best answer
This certainly looks like a bug. Please provide a full transcript of the API request and its response, and let us know what version of MultiChain you are using.
answered Nov 8, 2018 by MultiChain
selected Nov 9, 2018 by multichain_user123
I was experimenting a little bit, so there were many things going on the blockchain (smart filters, etc). On a fresh chain, I could not replicate the issue. If it happens again, I'll try to post an update.

In any case, I was using Multichain 2.0 alpha 6.

Thanks.
OK, please keep us updated.
Hello,
I managed to reproduce the issue on a fresh blockchain.
Let's get started:
1. create a new blockchain and get a cli:
multichain-util create chain1
multichaind chain1 -daemon
multichain-cli chain1

2. run following api calls:
2018-11-12 14:54:13.068    listaddresses
2018-11-12 14:54:37.827    issue 1NyMSJaUECZWg143a7V8dixAJG6csqnLq3P1Zz '{"name":"asset1", "open":true}' 1000 1 0
2018-11-12 14:56:21.343    create txfilter f1 {} 'function filtertransaction(){var b=getfiltertransaction();var e={};for(var c=0;c<b.vin.length;c++){outputtoaddressbalancechange(getfiltertxinput(c),true,e)}for(var d=0;d<b.vout.length;d++){outputtoaddressbalancechange(b.vout[d],false,e)}for(var a in e){if(e[a]>1000){return"Address "+a+" is receiving too much USD"}}}function outputtoaddressbalancechange(c,g,f){if(c&&c.assets){for(var e=0;e<c.assets.length;e++){if(c.assets[e].name=="USD"){for(var d=0;d<c.scriptPubKey.addresses.length;d++){var b=c.scriptPubKey.addresses[d];if(!f.hasOwnProperty(b)){f[b]=0}var a=g?-c.assets[e].raw:c.assets[e].raw;f[b]+=a}}}}};'
2018-11-12 14:56:24.939    listtxfilters
2018-11-12 14:56:32.618    approvefrom 1NyMSJaUECZWg143a7V8dixAJG6csqnLq3P1Zz f1
2018-11-12 14:56:37.325    approvefrom 1NyMSJaUECZWg143a7V8dixAJG6csqnLq3P1Zz f1 true
2018-11-12 14:56:39.148    listtxfilters
2018-11-12 14:56:48.875    getnewaddress
2018-11-12 14:56:59.892    sendasset asset1 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz 1
2018-11-12 14:57:06.904    sendasset 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz asset1 1
2018-11-12 14:57:10.523    grant 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz receive
2018-11-12 14:57:11.642    sendasset 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz asset1 1
2018-11-12 14:57:25.327    issue 1NyMSJaUECZWg143a7V8dixAJG6csqnLq3P1Zz '{"name":"USD", "open":true}' 1000 1 0
2018-11-12 14:57:29.013    issue 1NyMSJaUECZWg143a7V8dixAJG6csqnLq3P1Zz '{"name":"USD", "open":true}' 1001 1 0
2018-11-12 14:58:25.881    issuremore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 10000
2018-11-12 14:58:29.996    issueremore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 10000
2018-11-12 14:58:34.419    issuemore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 10000
2018-11-12 14:58:40.778    issuemore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 999
2018-11-12 14:58:43.378    issuemore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 1000
2018-11-12 14:58:44.671    issuemore 1BzCS2u4W8wamuDKmRK5dGiTaU5586iG3gxUvz USD 1001
2018-11-12 14:59:04.028    preparelockunspent '{"USD":1"}'
2018-11-12 14:59:05.728    preparelockunspent '{"USD":1}'
2018-11-12 14:59:10.002    preparelockunspent '{"USD":1}'
2018-11-12 15:05:49.825    preparelockunspent '{"USD":1}'
2018-11-12 15:05:50.540    preparelockunspent '{"USD":1}'
2018-11-12 15:05:51.084    preparelockunspent '{"USD":1}'
2018-11-12 15:05:51.586    preparelockunspent '{"USD":1}'
2018-11-12 15:05:52.043    preparelockunspent '{"USD":1}'


Those last preparelockunspent give me alternately -1 and 0.
I left wrongly typed commands on purpose in the unlikely event that they have something to do with this behavior.

I hope this can help and that it does not depend on something wrong I am doing.
The smart filter used is this one: https://github.com/MultiChain/smart-filter-examples/blob/b3387f760f4cabab6a1da73fe2a8b709663efe37/transaction-filters/limit-asset-transfer.js

Thanks.
Thanks, I could reproduce it. We'll look into this for the next 2.0 release.
...