Skip to main content

ResQ.Blockchain.MockNeoClient

MockNeoClient.GetBlockHeightAsync(CancellationToken) Method

Gets the current mock block height.
public System.Threading.Tasks.Task<ulong> GetBlockHeightAsync(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

cancellationToken System.Threading.CancellationToken Cancellation token for the operation. Implements GetBlockHeightAsync(CancellationToken)

Returns

System.Threading.Tasks.Task<System.UInt64>
The current block height, starting at 1,000,000 and incrementing with each transaction.

Example

var initialHeight = await mockClient.GetBlockHeightAsync();
// Returns: 1000000

await mockClient.RecordEventAsync(evt);

var newHeight = await mockClient.GetBlockHeightAsync();
// Returns: 1000001

Remarks

The block height starts at 1,000,000 and increases by 1 for each recorded transaction. This simulates blockchain growth without requiring an actual network connection.