Remove filters from VerboseBlock
MODIFY
WalletWasabi.Tests/UnitTests/BitcoinCore/RpcBasedTests.cs
WalletWasabi.Tests/UnitTests/BitcoinCore/RpcBasedTests.cs
@@ -57,8 +57,16 @@ namespace WalletWasabi.Tests.UnitTests.BitcoinCore
};
var blockInfo = await rpc.GetVerboseBlockAsync(uint256.One);
Assert.Equal(2, blockInfo.Transactions.Count());
- Assert.Single(blockInfo.Transactions.ElementAt(1).Inputs);
- Assert.Single(blockInfo.Transactions.ElementAt(1).Outputs);
+ Assert.Equal(1, blockInfo.Transactions.ElementAt(0).Inputs.Count());
+ Assert.Equal(2, blockInfo.Transactions.ElementAt(0).Outputs.Count());
+ Assert.Equal(1, blockInfo.Transactions.ElementAt(1).Inputs.Count());
+ Assert.Equal(2, blockInfo.Transactions.ElementAt(1).Outputs.Count());
+
+ Assert.Equal("01660101", blockInfo.Transactions.ElementAt(0).Inputs.ElementAt(0).Coinbase);
+
+ Assert.Equal(Money.Coins(50), blockInfo.Transactions.ElementAt(1).Inputs.ElementAt(0).PrevOutput.Value);
+ Assert.Equal(Money.Coins((decimal)48.99995500), blockInfo.Transactions.ElementAt(1).Outputs.ElementAt(0).Value);
+ Assert.Equal(Money.Coins((decimal)1.00000000), blockInfo.Transactions.ElementAt(1).Outputs.ElementAt(1).Value);
}
#region Mocked RPC response
@@ -144,7 +152,7 @@ namespace WalletWasabi.Tests.UnitTests.BitcoinCore
'desc': 'addr(mkda7wbQ9nVQa8ayYbTVifVzNie1kf8gKy)#yzcmfs2s',
'hex': '76a914381907cb00a047109bc340afe06504d67472d3de88ac',
'reqSigs': 1,
- 'type': 'witness_v0_keyhash',
+ 'type': 'pubkeyhash',
'addresses': [
'mkda7wbQ9nVQa8ayYbTVifVzNie1kf8gKy'
]
@@ -176,7 +184,7 @@ namespace WalletWasabi.Tests.UnitTests.BitcoinCore
'desc': 'addr(mjLpPfQNYKCJGc1qXyU71wr6vt9yuVPLR6)#4ezwynfz',
'hex': '76a91429f5bf0598ecef7ae4f9f1163cdeecf1182c51f988ac',
'reqSigs': 1,
- 'type': 'witness_v0_keyhash',
+ 'type': 'pubkeyhash',
'addresses': [
'mjLpPfQNYKCJGc1qXyU71wr6vt9yuVPLR6'
]

MODIFY
WalletWasabi/Extensions/RPCClientExtensions.cs
WalletWasabi/Extensions/RPCClientExtensions.cs
@@ -309,26 +309,28 @@ namespace NBitcoin.RPC
var outputs = new List<VerboseOutputInfo>();
var tx = new VerboseTransactionInfo(uint256.Parse(txJson.Value<string>("txid")), inputs, outputs);
- var txinJsonInputs = txJson["vin"]
- .Where(x => !(x["coinbase"] is { }))
- .Where(x => x["prevout"]["scriptPubKey"].Value<string>("type") == "witness_v0_keyhash");
+ foreach (var txinJson in txJson["vin"])
+ {
+ VerboseInputInfo input = null;
- foreach (var txinJson in txinJsonInputs)
+ if (txinJson["coinbase"] is { })
+ {
+ input = new VerboseInputInfo(txinJson["coinbase"].Value<string>());
+ }
+ else
{
- var input = new VerboseInputInfo(
+ input = new VerboseInputInfo(
outPoint: new OutPoint(uint256.Parse(txinJson.Value<string>("txid")), txinJson.Value<uint>("vout")),
prevOutput: new VerboseOutputInfo(
value: Money.Coins(txinJson["prevout"].Value<decimal>("value")),
scriptPubKey: Script.FromHex(txinJson["prevout"]["scriptPubKey"].Value<string>("hex")))
);
+ }
inputs.Add(input);
}
- var txinJsonOutputs = txJson["vout"]
- .Where(x => x["scriptPubKey"].Value<string>("type") == "witness_v0_keyhash");
-
- foreach (var txoutJson in txinJsonOutputs)
+ foreach (var txoutJson in txJson["vout"])
{
var output = new VerboseOutputInfo(
value: Money.Coins(txoutJson.Value<decimal>("value")),

MODIFY
WalletWasabi/Extensions/VerboseInputInfo.cs
WalletWasabi/Extensions/VerboseInputInfo.cs
@@ -2,6 +2,11 @@ namespace NBitcoin.RPC
{
public class VerboseInputInfo
{
+ public VerboseInputInfo(string coinbase)
+ {
+ Coinbase = coinbase;
+ }
+
public VerboseInputInfo(OutPoint outPoint, VerboseOutputInfo prevOutput)
{
OutPoint = outPoint;
@@ -11,5 +16,7 @@ namespace NBitcoin.RPC
public OutPoint OutPoint { get; }
public VerboseOutputInfo PrevOutput { get; }
+
+ public string Coinbase { get; }
}
}

Remove filters from VerboseBlock