dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

gettransaction cmd enhancement with ticket details

Open kLkA opened this issue 7 years ago • 5 comments

kLkA avatar Jun 10 '18 09:06 kLkA

@jrick I'm extending data returning from gettransaction cmd. During implementation of listtickets and addition of ticket details to gettransaction I noticed big difference in data view live ticket in listtickets

{
    "ticket": {
      "hash": "d27c8acdddea4bba84f967ba528081764b23423c532511ce49a74991f52ae0e6",
      "transaction": "01000000016a24f6e5de17b5e584c71f9ed952897f58a25c4ab7525ff4d8068ff61d8440010900000000ffffffff03204e00000000000000001aba76a9148c180697e741c6b54713330276ce23d0668b3bd388ac00000000000000000000206a1e0301d5f35e6c7a37d7a8e828b62933e73299525150c30000000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac000000000000000001ffffffffffffffff00000000ffffffff6b483045022100d94b714e41bc9de6239da55edcac7a55514afea3cf9e8e0a9b91016e019ce3170220115e19aa3148f06ed0b15990c5893e9257af0f65a0e55d875ddcbce90f970fe401210231ffb5dcacfee9d2fdd11a52d13c429e5befe84059e995ee57bf14234c31590e",
      "myinputs": [
        {
          "index": 0,
          "previousaccount": 0,
          "previousamount": 0.0005
        }
      ],
      "myoutputs": [
        {
          "index": 0,
          "account": 0,
          "internal": true,
          "amount": 0.0002,
          "address": {},
          "outputscript": "ba76a9148c180697e741c6b54713330276ce23d0668b3bd388ac"
        }
      ],
      "fee": 0.0003,
      "timestamp": 1528314256,
      "type": 2
    },
    "spender": null,
    "status": "LIVE"
  }

is shown in gettransaction as

{
  "amount": -0.0003,
  "fee": -0.0003,
  "confirmations": 93,
  "blockhash": "076e58f34a159933620c29e46c11d32837c9a59ee4d9b36289b4b2ee52d12168",
  "blockindex": 0,
  "blocktime": 1528314267,
  "txid": "d27c8acdddea4bba84f967ba528081764b23423c532511ce49a74991f52ae0e6",
  "walletconflicts": [],
  "time": 1528314256,
  "timereceived": 1528314256,
  "details": [
    {
      "account": "",
      "amount": -0,
      "category": "send",
      "fee": -0.0003,
      "vout": 1
    },
    {
      "account": "",
      "address": "SsUMGgvWLcixEeHv3GT4TGYyez4kY79RHth",
      "amount": -0,
      "category": "send",
      "fee": -0.0003,
      "vout": 2
    }
  ],
  "hex": "01000000016a24f6e5de17b5e584c71f9ed952897f58a25c4ab7525ff4d8068ff61d8440010900000000ffffffff03204e00000000000000001aba76a9148c180697e741c6b54713330276ce23d0668b3bd388ac00000000000000000000206a1e0301d5f35e6c7a37d7a8e828b62933e73299525150c30000000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac000000000000000001ffffffffffffffff00000000ffffffff6b483045022100d94b714e41bc9de6239da55edcac7a55514afea3cf9e8e0a9b91016e019ce3170220115e19aa3148f06ed0b15990c5893e9257af0f65a0e55d875ddcbce90f970fe401210231ffb5dcacfee9d2fdd11a52d13c429e5befe84059e995ee57bf14234c31590e",
  "type": "TICKETPURCHASE", // this is newly added field
  "ticketstatus": "LIVE" // this is newly added field
}
  • Why in tx amounts are with minus sign?
  • Why tx details doesn't reflect inputs, outputs?
  • Maybe we should unify results json across methods?
  • Additionally, we have txDetails func getTransaction handler for method inside unstable.go. Is this still actual? I see that RPC server has more fresh GetTransaction method (which particulary used in listtickets). Do we have plans to make legacy rpc methods equal to what we have in new RPC server?

kLkA avatar Jun 10 '18 11:06 kLkA

There have been changes to gettransaction, please test this again (it looks like an old testnet2 transaction though, so if you don't have your testnet2 wallet anymore, you may need to redo this test).

jrick avatar Sep 24 '18 13:09 jrick

This is also going to hit the same issues as listtickets will on SPV wallets, namely that we don't know if a ticket is live or missed. To get around this problem in getstakeinfo, I made a new "unspent" field which counts the tickets that have not been spent through either a vote or revocation, and a "unspentexpired" field which counts the number of unspent tickets which can't possibly be live anymore due to being past expiry (they might be missed or expired, we don't know in SPV, but we do know they are revocable).

jrick avatar Sep 24 '18 13:09 jrick

this will be continued after https://github.com/decred/dcrwallet/issues/1168 review

kLkA avatar Oct 09 '18 19:10 kLkA

Done

kLkA avatar Oct 27 '18 15:10 kLkA