Skip to content

Commit

Permalink
Try both TX serialization formats
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelrogstad committed Mar 27, 2020
1 parent f3ec130 commit 302717b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rpcclient/rawtransactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 302717b

Please sign in to comment.