diff --git a/NBitcoin/Protocol/Payloads/CompactFilterPayload.cs b/NBitcoin/Protocol/Payloads/CompactFilterPayload.cs index b1e2f7583..56cc3bfbc 100644 --- a/NBitcoin/Protocol/Payloads/CompactFilterPayload.cs +++ b/NBitcoin/Protocol/Payloads/CompactFilterPayload.cs @@ -51,11 +51,11 @@ public CompactFilterPayload() { } - public new void ReadWrite(BitcoinStream stream) + public override void ReadWriteCore(BitcoinStream stream) { stream.ReadWrite(ref _FilterType); stream.ReadWrite(ref _BlockHash); - stream.ReadWrite(_FilterBytes); + stream.ReadWriteAsVarString(ref _FilterBytes); } } diff --git a/NBitcoin/Protocol/UnknowPayload.cs b/NBitcoin/Protocol/UnknowPayload.cs index f412ffe09..3f1d5bf05 100644 --- a/NBitcoin/Protocol/UnknowPayload.cs +++ b/NBitcoin/Protocol/UnknowPayload.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -43,7 +44,13 @@ public byte[] Data } public override void ReadWriteCore(BitcoinStream stream) { - stream.ReadWrite(_Data); + if (stream.Serializing) { + stream.ReadWrite(_Data); + } else { + MemoryStream ms = new MemoryStream(); + stream.Inner.CopyTo(ms); + _Data = ms.ToArray(); + } } } } diff --git a/NBitcoin/Transaction.cs b/NBitcoin/Transaction.cs index b31c907c3..cb044469e 100644 --- a/NBitcoin/Transaction.cs +++ b/NBitcoin/Transaction.cs @@ -1585,8 +1585,8 @@ public virtual void ReadWrite(BitcoinStream stream) if (flags != 0) { /* Use extended format in case witnesses are to be serialized. */ - TxInList vinDummy = new TxInList(); - stream.ReadWrite(ref vinDummy); + byte marker = 0; + stream.ReadWrite(ref marker); stream.ReadWrite(ref flags); } stream.ReadWrite(ref vin); @@ -2039,7 +2039,7 @@ public virtual bool HasWitness /// Context free transaction check /// /// The error or success of the check - public TransactionCheckResult Check() + public virtual TransactionCheckResult Check() { // Basic checks that don't depend on any context if (Inputs.Count == 0)