wtxmgr: when creating a TxRecord don't compute txid manually
This fixes a bug introduced by the new segwit behavior upstream in btcd. Previously it was a nice optimization to skip the extra serialization, and compute the txid manually from the serialized transaction. However, with segwit, doing that will generate an invalid txid, since txid’s should ignore any witness data. Therefore, we now fallback to using msgTx.TxSha() which serializes the transaction without witness data before calculating the txid.
This commit is contained in:
parent
d88739df8f
commit
7cb1b47140
1 changed files with 2 additions and 1 deletions
|
@ -111,8 +111,9 @@ func NewTxRecordFromMsgTx(msgTx *wire.MsgTx, received time.Time) (*TxRecord, err
|
|||
MsgTx: *msgTx,
|
||||
Received: received,
|
||||
SerializedTx: buf.Bytes(),
|
||||
Hash: msgTx.TxSha(),
|
||||
}
|
||||
copy(rec.Hash[:], chainhash.DoubleHashB(rec.SerializedTx))
|
||||
|
||||
return rec, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue