Permalink
Browse files

Assumes segwit tx if txin.ScriptSig is empty

  • Loading branch information...
lontivero committed Oct 17, 2018
1 parent 8b304be commit e3298d6055a5e9b9a28c249dc0aff63fceac8372
Showing with 19 additions and 2 deletions.
  1. +14 −1 WalletWasabi/Extensions/NBitcoinExtensions.cs
  2. +5 −1 WalletWasabi/Services/WalletService.cs
@@ -34,7 +34,20 @@ public static void FromHex(this IBitcoinSerializable me, string hex)
me.FromBytes(ByteHelpers.FromHex(hex));
}
public static bool SpendsOrReceivesWitness(this Transaction me) => me.HasWitness || me.Outputs.Any(x => x.ScriptPubKey.IsWitness);
public static bool SpendsOrReceivesWitness(this Transaction me)
{
foreach(TxIn input in me.Inputs)
{
if(input.ScriptSig == null || input.ScriptSig == Script.Empty)
return true;
}
foreach(TxOut output in me.Outputs)
{
if(output.ScriptPubKey.IsWitness)
return true;
}
return false;
}
public static IEnumerable<(Money value, int count)> GetIndistinguishableOutputs(this Transaction me)
{
@@ -397,7 +397,11 @@ private void ProcessTransaction(SmartTransaction tx)
}
}
}
if (!tx.Transaction.SpendsOrReceivesWitness()) return; // We don't care about non-witness transactions for other than mempool cleanup.
else
{
if (!tx.Transaction.SpendsOrReceivesWitness())
return; // We don't care about non-witness transactions for other than mempool cleanup.
}
//iterate tx
// if already have the coin

0 comments on commit e3298d6

Please sign in to comment.