Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Stratis.Bitcoin.IntegrationTests/SegWitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using Stratis.Bitcoin.P2P.Protocol.Payloads;
using Stratis.Bitcoin.Tests.Common;
using Stratis.Bitcoin.Utilities.Extensions;
using Stratis.Bitcoin.Utilities.JsonErrors;
using Xunit;

namespace Stratis.Bitcoin.IntegrationTests
Expand Down Expand Up @@ -713,8 +714,15 @@ public void SegwitWalletTransactionBuildingTest_SpendP2WPKHAndNormalUTXOs()
FeeAmount = Money.Coins(0.001m).ToString()
}).GetAwaiter().GetResult();

if (transactionResult is ErrorResult errorResult && errorResult.Value is ErrorResponse errorResponse)
{
Assert.False(true, errorResponse.Errors.First().Message);
}

walletBuildTransactionModel = (WalletBuildTransactionModel)(transactionResult as JsonResult)?.Value;

Assert.NotNull(walletBuildTransactionModel);

_ = node.FullNode.NodeController<WalletController>().SendTransactionAsync(new SendTransactionRequest(walletBuildTransactionModel.Hex));

TestBase.WaitLoop(() => node.CreateRPCClient().GetRawMempool().Length > 0, cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(1)).Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,8 @@ internal IEnumerable<TxDestination> GetDestinations(Script redeemScript)
{
if (txDestination.ToBytes().Length == 20)
{
yield return PayToWitPubKeyHashTemplate.Instance.ExtractScriptPubKeyParameters(this.network, redeemScript);
yield return new KeyId(txDestination.ToBytes());
}
else if (txDestination.ToBytes().Length == 32)
{
yield return PayToWitScriptHashTemplate.Instance.ExtractScriptPubKeyParameters(this.network, redeemScript);
}

// This should not happen, segwit scripts should generally only have one of the two valid lengths.
yield return txDestination;
}
break;
default:
Expand Down