dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Correctly show non-regular transactions in filtertransactions #779

Open Nizametdinov opened 5 years ago

Nizametdinov commented 5 years ago

The current implementation of the filtertransactions RPC method was designed for regular and Bitcoin-style coinbase transactions. It should correctly show new coinbase and other types of transactions (or explicitly ignore some of them).

List of transaction types:

  REGULAR = 0,
  COINBASE = 1,
  DEPOSIT = 2,
  VOTE = 3,
  LOGOUT = 4,
  SLASH = 5,
  WITHDRAW = 6,
  ADMIN = 7

Example of a new coinbase transaction in the filtertransactions output:

{
  'confirmations': 100,
  'generated': True,
  'blockhash': '7bd7e92169ae5b076442c64dcb37547adb0bc124674fb9481fac177d287db0f7',
  'blockindex': 0,
  'blocktime': 1388594400,
  'txid': 'fcde5f23df7d49d30fcb039d426e016ed61ac60ca21474b4032b086704b8fbeb',
  'walletconflicts': [],
  'time': 1388594400,
  'timereceived': 1388594400,
  'bip125-replaceable': 'no',
  'abandoned': 0,
  'fee': Decimal('50.00000000'),
  'category': 'immature',
  'outputs': [{'vout': 2, 'amount': Decimal('0E-8')}],
  'amount': Decimal('0E-8')
}
Nizametdinov commented 5 years ago

Related todos: https://github.com/dtr-org/unit-e/blob/c139675bf896dfcd5657ead6605d9494750e09be/src/wallet/rpcwalletext.cpp#L514 https://github.com/dtr-org/unit-e/blob/c139675bf896dfcd5657ead6605d9494750e09be/test/functional/rpc_filtertransactions.py#L175

cmihai commented 5 years ago

Regarding the first TODO : as far as I understand, in Particl the listStaked was meant to display the remotely staked transactions that are slowly being deposited on a remote node "for free" as we mine blocks. This is not a usecase that we explicitly support in Unit-e, so I'll just drop that branch entirely, if no one objects?

Nizametdinov commented 5 years ago

I'm not sure listStaked was meant to be used only for cold staking. But we definitely can live without it.