mastercoin-MSC / mastercore

mastercore info
mastercoin.org
MIT License
24 stars 11 forks source link

TX70 RPC output missing details #278

Open achamely opened 9 years ago

achamely commented 9 years ago

The RPC output of a valid TX70 is missing 2 vital pieces of information that would be needed by integrators, The reference address and propertyid being affected by the tx.

Ex:

./mastercored gettransaction_MP 0a7a3e6165a5d17be55214a3967834d0537cadb03cf8a840a3e3b6ea315175a1 { "error": null, "id": null, "result": { "amount": "0.00000000", "blocktime": 1422917758, "confirmations": 1, "divisible": true, "fee": 4.5e-05, "ismine": false, "propertyid": 0, "sendingaddress": "mfmGJgiyX2W43ykhZzP2DgA782L9vKRGeC", "txid": "0a7a3e6165a5d17be55214a3967834d0537cadb03cf8a840a3e3b6ea315175a1", "type": "Change Issuer Address", "type_int": 70, "valid": true, "version": 0 } }

Discovered during Grant/Revoke/Tx70 testing https://docs.google.com/a/mastercoin.org/spreadsheets/d/1_DZ_sO2q9y2E5xmkVrqs2gkMjPER-awf7xV2tDt4U84/edit#gid=0

zathras-crypto commented 9 years ago

First issue, missing ref address - seems like the showReference bool wasn't added with the case:

                        case MSC_TYPE_GRANT_PROPERTY_TOKENS:
                             if (0 == mp_obj.step2_Value())
                             {
                                showReference = true;
                                propertyId = mp_obj.getProperty();
                                amount = mp_obj.getAmount();
                             }
                        break;
                        case MSC_TYPE_REVOKE_PROPERTY_TOKENS:
                             if (0 == mp_obj.step2_Value())
                             {
                                propertyId = mp_obj.getProperty();
                                amount = mp_obj.getAmount();
                             }
                        break;

Second issue (property ID zero) means that step2_Value is not allowing getProperty() to get the right detail - I didn't write grants/revokes so I'll need to dive into that. Leave it with me :)

Thanks Z

zathras-crypto commented 9 years ago

Quick Q - in your mastercore output above, you have:

"fee": 4.5e-05,

Is there some interpretation layer there between what was returned and what you pasted? We shouldn't be passing out fees (from mastercore) formatted like that.

EDIT: I get "fee" : 0.00004500, for that tx.

zathras-crypto commented 9 years ago

Also, ignore my comment above re the missing showReference bool - that's quoting the revoke case - think I'm losing my mind!

Anyway, the actual issue is that there is no CASE for populateRPCTransactionObject whatsoever for the Change Issuer transaction, thus it's left to defaults. I'll add a CASE for this to 0.0.9.1.

zathras-crypto commented 9 years ago

That's better :)

zathras@coredev01:~/github/build/mastercore$ src/mastercored gettransaction_MP 0a7a3e6165a5d17be55214a3967834d0537cadb03cf8a840a3e3b6ea315175a1
{
    "txid" : "0a7a3e6165a5d17be55214a3967834d0537cadb03cf8a840a3e3b6ea315175a1",
    "sendingaddress" : "mfmGJgiyX2W43ykhZzP2DgA782L9vKRGeC",
    "referenceaddress" : "n1NZHR8pmp1mQWKxJ7LvgDqLkwT4P6cept",
    "ismine" : false,
    "confirmations" : 15,
    "fee" : 0.00004500,
    "blocktime" : 1422917758,
    "version" : 0,
    "type_int" : 70,
    "type" : "Change Issuer Address",
    "propertyid" : 2147483674,
    "divisible" : true,
    "amount" : "0.00000000",
    "valid" : true
}
zathras-crypto commented 9 years ago

https://github.com/mastercoin-MSC/mastercore/pull/281

achamely commented 9 years ago

Thanks Z, i'm rebuilding now. Yes in my previous output that was from a python interpreter

achamely commented 9 years ago

@zathras-crypto this is pushed to the 0.0.9 branch i see. Shouldn't it also be pushed to 0.0.10 for consistency?

zathras-crypto commented 9 years ago

Yes it should - great spot - thanks :)