Skip to content

Commit

Permalink
Use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptin committed Jan 15, 2020
1 parent 63fa28b commit c36dec3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions NBitcoin/RPC/RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,25 @@ public RestClient(Uri address, Network network)
/// <param name="blockId">The block identifier.</param>
/// <returns>Given a block hash (id) returns the requested block object.</returns>
/// <exception cref="System.ArgumentNullException">blockId cannot be null.</exception>
public async Task<Block> GetBlockAsync(uint256 blockId, int verbosity = 0)
public async Task<Block> GetBlockAsync(uint256 blockId, RestResponseFormat verbosity = RestResponseFormat.Bin)
{
if (blockId == null)
throw new ArgumentNullException(nameof(blockId));

var result = await SendRequestAsync("block", RestResponseFormat.Bin, blockId.ToString()).ConfigureAwait(false);
var result = await SendRequestAsync("block", verbosity, blockId.ToString()).ConfigureAwait(false);
return Block.Load(result, Network);
}

/// <summary>
/// Gets the block.
/// </summary>
/// <param name="blockId">The block identifier.</param>
/// <returns>Given a block hash (id) returns the requested block object.</returns>
/// <exception cref="System.ArgumentNullException">blockId cannot be null.</exception>
public Block GetBlock(uint256 blockId, int verbosity = 0)
public async Task<Block> GetBlockAsync(uint256 blockId, int verbosity)
{
return GetBlockAsync(blockId).GetAwaiter().GetResult();
var result = await GetBlockAsync(blockId, (RestResponseFormat)verbosity).ConfigureAwait(false);
return result;
}

/// <summary>
Expand All @@ -112,6 +114,7 @@ public async Task<Transaction> GetTransactionAsync(uint256 txId)
tx.ReadWrite(result, Network);
return tx;
}

/// <summary>
/// Gets a transaction.
/// </summary>
Expand Down

0 comments on commit c36dec3

Please sign in to comment.