Published 15 October 2018

PoolListGet

Getting the content of blocks starting from the offset block, with the number of blocks being equal to limit.

Parameters

Parameters:

1: i64 offset

2: i64 limit

Type of result: PoolListGetResult

Operation algorithm

Operation algorithm:

We set a limit on the values of offset and limit parameters equal to 100.

We allocate space to the pool of return result in the amount of limit.

We retrieve the last block’s hash value on the blockchain as the current hash and the number of blocks on the blockchain.

In respect of all blocks starting from the offset block, with the number of blocks being equal to limit, we perform the following actions in reverse order:

We search for a block with the current hash value in the pool cache.

If the current block is located at the end of the pool cache, then we:

Download that block and convert it to the API pool format.

If the block falls within the range of blocks to be returned, then we add it to the result pool.

Add the hash value and pool to the pool cache.

Retrieve the previous block's hash value.

Or else we add the current block being viewed to the result and set a hash value equal to the previous block's hash value.

Data structure

The following structures are used for marshalling purposes:

PoolListGetResult    transaction pool list get result

APIResponse status

status

i8 code //status code

string message //status communication

bool result

result success boolean flag

Pools pools

set of pools

Example

Example

/** PoolListGet begin */

 

PoolListGetResult plg_res;

 

try

{

         api->PoolListGet(plg_res, 0, 10);

}

catch (...)

{

         return 1;

}

 

plg_res.printTo(std::cout);

std::cout << std::endl << std::endl;

 

/** PoolListGet end */

14 Useful article

Contents