mirror of
https://github.com/btcsuite/btcd.git
synced 2025-02-23 14:40:44 +01:00
Try both TX serialization formats
This commit is contained in:
parent
08b8751559
commit
57d44d022e
1 changed files with 7 additions and 2 deletions
|
@ -233,8 +233,13 @@ func (r FutureCreateRawTransactionResult) Receive() (*wire.MsgTx, error) {
|
||||||
|
|
||||||
// Deserialize the transaction and return it.
|
// Deserialize the transaction and return it.
|
||||||
var msgTx wire.MsgTx
|
var msgTx wire.MsgTx
|
||||||
if err := msgTx.Deserialize(bytes.NewReader(serializedTx)); err != nil {
|
// we try both the new and old encoding format
|
||||||
return nil, err
|
witnessErr := msgTx.Deserialize(bytes.NewReader(serializedTx))
|
||||||
|
if witnessErr != nil {
|
||||||
|
legacyErr := msgTx.DeserializeNoWitness(bytes.NewReader(serializedTx))
|
||||||
|
if legacyErr != nil {
|
||||||
|
return nil, legacyErr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &msgTx, nil
|
return &msgTx, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue