diff --git a/NBitcoin/RPC/RestClient.cs b/NBitcoin/RPC/RestClient.cs index e670e2f009..9a0178599d 100644 --- a/NBitcoin/RPC/RestClient.cs +++ b/NBitcoin/RPC/RestClient.cs @@ -76,23 +76,25 @@ public RestClient(Uri address, Network network) /// The block identifier. /// Given a block hash (id) returns the requested block object. /// blockId cannot be null. - public async Task GetBlockAsync(uint256 blockId, int verbosity = 0) + public async Task 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); } + /// /// Gets the block. /// /// The block identifier. /// Given a block hash (id) returns the requested block object. /// blockId cannot be null. - public Block GetBlock(uint256 blockId, int verbosity = 0) + public async Task GetBlockAsync(uint256 blockId, int verbosity) { - return GetBlockAsync(blockId).GetAwaiter().GetResult(); + var result = await GetBlockAsync(blockId, (RestResponseFormat)verbosity).ConfigureAwait(false); + return result; } /// @@ -112,6 +114,7 @@ public async Task GetTransactionAsync(uint256 txId) tx.ReadWrite(result, Network); return tx; } + /// /// Gets a transaction. ///