From 57d44d022ecb4edac34e1ea7dbd62c7a592d3d58 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Mon, 2 Dec 2019 11:42:14 +0100 Subject: [PATCH] Try both TX serialization formats --- rpcclient/rawtransactions.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rpcclient/rawtransactions.go b/rpcclient/rawtransactions.go index 4bf4ee57..23754d96 100644 --- a/rpcclient/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -233,8 +233,13 @@ func (r FutureCreateRawTransactionResult) Receive() (*wire.MsgTx, error) { // Deserialize the transaction and return it. var msgTx wire.MsgTx - if err := msgTx.Deserialize(bytes.NewReader(serializedTx)); err != nil { - return nil, err + // we try both the new and old encoding format + witnessErr := msgTx.Deserialize(bytes.NewReader(serializedTx)) + if witnessErr != nil { + legacyErr := msgTx.DeserializeNoWitness(bytes.NewReader(serializedTx)) + if legacyErr != nil { + return nil, legacyErr + } } return &msgTx, nil }