Skip to content

Commit 63b054a

Browse files
Add a tooltip to CheckTx checkbox and also evaluate tx scripts using Bitcoin.Net library
1 parent d2d05b1 commit 63b054a

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,5 @@ FakesAssemblies/
193193
# LightSwitch generated files
194194
GeneratedArtifacts/
195195
_Pvt_Extensions/
196-
ModelManifest.xml
196+
ModelManifest.xml
197+
*.pubxml

SharpPusher/SharpPusher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Version>0.11.0</Version>
1010
</PropertyGroup>
1111
<ItemGroup>
12-
<PackageReference Include="Autarkysoft.Bitcoin" Version="0.11.0" />
12+
<PackageReference Include="Autarkysoft.Bitcoin" Version="0.12.0" />
1313
<PackageReference Include="Avalonia" Version="0.10.0" />
1414
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
1515
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0" />

SharpPusher/ViewModels/MainWindowViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ public bool CheckTx
246246
set => SetField(ref _checkTx, value);
247247
}
248248

249+
public static string CheckTxToolTip => "Enable to check the transaction hex using Bitcoin.Net library by deserializing " +
250+
"and evaluating all its scripts.";
251+
249252

250253
private bool _isSending;
251254
public bool IsSending
@@ -283,6 +286,23 @@ private async void BroadcastTx()
283286
Status = $"Invalid transaction. Error message: {error}";
284287
return;
285288
}
289+
290+
for (int i = 0; i < tx.TxInList.Length; i++)
291+
{
292+
if (!tx.TxInList[i].SigScript.TryEvaluate(out _, out _, out error))
293+
{
294+
Status = $"Invalid input signature script at index {i}. Error message: {error}";
295+
return;
296+
}
297+
}
298+
for (int i = 0; i < tx.TxOutList.Length; i++)
299+
{
300+
if (!tx.TxOutList[i].PubScript.TryEvaluate(out _, out _, out error))
301+
{
302+
Status = $"Invalid input pubkey script at index {i}. Error message: {error}";
303+
return;
304+
}
305+
}
286306
}
287307

288308
IsSending = true;

SharpPusher/Views/MainWindow.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939

4040
<CheckBox Content="Deserialize and check transaction"
4141
IsVisible="{Binding IsCheckTxVisible}"
42-
IsChecked="{Binding CheckTx}" />
42+
IsChecked="{Binding CheckTx}"
43+
ToolTip.Tip="{Binding CheckTxToolTip}"/>
4344

4445
<Button Content="Broadcast"
4546
Command="{Binding BroadcastTxCommand}"

0 commit comments

Comments
 (0)