diff --git a/block.go b/block.go index 13e10d5..0e5e514 100644 --- a/block.go +++ b/block.go @@ -208,7 +208,7 @@ func NewBlock(msgBlock *btcwire.MsgBlock) *Block { func NewBlockFromBytes(serializedBlock []byte) (*Block, error) { // Deserialize the bytes into a MsgBlock. var msgBlock btcwire.MsgBlock - br := bytes.NewBuffer(serializedBlock) + br := bytes.NewReader(serializedBlock) err := msgBlock.Deserialize(br) if err != nil { return nil, err diff --git a/tx.go b/tx.go index e3c1cc2..1660bf0 100644 --- a/tx.go +++ b/tx.go @@ -74,7 +74,7 @@ func NewTx(msgTx *btcwire.MsgTx) *Tx { func NewTxFromBytes(serializedTx []byte) (*Tx, error) { // Deserialize the bytes into a MsgTx. var msgTx btcwire.MsgTx - br := bytes.NewBuffer(serializedTx) + br := bytes.NewReader(serializedTx) err := msgTx.Deserialize(br) if err != nil { return nil, err