Skip to content

Commit 2e02650

Browse files
committed
Support retrieving newer txs only in lightwallet REST API
1 parent 37b5fc4 commit 2e02650

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

api/lightwallet_rest.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,26 @@ blockchain timestamps do not have sub-seconds.
142142

143143
**transaction** object
144144

145-
| Field | Type | Description |
146-
|----------------|--------------------------|---------------------------|
147-
| id | `uint64` | Index of tx in blockchain |
148-
| hash | `binary` | Bytes of tx hash |
149-
| timestamp * | `timestamp` | Timestamp of block |
150-
| total_received | `uint64-string` | Total XMR received |
151-
| total_sent | `uint64-string` | XMR possibly being spent |
152-
| unlock_time | `uint64` | Tx unlock time field |
153-
| height * | `uint64` | Block height |
154-
| spent_outputs | array of `spend` objects | List of possible spends |
155-
| payment_id * | `binary` | Bytes of tx payment id |
156-
| coinbase | `boolean` | True if tx is coinbase |
157-
| mempool | `boolean` | True if tx is in mempool |
158-
| mixin | `uint32` | Mixin of the receive |
145+
| Field | Type | Description |
146+
|----------------|--------------------------|-------------------------------|
147+
| id | `uint64` | Index of tx in blockchain |
148+
| hash | `binary` | Bytes of tx hash |
149+
| timestamp * | `timestamp` | Timestamp of block |
150+
| total_received | `uint64-string` | Total XMR received |
151+
| total_sent | `uint64-string` | XMR possibly being spent |
152+
| unlock_time | `uint64` | Tx unlock time field |
153+
| height * | `uint64` | Block height |
154+
| block_hash * | `binary` | Bytes of this tx's block hash |
155+
| spent_outputs | array of `spend` objects | List of possible spends |
156+
| payment_id * | `binary` | Bytes of tx payment id |
157+
| coinbase | `boolean` | True if tx is coinbase |
158+
| mempool | `boolean` | True if tx is in mempool |
159+
| mixin | `uint32` | Mixin of the receive |
159160

160161
> `id` is determined by the monero daemon. It is the offset that a
161162
> transaction appears in the blockchain from the genesis block.
162163
163-
> `timestamp` and `height` are not sent when `mempool` is true.
164+
> `timestamp`, `height` and `block_hash` are not sent when `mempool` is true.
164165
165166
> `hash` is determined by how the monero core computes the hash.
166167
@@ -248,25 +249,44 @@ spends is returned.
248249

249250
**Request** object
250251

251-
| Field | Type | Description |
252-
|----------|------------------|---------------------------------------|
253-
| address | `base58-address` | Address to retrieve |
254-
| view_key | `binary` | View key bytes for authorization |
252+
| Field | Type | Description |
253+
|-----------------------|------------------|----------------------------------------|
254+
| address | `base58-address` | Address to retrieve |
255+
| view_key | `binary` | View key bytes for authorization |
256+
| since_tx_id * | `uint64` | Most recent tx already known to client |
257+
| since_tx_block_hash * | `binary` | Block hash of most recent tx |
255258

256259
> If `address` is not authorized, the server must return a HTTP 403
257260
> "Forbidden" error.
258261
262+
> `since_tx_id` and `since_tx_block_hash` may be omitted, in which case all
263+
> transactions are returned. If `since_tx_id` is present, `since_tx_block_hash`
264+
> must be, too. The latter is used to handle the case when a blockchain reorg
265+
> has rendered the requested `since_tx_id` invalid. Clients must take care to honor
266+
> the `since_tx_id` returned in the response, which may be different than the
267+
> value that was in the request.
268+
259269
**Response** object
260270

261271
| Field | Type | Description |
262272
|----------------------|--------------------------------|---------------------------|
273+
| since_tx_id * | `uint64` | Most recent omitted tx |
263274
| total_received | `uint64-string` | Sum of received outputs |
264275
| scanned_height | `uint64` | Current tx scan progress |
265276
| scanned_block_height | `uint64` | Current scan progress |
266277
| start_height | `uint64` | Start height of response |
267278
| blockchain_height | `uint64` | Current blockchain height |
279+
| blockchain_height | `uint64` | Current blockchain height |
268280
| transactions | array of `transaction` objects | Possible spend info |
269281

282+
> `since_tx_id` may be omitted if it was omitted from the request. If present,
283+
> it indicates that this response includes only transactions with an `id`
284+
> greater than this one. It may be different than the value in the `request`:
285+
> if a blockchain reorg has rendered the requested id/block_hash pair invalid,
286+
> then some or all of the prior transaction history must be resent. Clients
287+
> must remove all newer transactions from their local history before appending
288+
> the ones from this response.
289+
270290
#### `get_random_outs`
271291
Selects random outputs to use in a ring signature of a new transaction. If the
272292
`amount` is `0` then the `monerod` RPC `get_output_distribution` should be used

0 commit comments

Comments
 (0)